Merge #12920: test: Fix sign for expected values

c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
This commit is contained in:
Wladimir J. van der Laan 2018-04-11 14:58:51 +02:00
commit b1fdfc1a8c
No known key found for this signature in database
GPG key ID: 1E4AED62986CD25D
20 changed files with 144 additions and 144 deletions

View file

@ -98,14 +98,14 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
CNetAddr source = ResolveIP("252.2.2.2"); CNetAddr source = ResolveIP("252.2.2.2");
// Test: Does Addrman respond correctly when empty. // Test: Does Addrman respond correctly when empty.
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
CAddrInfo addr_null = addrman.Select(); CAddrInfo addr_null = addrman.Select();
BOOST_CHECK_EQUAL(addr_null.ToString(), "[::]:0"); BOOST_CHECK_EQUAL(addr_null.ToString(), "[::]:0");
// Test: Does Addrman::Add work as expected. // Test: Does Addrman::Add work as expected.
CService addr1 = ResolveService("250.1.1.1", 8333); CService addr1 = ResolveService("250.1.1.1", 8333);
BOOST_CHECK(addrman.Add(CAddress(addr1, NODE_NONE), source)); BOOST_CHECK(addrman.Add(CAddress(addr1, NODE_NONE), source));
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
CAddrInfo addr_ret1 = addrman.Select(); CAddrInfo addr_ret1 = addrman.Select();
BOOST_CHECK_EQUAL(addr_ret1.ToString(), "250.1.1.1:8333"); BOOST_CHECK_EQUAL(addr_ret1.ToString(), "250.1.1.1:8333");
@ -113,7 +113,7 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
// Expected dup IP should not be added. // Expected dup IP should not be added.
CService addr1_dup = ResolveService("250.1.1.1", 8333); CService addr1_dup = ResolveService("250.1.1.1", 8333);
BOOST_CHECK(!addrman.Add(CAddress(addr1_dup, NODE_NONE), source)); BOOST_CHECK(!addrman.Add(CAddress(addr1_dup, NODE_NONE), source));
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
// Test: New table has one addr and we add a diff addr we should // Test: New table has one addr and we add a diff addr we should
@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
// Test: AddrMan::Clear() should empty the new table. // Test: AddrMan::Clear() should empty the new table.
addrman.Clear(); addrman.Clear();
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
CAddrInfo addr_null2 = addrman.Select(); CAddrInfo addr_null2 = addrman.Select();
BOOST_CHECK_EQUAL(addr_null2.ToString(), "[::]:0"); BOOST_CHECK_EQUAL(addr_null2.ToString(), "[::]:0");
@ -146,23 +146,23 @@ BOOST_AUTO_TEST_CASE(addrman_ports)
CNetAddr source = ResolveIP("252.2.2.2"); CNetAddr source = ResolveIP("252.2.2.2");
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
// Test 7; Addr with same IP but diff port does not replace existing addr. // Test 7; Addr with same IP but diff port does not replace existing addr.
CService addr1 = ResolveService("250.1.1.1", 8333); CService addr1 = ResolveService("250.1.1.1", 8333);
addrman.Add(CAddress(addr1, NODE_NONE), source); addrman.Add(CAddress(addr1, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
CService addr1_port = ResolveService("250.1.1.1", 8334); CService addr1_port = ResolveService("250.1.1.1", 8334);
addrman.Add(CAddress(addr1_port, NODE_NONE), source); addrman.Add(CAddress(addr1_port, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
CAddrInfo addr_ret2 = addrman.Select(); CAddrInfo addr_ret2 = addrman.Select();
BOOST_CHECK_EQUAL(addr_ret2.ToString(), "250.1.1.1:8333"); BOOST_CHECK_EQUAL(addr_ret2.ToString(), "250.1.1.1:8333");
// Test: Add same IP but diff port to tried table, it doesn't get added. // Test: Add same IP but diff port to tried table, it doesn't get added.
// Perhaps this is not ideal behavior but it is the current behavior. // Perhaps this is not ideal behavior but it is the current behavior.
addrman.Good(CAddress(addr1_port, NODE_NONE)); addrman.Good(CAddress(addr1_port, NODE_NONE));
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
bool newOnly = true; bool newOnly = true;
CAddrInfo addr_ret3 = addrman.Select(newOnly); CAddrInfo addr_ret3 = addrman.Select(newOnly);
BOOST_CHECK_EQUAL(addr_ret3.ToString(), "250.1.1.1:8333"); BOOST_CHECK_EQUAL(addr_ret3.ToString(), "250.1.1.1:8333");
@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(addrman_select)
// Test: Select from new with 1 addr in new. // Test: Select from new with 1 addr in new.
CService addr1 = ResolveService("250.1.1.1", 8333); CService addr1 = ResolveService("250.1.1.1", 8333);
addrman.Add(CAddress(addr1, NODE_NONE), source); addrman.Add(CAddress(addr1, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
bool newOnly = true; bool newOnly = true;
CAddrInfo addr_ret1 = addrman.Select(newOnly); CAddrInfo addr_ret1 = addrman.Select(newOnly);
@ -186,14 +186,14 @@ BOOST_AUTO_TEST_CASE(addrman_select)
// Test: move addr to tried, select from new expected nothing returned. // Test: move addr to tried, select from new expected nothing returned.
addrman.Good(CAddress(addr1, NODE_NONE)); addrman.Good(CAddress(addr1, NODE_NONE));
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
CAddrInfo addr_ret2 = addrman.Select(newOnly); CAddrInfo addr_ret2 = addrman.Select(newOnly);
BOOST_CHECK_EQUAL(addr_ret2.ToString(), "[::]:0"); BOOST_CHECK_EQUAL(addr_ret2.ToString(), "[::]:0");
CAddrInfo addr_ret3 = addrman.Select(); CAddrInfo addr_ret3 = addrman.Select();
BOOST_CHECK_EQUAL(addr_ret3.ToString(), "250.1.1.1:8333"); BOOST_CHECK_EQUAL(addr_ret3.ToString(), "250.1.1.1:8333");
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
// Add three addresses to new table. // Add three addresses to new table.
@ -218,14 +218,14 @@ BOOST_AUTO_TEST_CASE(addrman_select)
addrman.Good(CAddress(addr7, NODE_NONE)); addrman.Good(CAddress(addr7, NODE_NONE));
// Test: 6 addrs + 1 addr from last test = 7. // Test: 6 addrs + 1 addr from last test = 7.
BOOST_CHECK_EQUAL(addrman.size(), 7); BOOST_CHECK_EQUAL(addrman.size(), 7U);
// Test: Select pulls from new and tried regardless of port number. // Test: Select pulls from new and tried regardless of port number.
std::set<uint16_t> ports; std::set<uint16_t> ports;
for (int i = 0; i < 20; ++i) { for (int i = 0; i < 20; ++i) {
ports.insert(addrman.Select().GetPort()); ports.insert(addrman.Select().GetPort());
} }
BOOST_CHECK_EQUAL(ports.size(), 3); BOOST_CHECK_EQUAL(ports.size(), 3U);
} }
BOOST_AUTO_TEST_CASE(addrman_new_collisions) BOOST_AUTO_TEST_CASE(addrman_new_collisions)
@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(addrman_new_collisions)
CNetAddr source = ResolveIP("252.2.2.2"); CNetAddr source = ResolveIP("252.2.2.2");
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
for (unsigned int i = 1; i < 18; i++) { for (unsigned int i = 1; i < 18; i++) {
CService addr = ResolveService("250.1.1." + std::to_string(i)); CService addr = ResolveService("250.1.1." + std::to_string(i));
@ -247,11 +247,11 @@ BOOST_AUTO_TEST_CASE(addrman_new_collisions)
//Test: new table collision! //Test: new table collision!
CService addr1 = ResolveService("250.1.1.18"); CService addr1 = ResolveService("250.1.1.18");
addrman.Add(CAddress(addr1, NODE_NONE), source); addrman.Add(CAddress(addr1, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 17); BOOST_CHECK_EQUAL(addrman.size(), 17U);
CService addr2 = ResolveService("250.1.1.19"); CService addr2 = ResolveService("250.1.1.19");
addrman.Add(CAddress(addr2, NODE_NONE), source); addrman.Add(CAddress(addr2, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 18); BOOST_CHECK_EQUAL(addrman.size(), 18U);
} }
BOOST_AUTO_TEST_CASE(addrman_tried_collisions) BOOST_AUTO_TEST_CASE(addrman_tried_collisions)
@ -260,7 +260,7 @@ BOOST_AUTO_TEST_CASE(addrman_tried_collisions)
CNetAddr source = ResolveIP("252.2.2.2"); CNetAddr source = ResolveIP("252.2.2.2");
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
for (unsigned int i = 1; i < 80; i++) { for (unsigned int i = 1; i < 80; i++) {
CService addr = ResolveService("250.1.1." + std::to_string(i)); CService addr = ResolveService("250.1.1." + std::to_string(i));
@ -274,18 +274,18 @@ BOOST_AUTO_TEST_CASE(addrman_tried_collisions)
//Test: tried table collision! //Test: tried table collision!
CService addr1 = ResolveService("250.1.1.80"); CService addr1 = ResolveService("250.1.1.80");
addrman.Add(CAddress(addr1, NODE_NONE), source); addrman.Add(CAddress(addr1, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 79); BOOST_CHECK_EQUAL(addrman.size(), 79U);
CService addr2 = ResolveService("250.1.1.81"); CService addr2 = ResolveService("250.1.1.81");
addrman.Add(CAddress(addr2, NODE_NONE), source); addrman.Add(CAddress(addr2, NODE_NONE), source);
BOOST_CHECK_EQUAL(addrman.size(), 80); BOOST_CHECK_EQUAL(addrman.size(), 80U);
} }
BOOST_AUTO_TEST_CASE(addrman_find) BOOST_AUTO_TEST_CASE(addrman_find)
{ {
CAddrManTest addrman; CAddrManTest addrman;
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE); CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE);
CAddress addr2 = CAddress(ResolveService("250.1.2.1", 9999), NODE_NONE); CAddress addr2 = CAddress(ResolveService("250.1.2.1", 9999), NODE_NONE);
@ -318,7 +318,7 @@ BOOST_AUTO_TEST_CASE(addrman_create)
{ {
CAddrManTest addrman; CAddrManTest addrman;
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE); CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE);
CNetAddr source1 = ResolveIP("250.1.2.1"); CNetAddr source1 = ResolveIP("250.1.2.1");
@ -338,7 +338,7 @@ BOOST_AUTO_TEST_CASE(addrman_delete)
{ {
CAddrManTest addrman; CAddrManTest addrman;
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE); CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE);
CNetAddr source1 = ResolveIP("250.1.2.1"); CNetAddr source1 = ResolveIP("250.1.2.1");
@ -347,9 +347,9 @@ BOOST_AUTO_TEST_CASE(addrman_delete)
addrman.Create(addr1, source1, &nId); addrman.Create(addr1, source1, &nId);
// Test: Delete should actually delete the addr. // Test: Delete should actually delete the addr.
BOOST_CHECK_EQUAL(addrman.size(), 1); BOOST_CHECK_EQUAL(addrman.size(), 1U);
addrman.Delete(nId); addrman.Delete(nId);
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
CAddrInfo* info2 = addrman.Find(addr1); CAddrInfo* info2 = addrman.Find(addr1);
BOOST_CHECK(info2 == nullptr); BOOST_CHECK(info2 == nullptr);
} }
@ -360,9 +360,9 @@ BOOST_AUTO_TEST_CASE(addrman_getaddr)
// Test: Sanity check, GetAddr should never return anything if addrman // Test: Sanity check, GetAddr should never return anything if addrman
// is empty. // is empty.
BOOST_CHECK_EQUAL(addrman.size(), 0); BOOST_CHECK_EQUAL(addrman.size(), 0U);
std::vector<CAddress> vAddr1 = addrman.GetAddr(); std::vector<CAddress> vAddr1 = addrman.GetAddr();
BOOST_CHECK_EQUAL(vAddr1.size(), 0); BOOST_CHECK_EQUAL(vAddr1.size(), 0U);
CAddress addr1 = CAddress(ResolveService("250.250.2.1", 8333), NODE_NONE); CAddress addr1 = CAddress(ResolveService("250.250.2.1", 8333), NODE_NONE);
addr1.nTime = GetAdjustedTime(); // Set time so isTerrible = false addr1.nTime = GetAdjustedTime(); // Set time so isTerrible = false
@ -385,12 +385,12 @@ BOOST_AUTO_TEST_CASE(addrman_getaddr)
addrman.Add(addr5, source1); addrman.Add(addr5, source1);
// GetAddr returns 23% of addresses, 23% of 5 is 1 rounded down. // GetAddr returns 23% of addresses, 23% of 5 is 1 rounded down.
BOOST_CHECK_EQUAL(addrman.GetAddr().size(), 1); BOOST_CHECK_EQUAL(addrman.GetAddr().size(), 1U);
// Test: Ensure GetAddr works with new and tried addresses. // Test: Ensure GetAddr works with new and tried addresses.
addrman.Good(CAddress(addr1, NODE_NONE)); addrman.Good(CAddress(addr1, NODE_NONE));
addrman.Good(CAddress(addr2, NODE_NONE)); addrman.Good(CAddress(addr2, NODE_NONE));
BOOST_CHECK_EQUAL(addrman.GetAddr().size(), 1); BOOST_CHECK_EQUAL(addrman.GetAddr().size(), 1U);
// Test: Ensure GetAddr still returns 23% when addrman has many addrs. // Test: Ensure GetAddr still returns 23% when addrman has many addrs.
for (unsigned int i = 1; i < (8 * 256); i++) { for (unsigned int i = 1; i < (8 * 256); i++) {
@ -409,9 +409,9 @@ BOOST_AUTO_TEST_CASE(addrman_getaddr)
size_t percent23 = (addrman.size() * 23) / 100; size_t percent23 = (addrman.size() * 23) / 100;
BOOST_CHECK_EQUAL(vAddr.size(), percent23); BOOST_CHECK_EQUAL(vAddr.size(), percent23);
BOOST_CHECK_EQUAL(vAddr.size(), 461); BOOST_CHECK_EQUAL(vAddr.size(), 461U);
// (Addrman.size() < number of addresses added) due to address collisions. // (Addrman.size() < number of addresses added) due to address collisions.
BOOST_CHECK_EQUAL(addrman.size(), 2006); BOOST_CHECK_EQUAL(addrman.size(), 2006U);
} }
@ -454,7 +454,7 @@ BOOST_AUTO_TEST_CASE(caddrinfo_get_tried_bucket)
} }
// Test: IP addresses in the same group (\16 prefix for IPv4) should // Test: IP addresses in the same group (\16 prefix for IPv4) should
// never get more than 8 buckets // never get more than 8 buckets
BOOST_CHECK_EQUAL(buckets.size(), 8); BOOST_CHECK_EQUAL(buckets.size(), 8U);
buckets.clear(); buckets.clear();
for (int j = 0; j < 255; j++) { for (int j = 0; j < 255; j++) {
@ -466,7 +466,7 @@ BOOST_AUTO_TEST_CASE(caddrinfo_get_tried_bucket)
} }
// Test: IP addresses in the different groups should map to more than // Test: IP addresses in the different groups should map to more than
// 8 buckets. // 8 buckets.
BOOST_CHECK_EQUAL(buckets.size(), 160); BOOST_CHECK_EQUAL(buckets.size(), 160U);
} }
BOOST_AUTO_TEST_CASE(caddrinfo_get_new_bucket) BOOST_AUTO_TEST_CASE(caddrinfo_get_new_bucket)
@ -506,7 +506,7 @@ BOOST_AUTO_TEST_CASE(caddrinfo_get_new_bucket)
} }
// Test: IP addresses in the same group (\16 prefix for IPv4) should // Test: IP addresses in the same group (\16 prefix for IPv4) should
// always map to the same bucket. // always map to the same bucket.
BOOST_CHECK_EQUAL(buckets.size(), 1); BOOST_CHECK_EQUAL(buckets.size(), 1U);
buckets.clear(); buckets.clear();
for (int j = 0; j < 4 * 255; j++) { for (int j = 0; j < 4 * 255; j++) {

View file

@ -64,10 +64,10 @@ BOOST_AUTO_TEST_CASE(arena_tests)
BOOST_CHECK(b.stats().used == 128); BOOST_CHECK(b.stats().used == 128);
b.free(a3); b.free(a3);
BOOST_CHECK(b.stats().used == 0); BOOST_CHECK(b.stats().used == 0);
BOOST_CHECK_EQUAL(b.stats().chunks_used, 0); BOOST_CHECK_EQUAL(b.stats().chunks_used, 0U);
BOOST_CHECK(b.stats().total == synth_size); BOOST_CHECK(b.stats().total == synth_size);
BOOST_CHECK(b.stats().free == synth_size); BOOST_CHECK(b.stats().free == synth_size);
BOOST_CHECK_EQUAL(b.stats().chunks_free, 1); BOOST_CHECK_EQUAL(b.stats().chunks_free, 1U);
std::vector<void*> addr; std::vector<void*> addr;
BOOST_CHECK(b.alloc(0) == nullptr); // allocating 0 always returns nullptr BOOST_CHECK(b.alloc(0) == nullptr); // allocating 0 always returns nullptr

View file

@ -185,7 +185,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_1)
CMerkleBlock merkleBlock(block, filter); CMerkleBlock merkleBlock(block, filter);
BOOST_CHECK_EQUAL(merkleBlock.header.GetHash().GetHex(), block.GetHash().GetHex()); BOOST_CHECK_EQUAL(merkleBlock.header.GetHash().GetHex(), block.GetHash().GetHex());
BOOST_CHECK_EQUAL(merkleBlock.vMatchedTxn.size(), 1); BOOST_CHECK_EQUAL(merkleBlock.vMatchedTxn.size(), 1U);
std::pair<unsigned int, uint256> pair = merkleBlock.vMatchedTxn[0]; std::pair<unsigned int, uint256> pair = merkleBlock.vMatchedTxn[0];
BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0x74d681e0e03bafa802c8aa084379aa98d9fcd632ddc2ed9782b586ec87451f20")); BOOST_CHECK(merkleBlock.vMatchedTxn[0].second == uint256S("0x74d681e0e03bafa802c8aa084379aa98d9fcd632ddc2ed9782b586ec87451f20"));

View file

@ -331,7 +331,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Memory)
control.Add(vChecks); control.Add(vChecks);
} }
} }
BOOST_REQUIRE_EQUAL(MemoryCheck::fake_allocated_memory, 0); BOOST_REQUIRE_EQUAL(MemoryCheck::fake_allocated_memory, 0U);
} }
tg.interrupt_all(); tg.interrupt_all();
tg.join_all(); tg.join_all();

