Skip to content

Commit caac999

Browse files
committed
refactor: remove dependence on AddrManTest
1 parent f961c47 commit caac999

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/addrman_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,32 +268,32 @@ BOOST_AUTO_TEST_CASE(addrman_new_collisions)
268268

269269
BOOST_AUTO_TEST_CASE(addrman_tried_collisions)
270270
{
271-
AddrManTest addrman;
271+
auto addrman = std::make_unique<AddrMan>(std::vector<bool>(), /*deterministic=*/true, /*consistency_check_ratio=*/100);
272272

273273
CNetAddr source = ResolveIP("252.2.2.2");
274274

275275
uint32_t num_addrs{0};
276276

277-
BOOST_CHECK_EQUAL(addrman.size(), num_addrs);
277+
BOOST_CHECK_EQUAL(addrman->size(), num_addrs);
278278

279279
while (num_addrs < 35) { // Magic number! 250.1.1.1 - 250.1.1.35 do not collide in tried with deterministic key = 1
280280
CService addr = ResolveService("250.1.1." + ToString(++num_addrs));
281-
BOOST_CHECK(addrman.Add({CAddress(addr, NODE_NONE)}, source));
281+
BOOST_CHECK(addrman->Add({CAddress(addr, NODE_NONE)}, source));
282282

283283
// Test: Add to tried without collision
284-
BOOST_CHECK(addrman.Good(CAddress(addr, NODE_NONE)));
284+
BOOST_CHECK(addrman->Good(CAddress(addr, NODE_NONE)));
285285

286286
}
287287

288288
// Test: Unable to add to tried table due to collision!
289289
CService addr1 = ResolveService("250.1.1." + ToString(++num_addrs));
290-
BOOST_CHECK(addrman.Add({CAddress(addr1, NODE_NONE)}, source));
291-
BOOST_CHECK(!addrman.Good(CAddress(addr1, NODE_NONE)));
290+
BOOST_CHECK(addrman->Add({CAddress(addr1, NODE_NONE)}, source));
291+
BOOST_CHECK(!addrman->Good(CAddress(addr1, NODE_NONE)));
292292

293293
// Test: Add the next address to tried without collision
294294
CService addr2 = ResolveService("250.1.1." + ToString(++num_addrs));
295-
BOOST_CHECK(addrman.Add({CAddress(addr2, NODE_NONE)}, source));
296-
BOOST_CHECK(addrman.Good(CAddress(addr2, NODE_NONE)));
295+
BOOST_CHECK(addrman->Add({CAddress(addr2, NODE_NONE)}, source));
296+
BOOST_CHECK(addrman->Good(CAddress(addr2, NODE_NONE)));
297297
}
298298

299299
BOOST_AUTO_TEST_CASE(addrman_find)

0 commit comments

Comments
 (0)