Skip to content

Commit

Permalink
Fixed additional asserts -> throw
Browse files Browse the repository at this point in the history
  • Loading branch information
vollous committed Apr 23, 2024
1 parent 67bc7a6 commit 38f86a4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions include/BSMPT/utility/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ std::vector<T> operator+(const std::vector<T> &a, const std::vector<T> &b)
template <typename T>
std::vector<T> operator-(const std::vector<T> &a, const std::vector<T> &b)
{
assert(a.size() == b.size());
if (a.size() != b.size())
throw("Vector cannot be subtracted. Must have the same size.");

Check warning on line 137 in include/BSMPT/utility/utility.h

View check run for this annotation

Codecov / codecov/patch

include/BSMPT/utility/utility.h#L137

Added line #L137 was not covered by tests

std::vector<T> result;
result.reserve(a.size());
Expand Down Expand Up @@ -184,7 +185,9 @@ std::vector<T> operator/(const std::vector<T> &a, const T2 &b)
template <typename T>
T operator*(const std::vector<T> &a, const std::vector<T> &b)
{
assert(a.size() == b.size());
if (a.size() != b.size())
throw(

Check warning on line 189 in include/BSMPT/utility/utility.h

View check run for this annotation

Codecov / codecov/patch

include/BSMPT/utility/utility.h#L189

Added line #L189 was not covered by tests
"Dot product between vectors cannot be done. Must have the same size.");

std::vector<T> result;
result.reserve(a.size());
Expand All @@ -207,7 +210,9 @@ template <typename T>
std::vector<T> operator*(const std::vector<std::vector<T>> &a,
const std::vector<T> &b)
{
assert(a.size() == b.size());
if (a.size() != b.size())
throw("Multiplication of matrix with vector cannot be done. Must have the "

Check warning on line 214 in include/BSMPT/utility/utility.h

View check run for this annotation

Codecov / codecov/patch

include/BSMPT/utility/utility.h#L214

Added line #L214 was not covered by tests
"same size.");

std::vector<T> result;
result.reserve(a.size());
Expand Down

0 comments on commit 38f86a4

Please sign in to comment.