View file

@ -480,8 +480,8 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
Coin cc1; Coin cc1;
ss1 >> cc1; ss1 >> cc1;
BOOST_CHECK_EQUAL(cc1.fCoinBase, false); BOOST_CHECK_EQUAL(cc1.fCoinBase, false);
BOOST_CHECK_EQUAL(cc1.nHeight, 203998); BOOST_CHECK_EQUAL(cc1.nHeight, 203998U);
BOOST_CHECK_EQUAL(cc1.out.nValue, 60000000000ULL); BOOST_CHECK_EQUAL(cc1.out.nValue, CAmount{60000000000});
BOOST_CHECK_EQUAL(HexStr(cc1.out.scriptPubKey), HexStr(GetScriptForDestination(CKeyID(uint160(ParseHex("816115944e077fe7c803cfa57f29b36bf87c1d35")))))); BOOST_CHECK_EQUAL(HexStr(cc1.out.scriptPubKey), HexStr(GetScriptForDestination(CKeyID(uint160(ParseHex("816115944e077fe7c803cfa57f29b36bf87c1d35"))))));
// Good example // Good example
@ -489,7 +489,7 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
Coin cc2; Coin cc2;
ss2 >> cc2; ss2 >> cc2;
BOOST_CHECK_EQUAL(cc2.fCoinBase, true); BOOST_CHECK_EQUAL(cc2.fCoinBase, true);
BOOST_CHECK_EQUAL(cc2.nHeight, 120891); BOOST_CHECK_EQUAL(cc2.nHeight, 120891U);
BOOST_CHECK_EQUAL(cc2.out.nValue, 110397); BOOST_CHECK_EQUAL(cc2.out.nValue, 110397);
BOOST_CHECK_EQUAL(HexStr(cc2.out.scriptPubKey), HexStr(GetScriptForDestination(CKeyID(uint160(ParseHex("8c988f1a4a4de2161e0f50aac7f17e7f9555caa4")))))); BOOST_CHECK_EQUAL(HexStr(cc2.out.scriptPubKey), HexStr(GetScriptForDestination(CKeyID(uint160(ParseHex("8c988f1a4a4de2161e0f50aac7f17e7f9555caa4"))))));
@ -498,9 +498,9 @@ BOOST_AUTO_TEST_CASE(ccoins_serialization)
Coin cc3; Coin cc3;
ss3 >> cc3; ss3 >> cc3;
BOOST_CHECK_EQUAL(cc3.fCoinBase, false); BOOST_CHECK_EQUAL(cc3.fCoinBase, false);
BOOST_CHECK_EQUAL(cc3.nHeight, 0); BOOST_CHECK_EQUAL(cc3.nHeight, 0U);
BOOST_CHECK_EQUAL(cc3.out.nValue, 0); BOOST_CHECK_EQUAL(cc3.out.nValue, 0);
BOOST_CHECK_EQUAL(cc3.out.scriptPubKey.size(), 0); BOOST_CHECK_EQUAL(cc3.out.scriptPubKey.size(), 0U);
// scriptPubKey that ends beyond the end of the stream // scriptPubKey that ends beyond the end of the stream
CDataStream ss4(ParseHex("000007"), SER_DISK, CLIENT_VERSION); CDataStream ss4(ParseHex("000007"), SER_DISK, CLIENT_VERSION);

