test: refactor: Use BOOST_CHECK_EQUAL over BOOST_CHECK ==
What changed, and why it matters
This commit only changes test code to use a different style of comparison check. It does not alter any production code, network behavior, or wallet logic, and has no security relevance.
No action needed; this is a non-security test refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors src/test/util_expected_tests.cpp by replacing BOOST_CHECK(expr == value) with BOOST_CHECK_EQUAL(expr, value). This is a test-only style change that improves diagnostic output on failure but does not change what is being tested or any runtime behavior.
Changed components
src/test/util_expected_tests.cppInspect captured patch +9 / −9
diff --git a/src/test/util_expected_tests.cpp b/src/test/util_expected_tests.cpp
index 61a6d2e0..67a1a5fb 100644
--- a/src/test/util_expected_tests.cpp
+++ b/src/test/util_expected_tests.cpp
@@ -17,15 +17,15 @@ BOOST_AUTO_TEST_CASE(expected_value)
int x;
};
Expected<Obj, int> e{};
- BOOST_CHECK(e.value().x == 0);
+ BOOST_CHECK_EQUAL(e.value().x, 0);
e = Obj{42};
BOOST_CHECK(e.has_value());
BOOST_CHECK(static_cast<bool>(e));
- BOOST_CHECK(e.value().x == 42);
- BOOST_CHECK((*e).x == 42);
- BOOST_CHECK(e->x == 42);
+ BOOST_CHECK_EQUAL(e.value().x, 42);
+ BOOST_CHECK_EQUAL((*e).x, 42);
+ BOOST_CHECK_EQUAL(e->x, 42);
// modify value
e.value().x += 1;
@@ -33,9 +33,9 @@ BOOST_AUTO_TEST_CASE(expected_value)
e->x += 1;
const auto& read{e};
- BOOST_CHECK(read.value().x == 45);
- BOOST_CHECK((*read).x == 45);
- BOOST_CHECK(read->x == 45);
+ BOOST_CHECK_EQUAL(read.value().x, 45);
+ BOOST_CHECK_EQUAL((*read).x, 45);
+ BOOST_CHECK_EQUAL(read->x, 45);
}
BOOST_AUTO_TEST_CASE(expected_value_or)
@@ -56,13 +56,13 @@ BOOST_AUTO_TEST_CASE(expected_error)
e = Unexpected{"fail"};
BOOST_CHECK(!e.has_value());
BOOST_CHECK(!static_cast<bool>(e));
- BOOST_CHECK(e.error() == "fail");
+ BOOST_CHECK_EQUAL(e.error(), "fail");
// modify error
e.error() += "1";
const auto& read{e};
- BOOST_CHECK(read.error() == "fail1");
+ BOOST_CHECK_EQUAL(read.error(), "fail1");
}
BOOST_AUTO_TEST_SUITE_END()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.