diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2018-12-12 14:31:38 +0100 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-12-13 09:37:23 +0100 |
commit | c84c2b8c92eb56b3b3793fc95265158f5eeb00db (patch) | |
tree | 38a2fd3c0b2c44f4d68bb7c7e41609207f701a10 /src/test/script_tests.cpp | |
parent | 6d0a14703e288d72ff19d4d89defbc853233899f (diff) |
tests: Test for expected return values when calling functions returning a success code
Diffstat (limited to 'src/test/script_tests.cpp')
-rw-r--r-- | src/test/script_tests.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp index 9a801901b7..0fd271c758 100644 --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -1185,7 +1185,7 @@ BOOST_AUTO_TEST_CASE(script_combineSigs) key.MakeNewKey(i%2 == 1); keys.push_back(key); pubkeys.push_back(key.GetPubKey()); - keystore.AddKey(key); + BOOST_CHECK(keystore.AddKey(key)); } CMutableTransaction txFrom = BuildCreditingTransaction(GetScriptForDestination(keys[0].GetPubKey().GetID())); @@ -1198,7 +1198,7 @@ BOOST_AUTO_TEST_CASE(script_combineSigs) BOOST_CHECK(combined.scriptSig.empty()); // Single signature case: - SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL); // changes scriptSig + BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL)); // changes scriptSig scriptSig = DataFromTransaction(txTo, 0, txFrom.vout[0]); combined = CombineSignatures(txFrom.vout[0], txTo, scriptSig, empty); BOOST_CHECK(combined.scriptSig == scriptSig.scriptSig); @@ -1206,31 +1206,31 @@ BOOST_AUTO_TEST_CASE(script_combineSigs) BOOST_CHECK(combined.scriptSig == scriptSig.scriptSig); SignatureData scriptSigCopy = scriptSig; // Signing again will give a different, valid signature: - SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL); + BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL)); scriptSig = DataFromTransaction(txTo, 0, txFrom.vout[0]); combined = CombineSignatures(txFrom.vout[0], txTo, scriptSigCopy, scriptSig); BOOST_CHECK(combined.scriptSig == scriptSigCopy.scriptSig || combined.scriptSig == scriptSig.scriptSig); // P2SH, single-signature case: CScript pkSingle; pkSingle << ToByteVector(keys[0].GetPubKey()) << OP_CHECKSIG; - keystore.AddCScript(pkSingle); + BOOST_CHECK(keystore.AddCScript(pkSingle)); scriptPubKey = GetScriptForDestination(CScriptID(pkSingle)); - SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL); + BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL)); scriptSig = DataFromTransaction(txTo, 0, txFrom.vout[0]); combined = CombineSignatures(txFrom.vout[0], txTo, scriptSig, empty); BOOST_CHECK(combined.scriptSig == scriptSig.scriptSig); combined = CombineSignatures(txFrom.vout[0], txTo, empty, scriptSig); BOOST_CHECK(combined.scriptSig == scriptSig.scriptSig); scriptSigCopy = scriptSig; - SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL); + BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL)); scriptSig = DataFromTransaction(txTo, 0, txFrom.vout[0]); combined = CombineSignatures(txFrom.vout[0], txTo, scriptSigCopy, scriptSig); BOOST_CHECK(combined.scriptSig == scriptSigCopy.scriptSig || combined.scriptSig == scriptSig.scriptSig); // Hardest case: Multisig 2-of-3 scriptPubKey = GetScriptForMultisig(2, pubkeys); - keystore.AddCScript(scriptPubKey); - SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL); + BOOST_CHECK(keystore.AddCScript(scriptPubKey)); + BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL)); scriptSig = DataFromTransaction(txTo, 0, txFrom.vout[0]); combined = CombineSignatures(txFrom.vout[0], txTo, scriptSig, empty); BOOST_CHECK(combined.scriptSig == scriptSig.scriptSig); |