Examples
https://travis-ci.org/github/bitcoin/bitcoin/jobs/707134622#L3609 https://travis-ci.org/github/bitcoin/bitcoin/jobs/707136763#L3642 https://travis-ci.org/github/bitcoin/bitcoin/jobs/707136764#L2276
811 | @@ -812,7 +812,7 @@ BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup) 812 | 813 | LOCK(wallet->cs_wallet); 814 | BOOST_CHECK(wallet->HasWalletSpend(prev_hash)); 815 | - BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 1); 816 | + BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), (size_t)1);
BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 1U);
nit: I think the other tests use the postfix thing
nit: I think the other tests use the postfix thing
Thanks, switched
review ACK based on return type of https://en.cppreference.com/w/cpp/container/map/count
Examples
https://travis-ci.org/github/bitcoin/bitcoin/jobs/707134622#L3609
https://travis-ci.org/github/bitcoin/bitcoin/jobs/707136763#L3642
https://travis-ci.org/github/bitcoin/bitcoin/jobs/707136764#L2276
review reACK d11d3481113d9160882ec9147e7623f3f77adeb2
Anyone knows how to test this?
There is another instance (also introduced in #18850) that should be fixed as part of this PR:
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index ade2fbb32..d302303e3 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -818,7 +818,7 @@ BOOST_FIXTURE_TEST_CASE(ZapSelectTx, TestChain100Setup)
BOOST_CHECK_EQUAL(wallet->ZapSelectTx(vHashIn, vHashOut), DBErrors::LOAD_OK);
BOOST_CHECK(!wallet->HasWalletSpend(prev_hash));
- BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0);
+ BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0U);
}
TestUnloadWallet(std::move(wallet));
CXX wallet/test/test_test_bitcoin-wallet_tests.o
In file included from wallet/test/wallet_tests.cpp:24:
In file included from /usr/local/include/boost/test/unit_test.hpp:18:
In file included from /usr/local/include/boost/test/test_tools.hpp:46:
/usr/local/include/boost/test/tools/old/impl.hpp:107:17: warning: comparison of integers of different signs: 'const unsigned long' and 'const int' [-Wsign-compare]
return left == right;
~~~~ ^ ~~~~~
/usr/local/include/boost/test/tools/old/impl.hpp:130:16: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::equal_impl<unsigned long, int>' requested here
return equal_impl( left, right );
^
/usr/local/include/boost/test/tools/old/impl.hpp:145:16: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::equal_impl_frwd::call_impl<unsigned long, int>' requested here
return call_impl( left, right, left_is_array() );
^
/usr/local/include/boost/test/tools/old/impl.hpp:92:50: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::equal_impl_frwd::operator()<unsigned long, int>' requested here
BOOST_PP_REPEAT( BOOST_TEST_MAX_PREDICATE_ARITY, IMPL_FRWD, _ )
^
/usr/local/include/boost/preprocessor/repetition/repeat.hpp:29:26: note: expanded from macro 'BOOST_PP_REPEAT'
# define BOOST_PP_REPEAT BOOST_PP_CAT(BOOST_PP_REPEAT_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4))
^
/usr/local/include/boost/preprocessor/cat.hpp:22:32: note: expanded from macro 'BOOST_PP_CAT'
# define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b)
^
/usr/local/include/boost/preprocessor/cat.hpp:29:34: note: expanded from macro 'BOOST_PP_CAT_I'
# define BOOST_PP_CAT_I(a, b) a ## b
^
<scratch space>:163:1: note: expanded from here
BOOST_PP_REPEAT_1
^
wallet/test/wallet_tests.cpp:821:9: note: in instantiation of function template specialization 'boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, unsigned long, int>' requested here
BOOST_CHECK_EQUAL(wallet->mapWallet.count(block_hash), 0);
^
/usr/local/include/boost/test/tools/old/interface.hpp:154:45: note: expanded from macro 'BOOST_CHECK_EQUAL'
#define BOOST_CHECK_EQUAL( L, R ) BOOST_TEST_TOOL_IMPL( 0, \
^
/usr/local/include/boost/test/tools/old/interface.hpp:67:47: note: expanded from macro 'BOOST_TEST_TOOL_IMPL'
BOOST_PP_IF( frwd_type, report_assertion, check_frwd ) ( \
^
1 warning generated.
Done in #19493