Skip to content

Commit

Permalink
Merge bitcoin#26229: test: Use proper Boost macros instead of assertions
Browse files Browse the repository at this point in the history
5c9a27a 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
  • Loading branch information
MacroFake authored and PastaPastaPasta committed Oct 25, 2024
1 parent 3be81a2 commit 4594257
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/banman_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ 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");
ASSERT_DEBUG_LOG("Dropping entry with unknown version (2) from ban list");
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);
}
}
}
Expand Down

0 comments on commit 4594257

Please sign in to comment.