test: refactor: Give unit test functions access to test state

Add unit test subclasses as needed so unit test functions that need to access
members like m_rng can reference it directly.
This commit is contained in:
Ryan Ofsky
2024-08-14 07:58:26 -04:00
committed by MarcoFalke
parent fab023e177
commit 3dc527f460
16 changed files with 145 additions and 81 deletions

View File

@@ -256,8 +256,9 @@ BOOST_AUTO_TEST_CASE(versionbits_test)
}
}
struct BlockVersionTest : BasicTestingSetup {
/** Check that ComputeBlockVersion will set the appropriate bit correctly */
static void check_computeblockversion(VersionBitsCache& versionbitscache, const Consensus::Params& params, Consensus::DeploymentPos dep)
void check_computeblockversion(VersionBitsCache& versionbitscache, const Consensus::Params& params, Consensus::DeploymentPos dep)
{
// Clear the cache every time
versionbitscache.Clear();
@@ -412,8 +413,9 @@ static void check_computeblockversion(VersionBitsCache& versionbitscache, const
// Check that we don't signal after activation
BOOST_CHECK_EQUAL(versionbitscache.ComputeBlockVersion(lastBlock, params) & (1 << bit), 0);
}
}; // struct BlockVersionTest
BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
BOOST_FIXTURE_TEST_CASE(versionbits_computeblockversion, BlockVersionTest)
{
VersionBitsCache vbcache;