Cleanup request from #10287. Change "Test #:" comments to "Test:" Change BOOST_CHECK(... = ...) to BOOST_CHECK_EQUAL(..., ...)
Requested per @EthanHeilman
Cleanup request from #10287. Change "Test #:" comments to "Test:" Change BOOST_CHECK(... = ...) to BOOST_CHECK_EQUAL(..., ...)
Requested per @EthanHeilman
395 | addrman.Add(addr4, source2); 396 | addrman.Add(addr5, source1); 397 | 398 | // GetAddr returns 23% of addresses, 23% of 5 is 1 rounded down. 399 | - BOOST_CHECK(addrman.GetAddr().size() == 1); 400 | + BOOST_CHECK_EQUAL(addrman.GetAddr().size(), 1);
Please no trailing whitespace. This will cause issues in version control when used with editors that remove trailing whitespace by default.
sorry, not sure how that got there. fixing now.
It has been there before, though no need to drag along. :)
295 | @@ -296,23 +296,23 @@ BOOST_AUTO_TEST_CASE(addrman_find) 296 | addrman.Add(addr2, source2); 297 | addrman.Add(addr3, source1); 298 | 299 | - // Test 17: ensure Find returns an IP matching what we searched on. 300 | + // Test: ensure Find returns an IP matching what we searched on. 301 | CAddrInfo* info1 = addrman.Find(addr1); 302 | BOOST_CHECK(info1); 303 | if (info1)
I was going to suggest you update this if statement to follow our style guidelines (continuation on the same line if the block is one line, or braces), but really I don't think an if statement has any business being here at all. This is a test case - we should be asserting all our expectations (and indeed we do in the line above).
Suggest you remove the if line and run BOOST_CHECK(info1->ToString() == "250.1.2.1:8333") directly. Same for other 2 ifs below.
Thanks for the review! Changed.
This was added as a guard against null pointer dereference
Doesn't BOOST_CHECK(info1) check that info1 is non-null?
And if not, surely it's better to fail the test than silently continue?
According to http://www.boost.org/doc/libs/1_64_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref/assertion_boost_level.html you could use BOOST_REQUIRE()
attempt 3. Please let me know if this is satisfies everything @jnewbery @MarcoFalke
Looks good to me. Tested ACK b81103aad0189075e89de5626679ed57f563846d with one nit.
Cleanup request from #10287.
Change "Test #:" comments to "Test:"
Change BOOST_CHECK(... = ...) to BOOST_CHECK_EQUAL(..., ...)
Remove three unnecessary if statements
looks great. Tested ACK a80f295666ba15d795be00773f768d7167599a63
utACK a80f295666ba15d795be00773f768d7167599a63