View file

@ -527,10 +527,10 @@ BOOST_AUTO_TEST_CASE(chacha20_testvector)
BOOST_AUTO_TEST_CASE(countbits_tests) BOOST_AUTO_TEST_CASE(countbits_tests)
{ {
FastRandomContext ctx; FastRandomContext ctx;
for (int i = 0; i <= 64; ++i) { for (unsigned int i = 0; i <= 64; ++i) {
if (i == 0) { if (i == 0) {
// Check handling of zero. // Check handling of zero.
BOOST_CHECK_EQUAL(CountBits(0), 0); BOOST_CHECK_EQUAL(CountBits(0), 0U);
} else if (i < 10) { } else if (i < 10) {
for (uint64_t j = 1 << (i - 1); (j >> i) == 0; ++j) { for (uint64_t j = 1 << (i - 1); (j >> i) == 0; ++j) {
// Exhaustively test up to 10 bits // Exhaustively test up to 10 bits

View file

@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
// Check that creating an iterator creates a snapshot // Check that creating an iterator creates a snapshot
std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper&>(dbw).NewIterator()); std::unique_ptr<CDBIterator> it(const_cast<CDBWrapper&>(dbw).NewIterator());
for (int x=0x00; x<256; ++x) { for (unsigned int x=0x00; x<256; ++x) {
uint8_t key = x; uint8_t key = x;
uint32_t value = x*x; uint32_t value = x*x;
if (x & 1) BOOST_CHECK(dbw.Write(key, value)); if (x & 1) BOOST_CHECK(dbw.Write(key, value));
@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(iterator_ordering)
for (int seek_start : {0x00, 0x80}) { for (int seek_start : {0x00, 0x80}) {
it->Seek((uint8_t)seek_start); it->Seek((uint8_t)seek_start);
for (int x=seek_start; x<255; ++x) { for (unsigned int x=seek_start; x<255; ++x) {
uint8_t key; uint8_t key;
uint32_t value; uint32_t value;
BOOST_CHECK(it->Valid()); BOOST_CHECK(it->Valid());
@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering)
snprintf(buf, sizeof(buf), "%d", seek_start); snprintf(buf, sizeof(buf), "%d", seek_start);
StringContentsSerializer seek_key(buf); StringContentsSerializer seek_key(buf);
it->Seek(seek_key); it->Seek(seek_key);
for (int x=seek_start; x<10; ++x) { for (unsigned int x=seek_start; x<10; ++x) {
for (int y = 0; y < 10; y++) { for (int y = 0; y < 10; y++) {
snprintf(buf, sizeof(buf), "%d", x); snprintf(buf, sizeof(buf), "%d", x);
std::string exp_key(buf); std::string exp_key(buf);

View file

@ -25,22 +25,22 @@ BOOST_AUTO_TEST_CASE(murmurhash3)
// //
// The magic number 0xFBA4C795 comes from CBloomFilter::Hash() // The magic number 0xFBA4C795 comes from CBloomFilter::Hash()
T(0x00000000, 0x00000000, ""); T(0x00000000U, 0x00000000, "");
T(0x6a396f08, 0xFBA4C795, ""); T(0x6a396f08U, 0xFBA4C795, "");
T(0x81f16f39, 0xffffffff, ""); T(0x81f16f39U, 0xffffffff, "");
T(0x514e28b7, 0x00000000, "00"); T(0x514e28b7U, 0x00000000, "00");
T(0xea3f0b17, 0xFBA4C795, "00"); T(0xea3f0b17U, 0xFBA4C795, "00");
T(0xfd6cf10d, 0x00000000, "ff"); T(0xfd6cf10dU, 0x00000000, "ff");
T(0x16c6b7ab, 0x00000000, "0011"); T(0x16c6b7abU, 0x00000000, "0011");
T(0x8eb51c3d, 0x00000000, "001122"); T(0x8eb51c3dU, 0x00000000, "001122");
T(0xb4471bf8, 0x00000000, "00112233"); T(0xb4471bf8U, 0x00000000, "00112233");
T(0xe2301fa8, 0x00000000, "0011223344"); T(0xe2301fa8U, 0x00000000, "0011223344");
T(0xfc2e4a15, 0x00000000, "001122334455"); T(0xfc2e4a15U, 0x00000000, "001122334455");
T(0xb074502c, 0x00000000, "00112233445566"); T(0xb074502cU, 0x00000000, "00112233445566");
T(0x8034d2a0, 0x00000000, "0011223344556677"); T(0x8034d2a0U, 0x00000000, "0011223344556677");
T(0xb4698def, 0x00000000, "001122334455667788"); T(0xb4698defU, 0x00000000, "001122334455667788");
#undef T #undef T
} }

View file

@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
nSum += nSubsidy * 1000; nSum += nSubsidy * 1000;
BOOST_CHECK(MoneyRange(nSum)); BOOST_CHECK(MoneyRange(nSum));
} }
BOOST_CHECK_EQUAL(nSum, 2099999997690000ULL); BOOST_CHECK_EQUAL(nSum, CAmount{2099999997690000});
} }
bool ReturnFalse() { return false; } bool ReturnFalse() { return false; }

View file

@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
poolSize = testPool.size(); poolSize = testPool.size();
testPool.removeRecursive(txParent); testPool.removeRecursive(txParent);
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 5); BOOST_CHECK_EQUAL(testPool.size(), poolSize - 5);
BOOST_CHECK_EQUAL(testPool.size(), 0); BOOST_CHECK_EQUAL(testPool.size(), 0U);
// Add children and grandchildren, but NOT the parent (simulate the parent being in a block) // Add children and grandchildren, but NOT the parent (simulate the parent being in a block)
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
poolSize = testPool.size(); poolSize = testPool.size();
testPool.removeRecursive(txParent); testPool.removeRecursive(txParent);
BOOST_CHECK_EQUAL(testPool.size(), poolSize - 6); BOOST_CHECK_EQUAL(testPool.size(), poolSize - 6);
BOOST_CHECK_EQUAL(testPool.size(), 0); BOOST_CHECK_EQUAL(testPool.size(), 0U);
} }
template<typename name> template<typename name>
@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx5.vout[0].nValue = 11 * COIN; tx5.vout[0].nValue = 11 * COIN;
entry.nTime = 1; entry.nTime = 1;
pool.addUnchecked(tx5.GetHash(), entry.Fee(10000LL).FromTx(tx5)); pool.addUnchecked(tx5.GetHash(), entry.Fee(10000LL).FromTx(tx5));
BOOST_CHECK_EQUAL(pool.size(), 5); BOOST_CHECK_EQUAL(pool.size(), 5U);
std::vector<std::string> sortedOrder; std::vector<std::string> sortedOrder;
sortedOrder.resize(5); sortedOrder.resize(5);
@ -175,7 +175,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx6.vout[0].nValue = 20 * COIN; tx6.vout[0].nValue = 20 * COIN;
pool.addUnchecked(tx6.GetHash(), entry.Fee(0LL).FromTx(tx6)); pool.addUnchecked(tx6.GetHash(), entry.Fee(0LL).FromTx(tx6));
BOOST_CHECK_EQUAL(pool.size(), 6); BOOST_CHECK_EQUAL(pool.size(), 6U);
// Check that at this point, tx6 is sorted low // Check that at this point, tx6 is sorted low
sortedOrder.insert(sortedOrder.begin(), tx6.GetHash().ToString()); sortedOrder.insert(sortedOrder.begin(), tx6.GetHash().ToString());
CheckSort<descendant_score>(pool, sortedOrder); CheckSort<descendant_score>(pool, sortedOrder);
@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
BOOST_CHECK(setAncestorsCalculated == setAncestors); BOOST_CHECK(setAncestorsCalculated == setAncestors);
pool.addUnchecked(tx7.GetHash(), entry.FromTx(tx7), setAncestors); pool.addUnchecked(tx7.GetHash(), entry.FromTx(tx7), setAncestors);
BOOST_CHECK_EQUAL(pool.size(), 7); BOOST_CHECK_EQUAL(pool.size(), 7U);
// Now tx6 should be sorted higher (high fee child): tx7, tx6, tx2, ... // Now tx6 should be sorted higher (high fee child): tx7, tx6, tx2, ...
sortedOrder.erase(sortedOrder.begin()); sortedOrder.erase(sortedOrder.begin());
@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
pool.addUnchecked(tx9.GetHash(), entry.Fee(0LL).Time(3).FromTx(tx9), setAncestors); pool.addUnchecked(tx9.GetHash(), entry.Fee(0LL).Time(3).FromTx(tx9), setAncestors);
// tx9 should be sorted low // tx9 should be sorted low
BOOST_CHECK_EQUAL(pool.size(), 9); BOOST_CHECK_EQUAL(pool.size(), 9U);
sortedOrder.insert(sortedOrder.begin(), tx9.GetHash().ToString()); sortedOrder.insert(sortedOrder.begin(), tx9.GetHash().ToString());
CheckSort<descendant_score>(pool, sortedOrder); CheckSort<descendant_score>(pool, sortedOrder);
@ -279,7 +279,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
CheckSort<descendant_score>(pool, sortedOrder); CheckSort<descendant_score>(pool, sortedOrder);
// there should be 10 transactions in the mempool // there should be 10 transactions in the mempool
BOOST_CHECK_EQUAL(pool.size(), 10); BOOST_CHECK_EQUAL(pool.size(), 10U);
// Now try removing tx10 and verify the sort order returns to normal // Now try removing tx10 and verify the sort order returns to normal
pool.removeRecursive(pool.mapTx.find(tx10.GetHash())->GetTx()); pool.removeRecursive(pool.mapTx.find(tx10.GetHash())->GetTx());
@ -329,7 +329,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
tx5.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL; tx5.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx5.vout[0].nValue = 11 * COIN; tx5.vout[0].nValue = 11 * COIN;
pool.addUnchecked(tx5.GetHash(), entry.Fee(10000LL).FromTx(tx5)); pool.addUnchecked(tx5.GetHash(), entry.Fee(10000LL).FromTx(tx5));
BOOST_CHECK_EQUAL(pool.size(), 5); BOOST_CHECK_EQUAL(pool.size(), 5U);
std::vector<std::string> sortedOrder; std::vector<std::string> sortedOrder;
sortedOrder.resize(5); sortedOrder.resize(5);
@ -359,7 +359,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
uint64_t tx6Size = GetVirtualTransactionSize(tx6); uint64_t tx6Size = GetVirtualTransactionSize(tx6);
pool.addUnchecked(tx6.GetHash(), entry.Fee(0LL).FromTx(tx6)); pool.addUnchecked(tx6.GetHash(), entry.Fee(0LL).FromTx(tx6));
BOOST_CHECK_EQUAL(pool.size(), 6); BOOST_CHECK_EQUAL(pool.size(), 6U);
// Ties are broken by hash // Ties are broken by hash
if (tx3.GetHash() < tx6.GetHash()) if (tx3.GetHash() < tx6.GetHash())
sortedOrder.push_back(tx6.GetHash().ToString()); sortedOrder.push_back(tx6.GetHash().ToString());
@ -381,7 +381,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
CAmount fee = (20000/tx2Size)*(tx7Size + tx6Size) - 1; CAmount fee = (20000/tx2Size)*(tx7Size + tx6Size) - 1;
pool.addUnchecked(tx7.GetHash(), entry.Fee(fee).FromTx(tx7)); pool.addUnchecked(tx7.GetHash(), entry.Fee(fee).FromTx(tx7));
BOOST_CHECK_EQUAL(pool.size(), 7); BOOST_CHECK_EQUAL(pool.size(), 7U);
sortedOrder.insert(sortedOrder.begin()+1, tx7.GetHash().ToString()); sortedOrder.insert(sortedOrder.begin()+1, tx7.GetHash().ToString());
CheckSort<ancestor_score>(pool, sortedOrder); CheckSort<ancestor_score>(pool, sortedOrder);

View file

@ -35,20 +35,20 @@ BOOST_AUTO_TEST_CASE(merkleblock_construct_from_txids_found)
BOOST_CHECK_EQUAL(merkleBlock.header.GetHash().GetHex(), block.GetHash().GetHex()); BOOST_CHECK_EQUAL(merkleBlock.header.GetHash().GetHex(), block.GetHash().GetHex());
// vMatchedTxn is only used when bloom filter is specified. // vMatchedTxn is only used when bloom filter is specified.
BOOST_CHECK_EQUAL(merkleBlock.vMatchedTxn.size(), 0); BOOST_CHECK_EQUAL(merkleBlock.vMatchedTxn.size(), 0U);
std::vector<uint256> vMatched; std::vector<uint256> vMatched;
std::vector<unsigned int> vIndex; std::vector<unsigned int> vIndex;
BOOST_CHECK_EQUAL(merkleBlock.txn.ExtractMatches(vMatched, vIndex).GetHex(), block.hashMerkleRoot.GetHex()); BOOST_CHECK_EQUAL(merkleBlock.txn.ExtractMatches(vMatched, vIndex).GetHex(), block.hashMerkleRoot.GetHex());
BOOST_CHECK_EQUAL(vMatched.size(), 2); BOOST_CHECK_EQUAL(vMatched.size(), 2U);
// Ordered by occurrence in depth-first tree traversal. // Ordered by occurrence in depth-first tree traversal.
BOOST_CHECK_EQUAL(vMatched[0].ToString(), txhash2.ToString()); BOOST_CHECK_EQUAL(vMatched[0].ToString(), txhash2.ToString());
BOOST_CHECK_EQUAL(vIndex[0], 1); BOOST_CHECK_EQUAL(vIndex[0], 1U);
BOOST_CHECK_EQUAL(vMatched[1].ToString(), txhash1.ToString()); BOOST_CHECK_EQUAL(vMatched[1].ToString(), txhash1.ToString());
BOOST_CHECK_EQUAL(vIndex[1], 8); BOOST_CHECK_EQUAL(vIndex[1], 8U);
} }
@ -65,14 +65,14 @@ BOOST_AUTO_TEST_CASE(merkleblock_construct_from_txids_not_found)
CMerkleBlock merkleBlock(block, txids2); CMerkleBlock merkleBlock(block, txids2);
BOOST_CHECK_EQUAL(merkleBlock.header.GetHash().GetHex(), block.GetHash().GetHex()); BOOST_CHECK_EQUAL(merkleBlock.header.GetHash().GetHex(), block.GetHash().GetHex());
BOOST_CHECK_EQUAL(merkleBlock.vMatchedTxn.size(), 0); BOOST_CHECK_EQUAL(merkleBlock.vMatchedTxn.size(), 0U);
std::vector<uint256> vMatched; std::vector<uint256> vMatched;
std::vector<unsigned int> vIndex; std::vector<unsigned int> vIndex;
BOOST_CHECK_EQUAL(merkleBlock.txn.ExtractMatches(vMatched, vIndex).GetHex(), block.hashMerkleRoot.GetHex()); BOOST_CHECK_EQUAL(merkleBlock.txn.ExtractMatches(vMatched, vIndex).GetHex(), block.hashMerkleRoot.GetHex());
BOOST_CHECK_EQUAL(vMatched.size(), 0); BOOST_CHECK_EQUAL(vMatched.size(), 0U);
BOOST_CHECK_EQUAL(vIndex.size(), 0); BOOST_CHECK_EQUAL(vIndex.size(), 0U);
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()

View file

@ -501,7 +501,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
// it into the template because we still check IsFinalTx in CreateNewBlock, // it into the template because we still check IsFinalTx in CreateNewBlock,
// but relative locked txs will if inconsistently added to mempool. // but relative locked txs will if inconsistently added to mempool.
// For now these will still generate a valid template until BIP68 soft fork // For now these will still generate a valid template until BIP68 soft fork
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 3); BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 3U);
// However if we advance height by 1 and time by 512, all of them should be mined // However if we advance height by 1 and time by 512, all of them should be mined
for (int i = 0; i < CBlockIndex::nMedianTimeSpan; i++) for (int i = 0; i < CBlockIndex::nMedianTimeSpan; i++)
chainActive.Tip()->GetAncestor(chainActive.Tip()->nHeight - i)->nTime += 512; //Trick the MedianTimePast chainActive.Tip()->GetAncestor(chainActive.Tip()->nHeight - i)->nTime += 512; //Trick the MedianTimePast
@ -509,7 +509,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
SetMockTime(chainActive.Tip()->GetMedianTimePast() + 1); SetMockTime(chainActive.Tip()->GetMedianTimePast() + 1);
BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey)); BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams).CreateNewBlock(scriptPubKey));
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 5); BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 5U);
chainActive.Tip()->nHeight--; chainActive.Tip()->nHeight--;
SetMockTime(0); SetMockTime(0);

