Skip to content

Commit b696d78

Browse files
committed
test: Remove tests for internal helper functions
The logic of these functions is already covered by existing unit tests using publicly exposed functions of the interface. Therefore, removing them does not decrease test coverage.
1 parent 0538520 commit b696d78

File tree

1 file changed

+0
-72
lines changed

1 file changed

+0
-72
lines changed

src/test/addrman_tests.cpp

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -269,78 +269,6 @@ BOOST_AUTO_TEST_CASE(addrman_tried_collisions)
269269
BOOST_CHECK(addrman->Good(CAddress(addr2, NODE_NONE)));
270270
}
271271

272-
BOOST_AUTO_TEST_CASE(addrman_find)
273-
{
274-
AddrManTest addrman;
275-
276-
BOOST_CHECK_EQUAL(addrman.size(), 0U);
277-
278-
CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE);
279-
CAddress addr2 = CAddress(ResolveService("250.1.2.1", 9999), NODE_NONE);
280-
CAddress addr3 = CAddress(ResolveService("251.255.2.1", 8333), NODE_NONE);
281-
282-
CNetAddr source1 = ResolveIP("250.1.2.1");
283-
CNetAddr source2 = ResolveIP("250.1.2.2");
284-
285-
BOOST_CHECK(addrman.Add({addr1}, source1));
286-
BOOST_CHECK(addrman.Add({addr2}, source2));
287-
BOOST_CHECK(addrman.Add({addr3}, source1));
288-
289-
// Test: ensure Find returns an IP/port matching what we searched on.
290-
AddrInfo* info1 = addrman.Find(addr1);
291-
BOOST_REQUIRE(info1);
292-
BOOST_CHECK_EQUAL(info1->ToString(), "250.1.2.1:8333");
293-
294-
// Test; Find discriminates by port number.
295-
AddrInfo* info2 = addrman.Find(addr2);
296-
BOOST_REQUIRE(info2);
297-
BOOST_CHECK_EQUAL(info2->ToString(), "250.1.2.1:9999");
298-
299-
// Test: Find returns another IP matching what we searched on.
300-
AddrInfo* info3 = addrman.Find(addr3);
301-
BOOST_REQUIRE(info3);
302-
BOOST_CHECK_EQUAL(info3->ToString(), "251.255.2.1:8333");
303-
}
304-
305-
BOOST_AUTO_TEST_CASE(addrman_create)
306-
{
307-
AddrManTest addrman;
308-
309-
BOOST_CHECK_EQUAL(addrman.size(), 0U);
310-
311-
CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE);
312-
CNetAddr source1 = ResolveIP("250.1.2.1");
313-
314-
int nId;
315-
AddrInfo* pinfo = addrman.Create(addr1, source1, &nId);
316-
317-
// Test: The result should be the same as the input addr.
318-
BOOST_CHECK_EQUAL(pinfo->ToString(), "250.1.2.1:8333");
319-
320-
AddrInfo* info2 = addrman.Find(addr1);
321-
BOOST_CHECK_EQUAL(info2->ToString(), "250.1.2.1:8333");
322-
}
323-
324-
325-
BOOST_AUTO_TEST_CASE(addrman_delete)
326-
{
327-
AddrManTest addrman;
328-
329-
BOOST_CHECK_EQUAL(addrman.size(), 0U);
330-
331-
CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE);
332-
CNetAddr source1 = ResolveIP("250.1.2.1");
333-
334-
int nId;
335-
addrman.Create(addr1, source1, &nId);
336-
337-
// Test: Delete should actually delete the addr.
338-
BOOST_CHECK_EQUAL(addrman.size(), 1U);
339-
addrman.Delete(nId);
340-
BOOST_CHECK_EQUAL(addrman.size(), 0U);
341-
AddrInfo* info2 = addrman.Find(addr1);
342-
BOOST_CHECK(info2 == nullptr);
343-
}
344272

345273
BOOST_AUTO_TEST_CASE(addrman_getaddr)
346274
{

0 commit comments

Comments
 (0)