aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/base58_tests.cpp6
-rw-r--r--src/test/bignum_tests.cpp36
-rw-r--r--src/test/transaction_tests.cpp4
3 files changed, 44 insertions, 2 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 ad33184bc5..5212dfc70d 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;