View file

@ -22,7 +22,7 @@ BOOST_AUTO_TEST_CASE(get_next_work)
pindexLast.nHeight = 32255; pindexLast.nHeight = 32255;
pindexLast.nTime = 1262152739; // Block #32255 pindexLast.nTime = 1262152739; // Block #32255
pindexLast.nBits = 0x1d00ffff; pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00d86a); BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00d86aU);
} }
/* Test the constraint on the upper bound for next work */ /* Test the constraint on the upper bound for next work */
@ -34,7 +34,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
pindexLast.nHeight = 2015; pindexLast.nHeight = 2015;
pindexLast.nTime = 1233061996; // Block #2015 pindexLast.nTime = 1233061996; // Block #2015
pindexLast.nBits = 0x1d00ffff; pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00ffff); BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00ffffU);
} }
/* Test the constraint on the lower bound for actual time taken */ /* Test the constraint on the lower bound for actual time taken */
@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
pindexLast.nHeight = 68543; pindexLast.nHeight = 68543;
pindexLast.nTime = 1279297671; // Block #68543 pindexLast.nTime = 1279297671; // Block #68543
pindexLast.nBits = 0x1c05a3f4; pindexLast.nBits = 0x1c05a3f4;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c0168fd); BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c0168fdU);
} }
/* Test the constraint on the upper bound for actual time taken */ /* Test the constraint on the upper bound for actual time taken */
@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
pindexLast.nHeight = 46367; pindexLast.nHeight = 46367;
pindexLast.nTime = 1269211443; // Block #46367 pindexLast.nTime = 1269211443; // Block #46367
pindexLast.nBits = 0x1c387f6f; pindexLast.nBits = 0x1c387f6f;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00e1fd); BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00e1fdU);
} }
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test) BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)

View file

@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(fastrandom_randbits)
for (int bits = 0; bits < 63; ++bits) { for (int bits = 0; bits < 63; ++bits) {
for (int j = 0; j < 1000; ++j) { for (int j = 0; j < 1000; ++j) {
uint64_t rangebits = ctx1.randbits(bits); uint64_t rangebits = ctx1.randbits(bits);
BOOST_CHECK_EQUAL(rangebits >> bits, 0); BOOST_CHECK_EQUAL(rangebits >> bits, 0U);
uint64_t range = ((uint64_t)1) << bits | rangebits; uint64_t range = ((uint64_t)1) << bits | rangebits;
uint64_t rand = ctx2.randrange(range); uint64_t rand = ctx2.randrange(range);
BOOST_CHECK(rand < range); BOOST_CHECK(rand < range);

View file

@ -245,7 +245,7 @@ BOOST_AUTO_TEST_CASE(rpc_ban)
BOOST_CHECK_NO_THROW(CallRPC(std::string("setban 127.0.0.0 remove"))); BOOST_CHECK_NO_THROW(CallRPC(std::string("setban 127.0.0.0 remove")));
BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned")));
ar = r.get_array(); ar = r.get_array();
BOOST_CHECK_EQUAL(ar.size(), 0); BOOST_CHECK_EQUAL(ar.size(), 0U);
BOOST_CHECK_NO_THROW(r = CallRPC(std::string("setban 127.0.0.0/24 add 1607731200 true"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("setban 127.0.0.0/24 add 1607731200 true")));
BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned")));
@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE(rpc_ban)
BOOST_CHECK_NO_THROW(CallRPC(std::string("setban 127.0.0.0/24 remove"))); BOOST_CHECK_NO_THROW(CallRPC(std::string("setban 127.0.0.0/24 remove")));
BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned")));
ar = r.get_array(); ar = r.get_array();
BOOST_CHECK_EQUAL(ar.size(), 0); BOOST_CHECK_EQUAL(ar.size(), 0U);
BOOST_CHECK_NO_THROW(r = CallRPC(std::string("setban 127.0.0.0/255.255.0.0 add"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("setban 127.0.0.0/255.255.0.0 add")));
BOOST_CHECK_THROW(r = CallRPC(std::string("setban 127.0.1.1 add")), std::runtime_error); BOOST_CHECK_THROW(r = CallRPC(std::string("setban 127.0.1.1 add")), std::runtime_error);
@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(rpc_ban)
BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned"))); BOOST_CHECK_NO_THROW(CallRPC(std::string("clearbanned")));
BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned"))); BOOST_CHECK_NO_THROW(r = CallRPC(std::string("listbanned")));
ar = r.get_array(); ar = r.get_array();
BOOST_CHECK_EQUAL(ar.size(), 0); BOOST_CHECK_EQUAL(ar.size(), 0U);
BOOST_CHECK_THROW(r = CallRPC(std::string("setban test add")), std::runtime_error); //invalid IP BOOST_CHECK_THROW(r = CallRPC(std::string("setban test add")), std::runtime_error); //invalid IP

View file

@ -33,7 +33,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
s << ToByteVector(pubkeys[0]) << OP_CHECKSIG; s << ToByteVector(pubkeys[0]) << OP_CHECKSIG;
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_PUBKEY); BOOST_CHECK_EQUAL(whichType, TX_PUBKEY);
BOOST_CHECK_EQUAL(solutions.size(), 1); BOOST_CHECK_EQUAL(solutions.size(), 1U);
BOOST_CHECK(solutions[0] == ToByteVector(pubkeys[0])); BOOST_CHECK(solutions[0] == ToByteVector(pubkeys[0]));
// TX_PUBKEYHASH // TX_PUBKEYHASH
@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
s << OP_DUP << OP_HASH160 << ToByteVector(pubkeys[0].GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; s << OP_DUP << OP_HASH160 << ToByteVector(pubkeys[0].GetID()) << OP_EQUALVERIFY << OP_CHECKSIG;
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_PUBKEYHASH); BOOST_CHECK_EQUAL(whichType, TX_PUBKEYHASH);
BOOST_CHECK_EQUAL(solutions.size(), 1); BOOST_CHECK_EQUAL(solutions.size(), 1U);
BOOST_CHECK(solutions[0] == ToByteVector(pubkeys[0].GetID())); BOOST_CHECK(solutions[0] == ToByteVector(pubkeys[0].GetID()));
// TX_SCRIPTHASH // TX_SCRIPTHASH
@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
s << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL; s << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL;
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_SCRIPTHASH); BOOST_CHECK_EQUAL(whichType, TX_SCRIPTHASH);
BOOST_CHECK_EQUAL(solutions.size(), 1); BOOST_CHECK_EQUAL(solutions.size(), 1U);
BOOST_CHECK(solutions[0] == ToByteVector(CScriptID(redeemScript))); BOOST_CHECK(solutions[0] == ToByteVector(CScriptID(redeemScript)));
// TX_MULTISIG // TX_MULTISIG
@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
OP_2 << OP_CHECKMULTISIG; OP_2 << OP_CHECKMULTISIG;
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_MULTISIG); BOOST_CHECK_EQUAL(whichType, TX_MULTISIG);
BOOST_CHECK_EQUAL(solutions.size(), 4); BOOST_CHECK_EQUAL(solutions.size(), 4U);
BOOST_CHECK(solutions[0] == std::vector<unsigned char>({1})); BOOST_CHECK(solutions[0] == std::vector<unsigned char>({1}));
BOOST_CHECK(solutions[1] == ToByteVector(pubkeys[0])); BOOST_CHECK(solutions[1] == ToByteVector(pubkeys[0]));
BOOST_CHECK(solutions[2] == ToByteVector(pubkeys[1])); BOOST_CHECK(solutions[2] == ToByteVector(pubkeys[1]));
@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
OP_3 << OP_CHECKMULTISIG; OP_3 << OP_CHECKMULTISIG;
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_MULTISIG); BOOST_CHECK_EQUAL(whichType, TX_MULTISIG);
BOOST_CHECK_EQUAL(solutions.size(), 5); BOOST_CHECK_EQUAL(solutions.size(), 5U);
BOOST_CHECK(solutions[0] == std::vector<unsigned char>({2})); BOOST_CHECK(solutions[0] == std::vector<unsigned char>({2}));
BOOST_CHECK(solutions[1] == ToByteVector(pubkeys[0])); BOOST_CHECK(solutions[1] == ToByteVector(pubkeys[0]));
BOOST_CHECK(solutions[2] == ToByteVector(pubkeys[1])); BOOST_CHECK(solutions[2] == ToByteVector(pubkeys[1]));
@ -90,14 +90,14 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
std::vector<unsigned char>({255}); std::vector<unsigned char>({255});
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_NULL_DATA); BOOST_CHECK_EQUAL(whichType, TX_NULL_DATA);
BOOST_CHECK_EQUAL(solutions.size(), 0); BOOST_CHECK_EQUAL(solutions.size(), 0U);
// TX_WITNESS_V0_KEYHASH // TX_WITNESS_V0_KEYHASH
s.clear(); s.clear();
s << OP_0 << ToByteVector(pubkeys[0].GetID()); s << OP_0 << ToByteVector(pubkeys[0].GetID());
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_WITNESS_V0_KEYHASH); BOOST_CHECK_EQUAL(whichType, TX_WITNESS_V0_KEYHASH);
BOOST_CHECK_EQUAL(solutions.size(), 1); BOOST_CHECK_EQUAL(solutions.size(), 1U);
BOOST_CHECK(solutions[0] == ToByteVector(pubkeys[0].GetID())); BOOST_CHECK(solutions[0] == ToByteVector(pubkeys[0].GetID()));
// TX_WITNESS_V0_SCRIPTHASH // TX_WITNESS_V0_SCRIPTHASH
@ -109,7 +109,7 @@ BOOST_AUTO_TEST_CASE(script_standard_Solver_success)
s << OP_0 << ToByteVector(scriptHash); s << OP_0 << ToByteVector(scriptHash);
BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(Solver(s, whichType, solutions));
BOOST_CHECK_EQUAL(whichType, TX_WITNESS_V0_SCRIPTHASH); BOOST_CHECK_EQUAL(whichType, TX_WITNESS_V0_SCRIPTHASH);
BOOST_CHECK_EQUAL(solutions.size(), 1); BOOST_CHECK_EQUAL(solutions.size(), 1U);
BOOST_CHECK(solutions[0] == ToByteVector(scriptHash)); BOOST_CHECK(solutions[0] == ToByteVector(scriptHash));
// TX_NONSTANDARD // TX_NONSTANDARD
@ -264,7 +264,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestinations)
s << ToByteVector(pubkeys[0]) << OP_CHECKSIG; s << ToByteVector(pubkeys[0]) << OP_CHECKSIG;
BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired)); BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired));
BOOST_CHECK_EQUAL(whichType, TX_PUBKEY); BOOST_CHECK_EQUAL(whichType, TX_PUBKEY);
BOOST_CHECK_EQUAL(addresses.size(), 1); BOOST_CHECK_EQUAL(addresses.size(), 1U);
BOOST_CHECK_EQUAL(nRequired, 1); BOOST_CHECK_EQUAL(nRequired, 1);
BOOST_CHECK(boost::get<CKeyID>(&addresses[0]) && BOOST_CHECK(boost::get<CKeyID>(&addresses[0]) &&
*boost::get<CKeyID>(&addresses[0]) == pubkeys[0].GetID()); *boost::get<CKeyID>(&addresses[0]) == pubkeys[0].GetID());
@ -274,7 +274,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestinations)
s << OP_DUP << OP_HASH160 << ToByteVector(pubkeys[0].GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; s << OP_DUP << OP_HASH160 << ToByteVector(pubkeys[0].GetID()) << OP_EQUALVERIFY << OP_CHECKSIG;
BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired)); BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired));
BOOST_CHECK_EQUAL(whichType, TX_PUBKEYHASH); BOOST_CHECK_EQUAL(whichType, TX_PUBKEYHASH);
BOOST_CHECK_EQUAL(addresses.size(), 1); BOOST_CHECK_EQUAL(addresses.size(), 1U);
BOOST_CHECK_EQUAL(nRequired, 1); BOOST_CHECK_EQUAL(nRequired, 1);
BOOST_CHECK(boost::get<CKeyID>(&addresses[0]) && BOOST_CHECK(boost::get<CKeyID>(&addresses[0]) &&
*boost::get<CKeyID>(&addresses[0]) == pubkeys[0].GetID()); *boost::get<CKeyID>(&addresses[0]) == pubkeys[0].GetID());
@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestinations)
s << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL; s << OP_HASH160 << ToByteVector(CScriptID(redeemScript)) << OP_EQUAL;
BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired)); BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired));
BOOST_CHECK_EQUAL(whichType, TX_SCRIPTHASH); BOOST_CHECK_EQUAL(whichType, TX_SCRIPTHASH);
BOOST_CHECK_EQUAL(addresses.size(), 1); BOOST_CHECK_EQUAL(addresses.size(), 1U);
BOOST_CHECK_EQUAL(nRequired, 1); BOOST_CHECK_EQUAL(nRequired, 1);
BOOST_CHECK(boost::get<CScriptID>(&addresses[0]) && BOOST_CHECK(boost::get<CScriptID>(&addresses[0]) &&
*boost::get<CScriptID>(&addresses[0]) == CScriptID(redeemScript)); *boost::get<CScriptID>(&addresses[0]) == CScriptID(redeemScript));
@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE(script_standard_ExtractDestinations)
OP_2 << OP_CHECKMULTISIG; OP_2 << OP_CHECKMULTISIG;
BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired)); BOOST_CHECK(ExtractDestinations(s, whichType, addresses, nRequired));
BOOST_CHECK_EQUAL(whichType, TX_MULTISIG); BOOST_CHECK_EQUAL(whichType, TX_MULTISIG);
BOOST_CHECK_EQUAL(addresses.size(), 2); BOOST_CHECK_EQUAL(addresses.size(), 2U);
BOOST_CHECK_EQUAL(nRequired, 2); BOOST_CHECK_EQUAL(nRequired, 2);
BOOST_CHECK(boost::get<CKeyID>(&addresses[0]) && BOOST_CHECK(boost::get<CKeyID>(&addresses[0]) &&
*boost::get<CKeyID>(&addresses[0]) == pubkeys[0].GetID()); *boost::get<CKeyID>(&addresses[0]) == pubkeys[0].GetID());

