Merge bitcoin/bitcoin#26229: test: Use proper Boost macros instead of assertions

5c9a27a46f4b07f872f850f7e918c10a33595cfd test: Use proper Boost macros instead of assertions (Hennadii Stepanov)

Pull request description:

  On the master branch:
  ```
  $ src/test/test_bitcoin -l test_suite -t banman_tests
  Running 1 test case...
  ...
  Test case banman_tests/file did not check any assertions
  ...
  ```

  This PR suggests to use proper Boost [macros](https://www.boost.org/doc/libs/1_80_0/libs/test/doc/html/boost_test/utf_reference/testing_tool_ref.html).

Top commit has no ACKs.

Tree-SHA512: e0c8e5e6371acd0e0a80070fffdf1445f264c62499f8d9811822994c89735a913c18c8ed730495578400abdd93d2d500345504f2a9246401d53fb2f9f71be8c5
This commit is contained in:
MacroFake 2022-10-03 11:36:05 +02:00 committed by pasta
parent 3be81a2d4c
commit 459425776c
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38

View File

@ -27,7 +27,7 @@ BOOST_AUTO_TEST_CASE(file)
" { \"version\": 1, \"ban_created\": 0, \"banned_until\": 778, \"address\": \"1.0.0.0/8\" }"
"] }",
};
assert(WriteBinaryFile(banlist_path + ".json", entries_write));
BOOST_REQUIRE(WriteBinaryFile(banlist_path + ".json", entries_write));
{
// The invalid entries will be dropped, but the valid one remains
ASSERT_DEBUG_LOG("Dropping entry with unparseable address or subnet (aaaaaaaaa) from ban list");
@ -35,7 +35,7 @@ BOOST_AUTO_TEST_CASE(file)
BanMan banman{banlist_path, /*client_interface=*/nullptr, /*default_ban_time=*/0};
banmap_t entries_read;
banman.GetBanned(entries_read);
assert(entries_read.size() == 1);
BOOST_CHECK_EQUAL(entries_read.size(), 1);
}
}
}