@@ -46,46 +46,41 @@ BOOST_AUTO_TEST_SUITE(block_finder_tests);
46
46
BOOST_AUTO_TEST_CASE (FindBlockInNormalChainShouldWork)
47
47
{
48
48
BlockChain<100 > chain;
49
- GRC::BlockFinder finder;
50
49
for (auto & block : chain.blocks )
51
- BOOST_CHECK_EQUAL (&block, finder. FindByHeight (block.nHeight ));
50
+ BOOST_CHECK_EQUAL (&block, GRC::BlockFinder:: FindByHeight (block.nHeight ));
52
51
}
53
52
54
53
BOOST_AUTO_TEST_CASE (FindBlockAboveHighestHeightShouldReturnHighestBlock)
55
54
{
56
55
BlockChain<100 > chain;
57
- GRC::BlockFinder finder;
58
56
CBlockIndex& last = chain.blocks .back ();
59
- BOOST_CHECK_EQUAL (&last, finder. FindByHeight (101 ));
57
+ BOOST_CHECK_EQUAL (&last, GRC::BlockFinder:: FindByHeight (101 ));
60
58
}
61
59
62
60
BOOST_AUTO_TEST_CASE (FindBlockByHeightShouldWorkOnChainsWithJustOneBlock)
63
61
{
64
62
BlockChain<1 > chain;
65
- GRC::BlockFinder finder;
66
- BOOST_CHECK_EQUAL (&chain.blocks .front (), finder.FindByHeight (0 ));
67
- BOOST_CHECK_EQUAL (&chain.blocks .front (), finder.FindByHeight (1 ));
68
- BOOST_CHECK_EQUAL (&chain.blocks .front (), finder.FindByHeight (-1 ));
63
+ BOOST_CHECK_EQUAL (&chain.blocks .front (), GRC::BlockFinder::FindByHeight (0 ));
64
+ BOOST_CHECK_EQUAL (&chain.blocks .front (), GRC::BlockFinder::FindByHeight (1 ));
65
+ BOOST_CHECK_EQUAL (&chain.blocks .front (), GRC::BlockFinder::FindByHeight (-1 ));
69
66
}
70
67
71
68
BOOST_AUTO_TEST_CASE (FindBlockByTimeShouldReturnNextYoungestBlock)
72
69
{
73
70
// Chain with block times 0, 10, 20, 30, 40 etc.
74
71
BlockChain<10 > chain;
75
- GRC::BlockFinder finder;
76
72
77
73
// Finding the block older than time 10 should return block #2
78
74
// which has time 20.
79
- BOOST_CHECK_EQUAL (&chain.blocks [2 ], finder. FindByMinTime (11 ));
80
- BOOST_CHECK_EQUAL (&chain.blocks [1 ], finder. FindByMinTime (10 ));
81
- BOOST_CHECK_EQUAL (&chain.blocks [1 ], finder. FindByMinTime (9 ));
75
+ BOOST_CHECK_EQUAL (&chain.blocks [2 ], GRC::BlockFinder:: FindByMinTime (11 ));
76
+ BOOST_CHECK_EQUAL (&chain.blocks [1 ], GRC::BlockFinder:: FindByMinTime (10 ));
77
+ BOOST_CHECK_EQUAL (&chain.blocks [1 ], GRC::BlockFinder:: FindByMinTime (9 ));
82
78
}
83
79
84
80
BOOST_AUTO_TEST_CASE (FindBlockByTimeShouldReturnLastBlockIfOlderThanTime)
85
81
{
86
82
BlockChain<10 > chain;
87
- GRC::BlockFinder finder;
88
- BOOST_CHECK_EQUAL (&chain.blocks .back (), finder.FindByMinTime (999999 ));
83
+ BOOST_CHECK_EQUAL (&chain.blocks .back (), GRC::BlockFinder::FindByMinTime (999999 ));
89
84
}
90
85
91
86
BOOST_AUTO_TEST_SUITE_END ()
0 commit comments