View file

@ -78,18 +78,18 @@ BOOST_AUTO_TEST_CASE(sizes)
BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(bool(0), 0)); BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(bool(0), 0));
// Sanity-check GetSerializeSize and c++ type matching // Sanity-check GetSerializeSize and c++ type matching
BOOST_CHECK_EQUAL(GetSerializeSize(char(0), 0), 1); BOOST_CHECK_EQUAL(GetSerializeSize(char(0), 0), 1U);
BOOST_CHECK_EQUAL(GetSerializeSize(int8_t(0), 0), 1); BOOST_CHECK_EQUAL(GetSerializeSize(int8_t(0), 0), 1U);
BOOST_CHECK_EQUAL(GetSerializeSize(uint8_t(0), 0), 1); BOOST_CHECK_EQUAL(GetSerializeSize(uint8_t(0), 0), 1U);
BOOST_CHECK_EQUAL(GetSerializeSize(int16_t(0), 0), 2); BOOST_CHECK_EQUAL(GetSerializeSize(int16_t(0), 0), 2U);
BOOST_CHECK_EQUAL(GetSerializeSize(uint16_t(0), 0), 2); BOOST_CHECK_EQUAL(GetSerializeSize(uint16_t(0), 0), 2U);
BOOST_CHECK_EQUAL(GetSerializeSize(int32_t(0), 0), 4); BOOST_CHECK_EQUAL(GetSerializeSize(int32_t(0), 0), 4U);
BOOST_CHECK_EQUAL(GetSerializeSize(uint32_t(0), 0), 4); BOOST_CHECK_EQUAL(GetSerializeSize(uint32_t(0), 0), 4U);
BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8); BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8U);
BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8); BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8U);
BOOST_CHECK_EQUAL(GetSerializeSize(float(0), 0), 4); BOOST_CHECK_EQUAL(GetSerializeSize(float(0), 0), 4U);
BOOST_CHECK_EQUAL(GetSerializeSize(double(0), 0), 8); BOOST_CHECK_EQUAL(GetSerializeSize(double(0), 0), 8U);
BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1); BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1U);
} }
BOOST_AUTO_TEST_CASE(floats_conversion) BOOST_AUTO_TEST_CASE(floats_conversion)
@ -103,12 +103,12 @@ BOOST_AUTO_TEST_CASE(floats_conversion)
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x40800000), 4.0F); BOOST_CHECK_EQUAL(ser_uint32_to_float(0x40800000), 4.0F);
BOOST_CHECK_EQUAL(ser_uint32_to_float(0x44444444), 785.066650390625F); BOOST_CHECK_EQUAL(ser_uint32_to_float(0x44444444), 785.066650390625F);
BOOST_CHECK_EQUAL(ser_float_to_uint32(0.0F), 0x00000000); BOOST_CHECK_EQUAL(ser_float_to_uint32(0.0F), 0x00000000U);
BOOST_CHECK_EQUAL(ser_float_to_uint32(0.5F), 0x3f000000); BOOST_CHECK_EQUAL(ser_float_to_uint32(0.5F), 0x3f000000U);
BOOST_CHECK_EQUAL(ser_float_to_uint32(1.0F), 0x3f800000); BOOST_CHECK_EQUAL(ser_float_to_uint32(1.0F), 0x3f800000U);
BOOST_CHECK_EQUAL(ser_float_to_uint32(2.0F), 0x40000000); BOOST_CHECK_EQUAL(ser_float_to_uint32(2.0F), 0x40000000U);
BOOST_CHECK_EQUAL(ser_float_to_uint32(4.0F), 0x40800000); BOOST_CHECK_EQUAL(ser_float_to_uint32(4.0F), 0x40800000U);
BOOST_CHECK_EQUAL(ser_float_to_uint32(785.066650390625F), 0x44444444); BOOST_CHECK_EQUAL(ser_float_to_uint32(785.066650390625F), 0x44444444U);
} }
BOOST_AUTO_TEST_CASE(doubles_conversion) BOOST_AUTO_TEST_CASE(doubles_conversion)
@ -299,39 +299,39 @@ BOOST_AUTO_TEST_CASE(insert_delete)
{ {
// Test inserting/deleting bytes. // Test inserting/deleting bytes.
CDataStream ss(SER_DISK, 0); CDataStream ss(SER_DISK, 0);
BOOST_CHECK_EQUAL(ss.size(), 0); BOOST_CHECK_EQUAL(ss.size(), 0U);
ss.write("\x00\x01\x02\xff", 4); ss.write("\x00\x01\x02\xff", 4);
BOOST_CHECK_EQUAL(ss.size(), 4); BOOST_CHECK_EQUAL(ss.size(), 4U);
char c = (char)11; char c = (char)11;
// Inserting at beginning/end/middle: // Inserting at beginning/end/middle:
ss.insert(ss.begin(), c); ss.insert(ss.begin(), c);
BOOST_CHECK_EQUAL(ss.size(), 5); BOOST_CHECK_EQUAL(ss.size(), 5U);
BOOST_CHECK_EQUAL(ss[0], c); BOOST_CHECK_EQUAL(ss[0], c);
BOOST_CHECK_EQUAL(ss[1], 0); BOOST_CHECK_EQUAL(ss[1], 0);
ss.insert(ss.end(), c); ss.insert(ss.end(), c);
BOOST_CHECK_EQUAL(ss.size(), 6); BOOST_CHECK_EQUAL(ss.size(), 6U);
BOOST_CHECK_EQUAL(ss[4], (char)0xff); BOOST_CHECK_EQUAL(ss[4], (char)0xff);
BOOST_CHECK_EQUAL(ss[5], c); BOOST_CHECK_EQUAL(ss[5], c);
ss.insert(ss.begin()+2, c); ss.insert(ss.begin()+2, c);
BOOST_CHECK_EQUAL(ss.size(), 7); BOOST_CHECK_EQUAL(ss.size(), 7U);
BOOST_CHECK_EQUAL(ss[2], c); BOOST_CHECK_EQUAL(ss[2], c);
// Delete at beginning/end/middle // Delete at beginning/end/middle
ss.erase(ss.begin()); ss.erase(ss.begin());
BOOST_CHECK_EQUAL(ss.size(), 6); BOOST_CHECK_EQUAL(ss.size(), 6U);
BOOST_CHECK_EQUAL(ss[0], 0); BOOST_CHECK_EQUAL(ss[0], 0);
ss.erase(ss.begin()+ss.size()-1); ss.erase(ss.begin()+ss.size()-1);
BOOST_CHECK_EQUAL(ss.size(), 5); BOOST_CHECK_EQUAL(ss.size(), 5U);
BOOST_CHECK_EQUAL(ss[4], (char)0xff); BOOST_CHECK_EQUAL(ss[4], (char)0xff);
ss.erase(ss.begin()+1); ss.erase(ss.begin()+1);
BOOST_CHECK_EQUAL(ss.size(), 4); BOOST_CHECK_EQUAL(ss.size(), 4U);
BOOST_CHECK_EQUAL(ss[0], 0); BOOST_CHECK_EQUAL(ss[0], 0);
BOOST_CHECK_EQUAL(ss[1], 1); BOOST_CHECK_EQUAL(ss[1], 1);
BOOST_CHECK_EQUAL(ss[2], 2); BOOST_CHECK_EQUAL(ss[2], 2);
@ -340,7 +340,7 @@ BOOST_AUTO_TEST_CASE(insert_delete)
// Make sure GetAndClear does the right thing: // Make sure GetAndClear does the right thing:
CSerializeData d; CSerializeData d;
ss.GetAndClear(d); ss.GetAndClear(d);
BOOST_CHECK_EQUAL(ss.size(), 0); BOOST_CHECK_EQUAL(ss.size(), 0U);
} }
BOOST_AUTO_TEST_CASE(class_methods) BOOST_AUTO_TEST_CASE(class_methods)

