Commit 16dba433 authored by Dominik Charousset's avatar Dominik Charousset

Return the result from check functions

parent 7b96836a
...@@ -39,12 +39,13 @@ void runnable::run() { ...@@ -39,12 +39,13 @@ void runnable::run() {
} }
} }
void runnable::check(bool value, const detail::source_location& location) { bool runnable::check(bool value, const detail::source_location& location) {
if (value) { if (value) {
reporter::instance->pass(location); reporter::instance->pass(location);
return; } else {
}
reporter::instance->fail("should be true", location); reporter::instance->fail("should be true", location);
}
return value;
} }
block& runnable::current_block() { block& runnable::current_block() {
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
/// Checks whether `lhs` and `rhs` are equal. /// Checks whether `lhs` and `rhs` are equal.
template <class T0, class T1> template <class T0, class T1>
void check_eq(const T0& lhs, const T1& rhs, bool check_eq(const T0& lhs, const T1& rhs,
const detail::source_location& location const detail::source_location& location
= detail::source_location::current()) { = detail::source_location::current()) {
if (std::is_integral_v<T0> && std::is_integral_v<T1>) { if (std::is_integral_v<T0> && std::is_integral_v<T1>) {
...@@ -64,13 +64,14 @@ public: ...@@ -64,13 +64,14 @@ public:
} }
if (lhs == rhs) { if (lhs == rhs) {
reporter::instance->pass(location); reporter::instance->pass(location);
return; return true;
} }
reporter::instance->fail(binary_predicate::eq, stringify(lhs), reporter::instance->fail(binary_predicate::eq, stringify(lhs),
stringify(rhs), location); stringify(rhs), location);
return false;
} }
void check(bool value, const detail::source_location& location bool check(bool value, const detail::source_location& location
= detail::source_location::current()); = detail::source_location::current());
block& current_block(); block& current_block();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment