Skip to content

Commit

Permalink
Merge pull request #2464 from barton2526/test_return
Browse files Browse the repository at this point in the history
test: Test for expected return values when calling functions returning a success code
  • Loading branch information
jamescowens committed Mar 9, 2022
2 parents 02e2072 + 73e30bd commit d55bd14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/test/dos_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
CKey key;
key.MakeNewKey(true);
CBasicKeyStore keystore;
keystore.AddKey(key);
BOOST_CHECK(keystore.AddKey(key));

// 50 orphan transactions:
for (int i = 0; i < 50; i++)
Expand Down Expand Up @@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
tx.vout.resize(1);
tx.vout[0].nValue = 1*CENT;
tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID());
SignSignature(keystore, txPrev, tx, 0);
BOOST_CHECK(SignSignature(keystore, txPrev, tx, 0));
AddOrphanTx(tx);
}

Expand All @@ -184,7 +184,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
tx.vin[j].prevout.n = j;
tx.vin[j].prevout.hash = txPrev.GetHash();
}
SignSignature(keystore, txPrev, tx, 0);
BOOST_CHECK(SignSignature(keystore, txPrev, tx, 0));
// Re-use same signature for other inputs
// (they don't have to be valid for this test)
for (unsigned int j = 1; j < tx.vin.size(); j++)
Expand All @@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(DoS_checkSig)
CKey key;
key.MakeNewKey(true);
CBasicKeyStore keystore;
keystore.AddKey(key);
BOOST_CHECK(keystore.AddKey(key));

// 100 orphan transactions:
static const int NPREV=100;
Expand Down
2 changes: 1 addition & 1 deletion src/test/multisig_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(multisig_Sign)
for (int i = 0; i < 4; i++)
{
key[i].MakeNewKey(true);
keystore.AddKey(key[i]);
BOOST_CHECK(keystore.AddKey(key[i]));
}

CScript a_and_b;
Expand Down

0 comments on commit d55bd14

Please sign in to comment.