View file

@ -167,10 +167,10 @@ BOOST_AUTO_TEST_CASE(util_ParseTorReplyMapping)
// (needed because string comparison reads the null as end-of-string) // (needed because string comparison reads the null as end-of-string)
BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(Null=\"\\0\")")); BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(Null=\"\\0\")"));
auto ret = ParseTorReplyMapping("Null=\"\\0\""); auto ret = ParseTorReplyMapping("Null=\"\\0\"");
BOOST_CHECK_EQUAL(ret.size(), 1); BOOST_CHECK_EQUAL(ret.size(), 1U);
auto r_it = ret.begin(); auto r_it = ret.begin();
BOOST_CHECK_EQUAL(r_it->first, "Null"); BOOST_CHECK_EQUAL(r_it->first, "Null");
BOOST_CHECK_EQUAL(r_it->second.size(), 1); BOOST_CHECK_EQUAL(r_it->second.size(), 1U);
BOOST_CHECK_EQUAL(r_it->second[0], '\0'); BOOST_CHECK_EQUAL(r_it->second[0], '\0');
// A more complex valid grammar. PROTOCOLINFO accepts a VersionLine that // A more complex valid grammar. PROTOCOLINFO accepts a VersionLine that

View file

@ -88,7 +88,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
BOOST_CHECK(chainActive.Tip()->GetBlockHash() == block.GetHash()); BOOST_CHECK(chainActive.Tip()->GetBlockHash() == block.GetHash());
// spends[1] should have been removed from the mempool when the // spends[1] should have been removed from the mempool when the
// block with spends[0] is accepted: // block with spends[0] is accepted:
BOOST_CHECK_EQUAL(mempool.size(), 0); BOOST_CHECK_EQUAL(mempool.size(), 0U);
} }
// Run CheckInputs (using pcoinsTip) on the given transaction, for all script // Run CheckInputs (using pcoinsTip) on the given transaction, for all script
@ -205,7 +205,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
// not caching invalidity (if that changes, delete this test case). // not caching invalidity (if that changes, delete this test case).
std::vector<CScriptCheck> scriptchecks; std::vector<CScriptCheck> scriptchecks;
BOOST_CHECK(CheckInputs(spend_tx, state, pcoinsTip.get(), true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_DERSIG, true, true, ptd_spend_tx, &scriptchecks)); BOOST_CHECK(CheckInputs(spend_tx, state, pcoinsTip.get(), true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_DERSIG, true, true, ptd_spend_tx, &scriptchecks));
BOOST_CHECK_EQUAL(scriptchecks.size(), 1); BOOST_CHECK_EQUAL(scriptchecks.size(), 1U);
// Test that CheckInputs returns true iff DERSIG-enforcing flags are // Test that CheckInputs returns true iff DERSIG-enforcing flags are
// not present. Don't add these checks to the cache, so that we can // not present. Don't add these checks to the cache, so that we can
@ -364,7 +364,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
// input was valid) // input was valid)
BOOST_CHECK(CheckInputs(tx, state, pcoinsTip.get(), true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS, true, true, txdata, &scriptchecks)); BOOST_CHECK(CheckInputs(tx, state, pcoinsTip.get(), true, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS, true, true, txdata, &scriptchecks));
// Should get 2 script checks back -- caching is on a whole-transaction basis. // Should get 2 script checks back -- caching is on a whole-transaction basis.
BOOST_CHECK_EQUAL(scriptchecks.size(), 2); BOOST_CHECK_EQUAL(scriptchecks.size(), 2U);
} }
} }

