Skip to content

Commit d55bd14

Browse files
authored
Merge pull request #2464 from barton2526/test_return
test: Test for expected return values when calling functions returning a success code
2 parents 02e2072 + 73e30bd commit d55bd14

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/test/dos_tests.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
137137
CKey key;
138138
key.MakeNewKey(true);
139139
CBasicKeyStore keystore;
140-
keystore.AddKey(key);
140+
BOOST_CHECK(keystore.AddKey(key));
141141

142142
// 50 orphan transactions:
143143
for (int i = 0; i < 50; i++)
@@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(DoS_mapOrphans)
165165
tx.vout.resize(1);
166166
tx.vout[0].nValue = 1*CENT;
167167
tx.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID());
168-
SignSignature(keystore, txPrev, tx, 0);
168+
BOOST_CHECK(SignSignature(keystore, txPrev, tx, 0));
169169
AddOrphanTx(tx);
170170
}
171171

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

215215
// 100 orphan transactions:
216216
static const int NPREV=100;

src/test/multisig_tests.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ BOOST_AUTO_TEST_CASE(multisig_Sign)
258258
for (int i = 0; i < 4; i++)
259259
{
260260
key[i].MakeNewKey(true);
261-
keystore.AddKey(key[i]);
261+
BOOST_CHECK(keystore.AddKey(key[i]));
262262
}
263263

264264
CScript a_and_b;

0 commit comments

Comments
 (0)