mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
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:
parent
fab023e177
commit
3dc527f460
16 changed files with 145 additions and 81 deletions
|
|
@ -34,7 +34,9 @@ struct NoLockLoggingTestingSetup : public TestingSetup {
|
|||
#endif
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, NoLockLoggingTestingSetup)
|
||||
struct CheckQueueTest : NoLockLoggingTestingSetup {
|
||||
void Correct_Queue_range(std::vector<size_t> range);
|
||||
};
|
||||
|
||||
static const unsigned int QUEUE_BATCH_SIZE = 128;
|
||||
static const int SCRIPT_CHECK_THREADS = 3;
|
||||
|
|
@ -156,7 +158,7 @@ typedef CCheckQueue<FrozenCleanupCheck> FrozenCleanup_Queue;
|
|||
/** This test case checks that the CCheckQueue works properly
|
||||
* with each specified size_t Checks pushed.
|
||||
*/
|
||||
static void Correct_Queue_range(std::vector<size_t> range)
|
||||
void CheckQueueTest::Correct_Queue_range(std::vector<size_t> range)
|
||||
{
|
||||
auto small_queue = std::make_unique<Correct_Queue>(QUEUE_BATCH_SIZE, SCRIPT_CHECK_THREADS);
|
||||
// Make vChecks here to save on malloc (this test can be slow...)
|
||||
|
|
@ -177,6 +179,8 @@ static void Correct_Queue_range(std::vector<size_t> range)
|
|||
}
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(checkqueue_tests, CheckQueueTest)
|
||||
|
||||
/** Test that 0 checks is correct
|
||||
*/
|
||||
BOOST_AUTO_TEST_CASE(test_CheckQueue_Correct_Zero)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue