Skip to content

Commit 6e9f78f

Browse files
authored
Merge pull request #49 from rustaceanrob/26-6-23-boost-follow
test: Small touchups to the framework
2 parents 14a8c1a + 0ff416d commit 6e9f78f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/test/util/framework.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class TestContext
155155
private:
156156
std::atomic<int> m_checks{0};
157157
std::atomic<int> m_failed{0};
158-
bool m_did_throw{false};
158+
std::atomic<bool> m_did_throw{false};
159159
const std::string m_full_name;
160160
const std::thread::id m_owner_thread{std::this_thread::get_id()};
161161

@@ -185,12 +185,12 @@ class TestContext
185185

186186
void exception_occured()
187187
{
188-
m_did_throw = true;
188+
m_did_throw.store(true, std::memory_order_relaxed);
189189
}
190190

191-
bool did_fail()
191+
bool passed()
192192
{
193-
return m_did_throw || m_failed.load(std::memory_order_relaxed) > 0;
193+
return !m_did_throw.load(std::memory_order_relaxed) || m_failed.load(std::memory_order_relaxed) == 0;
194194
}
195195

196196
TestStats stats() const noexcept
@@ -514,7 +514,7 @@ inline int run(int argc, char** argv)
514514
}
515515
const auto stats = ctx.stats();
516516
summary.total_checks += stats.checks;
517-
if (!ctx.did_fail()) {
517+
if (ctx.passed()) {
518518
++summary.passed;
519519
log(LogLevel::Info, "[ OK ] %s (%d checks)\n", test_case.name, stats.checks);
520520
} else {

0 commit comments

Comments
 (0)