diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/base58_tests.cpp | 6 | ||||
-rw-r--r-- | src/test/bignum_tests.cpp | 36 | ||||
-rw-r--r-- | src/test/transaction_tests.cpp | 4 | ||||
-rw-r--r-- | src/test/util_tests.cpp | 6 |
4 files changed, 47 insertions, 5 deletions
diff --git a/src/test/base58_tests.cpp b/src/test/base58_tests.cpp index 84db99d816..94e84049be 100644 --- a/src/test/base58_tests.cpp +++ b/src/test/base58_tests.cpp @@ -63,6 +63,12 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58) } BOOST_CHECK(!DecodeBase58("invalid", result)); + + // check that DecodeBase58 skips whitespace, but still fails with unexpected non-whitespace at the end. + BOOST_CHECK(!DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t a", result)); + BOOST_CHECK( DecodeBase58(" \t\n\v\f\r skip \r\f\v\n\t ", result)); + std::vector<unsigned char> expected = ParseHex("971a55"); + BOOST_CHECK_EQUAL_COLLECTIONS(result.begin(), result.end(), expected.begin(), expected.end()); } // Visitor to check address type diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp index 9d67324c76..205b15adcf 100644 --- a/src/test/bignum_tests.cpp +++ b/src/test/bignum_tests.cpp @@ -135,6 +135,42 @@ BOOST_AUTO_TEST_CASE(bignum_SetCompact) BOOST_CHECK_EQUAL(num.GetHex(), "0"); BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + num.SetCompact(0x01003456); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x02000056); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x03000000); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x04000000); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x00923456); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x01803456); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x02800056); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x03800000); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + + num.SetCompact(0x04800000); + BOOST_CHECK_EQUAL(num.GetHex(), "0"); + BOOST_CHECK_EQUAL(num.GetCompact(), 0U); + num.SetCompact(0x01123456); BOOST_CHECK_EQUAL(num.GetHex(), "12"); BOOST_CHECK_EQUAL(num.GetCompact(), 0x01120000U); diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index 104b09972f..588c8013c7 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -271,10 +271,10 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) string reason; BOOST_CHECK(IsStandardTx(t, reason)); - t.vout[0].nValue = 5011; // dust + t.vout[0].nValue = 501; // dust BOOST_CHECK(!IsStandardTx(t, reason)); - t.vout[0].nValue = 6011; // not dust + t.vout[0].nValue = 601; // not dust BOOST_CHECK(IsStandardTx(t, reason)); t.vout[0].scriptPubKey = CScript() << OP_1; diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 691f02a9d7..706737b115 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -311,9 +311,9 @@ BOOST_AUTO_TEST_CASE(strprintf_numbers) { int64_t s64t = -9223372036854775807LL; /* signed 64 bit test value */ uint64_t u64t = 18446744073709551615ULL; /* unsigned 64 bit test value */ - BOOST_CHECK(strprintf("%s %"PRId64" %s", B, s64t, E) == B" -9223372036854775807 "E); - BOOST_CHECK(strprintf("%s %"PRIu64" %s", B, u64t, E) == B" 18446744073709551615 "E); - BOOST_CHECK(strprintf("%s %"PRIx64" %s", B, u64t, E) == B" ffffffffffffffff "E); + BOOST_CHECK(strprintf("%s %d %s", B, s64t, E) == B" -9223372036854775807 "E); + BOOST_CHECK(strprintf("%s %u %s", B, u64t, E) == B" 18446744073709551615 "E); + BOOST_CHECK(strprintf("%s %x %s", B, u64t, E) == B" ffffffffffffffff "E); size_t st = 12345678; /* unsigned size_t test value */ ssize_t sst = -12345678; /* signed size_t test value */ |