View file

@ -156,8 +156,8 @@ BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
::importwallet(request); ::importwallet(request);
LOCK(wallet.cs_wallet); LOCK(wallet.cs_wallet);
BOOST_CHECK_EQUAL(wallet.mapWallet.size(), 3); BOOST_CHECK_EQUAL(wallet.mapWallet.size(), 3U);
BOOST_CHECK_EQUAL(coinbaseTxns.size(), 103); BOOST_CHECK_EQUAL(coinbaseTxns.size(), 103U);
for (size_t i = 0; i < coinbaseTxns.size(); ++i) { for (size_t i = 0; i < coinbaseTxns.size(); ++i) {
bool found = wallet.GetWalletTx(coinbaseTxns[i].GetHash()); bool found = wallet.GetWalletTx(coinbaseTxns[i].GetHash());
bool expected = i >= 100; bool expected = i >= 100;
@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE(LoadReceiveRequests)
m_wallet.AddDestData(dest, "rr1", "val_rr1"); m_wallet.AddDestData(dest, "rr1", "val_rr1");
auto values = m_wallet.GetDestValues("rr"); auto values = m_wallet.GetDestValues("rr");
BOOST_CHECK_EQUAL(values.size(), 2); BOOST_CHECK_EQUAL(values.size(), 2U);
BOOST_CHECK_EQUAL(values[0], "val_rr0"); BOOST_CHECK_EQUAL(values[0], "val_rr0");
BOOST_CHECK_EQUAL(values[1], "val_rr1"); BOOST_CHECK_EQUAL(values[1], "val_rr1");
} }
@ -318,9 +318,9 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
// Confirm ListCoins initially returns 1 coin grouped under coinbaseKey // Confirm ListCoins initially returns 1 coin grouped under coinbaseKey
// address. // address.
auto list = wallet->ListCoins(); auto list = wallet->ListCoins();
BOOST_CHECK_EQUAL(list.size(), 1); BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress); BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress);
BOOST_CHECK_EQUAL(list.begin()->second.size(), 1); BOOST_CHECK_EQUAL(list.begin()->second.size(), 1U);
// Check initial balance from one mature coinbase transaction. // Check initial balance from one mature coinbase transaction.
BOOST_CHECK_EQUAL(50 * COIN, wallet->GetAvailableBalance()); BOOST_CHECK_EQUAL(50 * COIN, wallet->GetAvailableBalance());
@ -331,16 +331,16 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
// pubkey. // pubkey.
AddTx(CRecipient{GetScriptForRawPubKey({}), 1 * COIN, false /* subtract fee */}); AddTx(CRecipient{GetScriptForRawPubKey({}), 1 * COIN, false /* subtract fee */});
list = wallet->ListCoins(); list = wallet->ListCoins();
BOOST_CHECK_EQUAL(list.size(), 1); BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress); BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress);
BOOST_CHECK_EQUAL(list.begin()->second.size(), 2); BOOST_CHECK_EQUAL(list.begin()->second.size(), 2U);
// Lock both coins. Confirm number of available coins drops to 0. // Lock both coins. Confirm number of available coins drops to 0.
{ {
LOCK2(cs_main, wallet->cs_wallet); LOCK2(cs_main, wallet->cs_wallet);
std::vector<COutput> available; std::vector<COutput> available;
wallet->AvailableCoins(available); wallet->AvailableCoins(available);
BOOST_CHECK_EQUAL(available.size(), 2); BOOST_CHECK_EQUAL(available.size(), 2U);
} }
for (const auto& group : list) { for (const auto& group : list) {
for (const auto& coin : group.second) { for (const auto& coin : group.second) {
@ -352,14 +352,14 @@ BOOST_FIXTURE_TEST_CASE(ListCoins, ListCoinsTestingSetup)
LOCK2(cs_main, wallet->cs_wallet); LOCK2(cs_main, wallet->cs_wallet);
std::vector<COutput> available; std::vector<COutput> available;
wallet->AvailableCoins(available); wallet->AvailableCoins(available);
BOOST_CHECK_EQUAL(available.size(), 0); BOOST_CHECK_EQUAL(available.size(), 0U);
} }
// Confirm ListCoins still returns same result as before, despite coins // Confirm ListCoins still returns same result as before, despite coins
// being locked. // being locked.
list = wallet->ListCoins(); list = wallet->ListCoins();
BOOST_CHECK_EQUAL(list.size(), 1); BOOST_CHECK_EQUAL(list.size(), 1U);
BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress); BOOST_CHECK_EQUAL(boost::get<CKeyID>(list.begin()->first).ToString(), coinbaseAddress);
BOOST_CHECK_EQUAL(list.begin()->second.size(), 2); BOOST_CHECK_EQUAL(list.begin()->second.size(), 2U);
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()