sigcheckcount_tests: better macro
Summary:
I noticed flags & ~SCRIPT_REPORT_SIGCHECKS was not expanding in the
intended way (gcc was warning this, but not clang). Classic macro
mistake, also there are other macro gotchas - this would have been
classified as an 'unsafe macro'.
https://wiki.sei.cmu.edu/confluence/display/c/PRE01-C.+Use+parentheses+within+macros+around+parameter+names
https://wiki.sei.cmu.edu/confluence/display/c/PRE12-C.+Do+not+define+unsafe+macros
The reason for using macros here was to make sure the origin of a
test failure can be printed out, as it's quite annoying to have a
context-less failure in an inner function. Fortunately
BOOST_TEST_CONTEXT provides a much nicer and more generic way to
give context, and I use it to make a safe macro instead. Awesome!
Test Plan:
ninja check
Try changing the last test's 2 to a 1, you will then see:
../src/test/sigcheckcount_tests.cpp(328): error: in "sigcheckcount_tests/test_verifyscript": check metricsRet.nSigChecks == expected_sigchecks has failed [2 != 1] Failure occurred in a following context: ../src/test/sigcheckcount_tests.cpp:365 *** 1 failure is detected in the test module "Bitcoin Test Suite"
Reviewers: Fabien, #bitcoin_abc
Reviewed By: Fabien, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D5153