Skip to content

Commit d81dccf

Browse files
author
MarcoFalke
committed
Merge #10777: [tests] Avoid redundant assignments. Remove unused variables
49eb091 [tests] Avoid redundant assignments. Remove unused variables. (practicalswift) Pull request description: * Remove unused variables. * Avoid redundant assignments. Tree-SHA512: 74dd59680c785c601982a791648bc5d9b04e2b4509119e05f2e402b94998f5bbcbdea1f82d05e5f431fe06642e8db7c346fa8bc4c11f8cdcc554bc70d735534c
2 parents a90e6d2 + 49eb091 commit d81dccf

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/test/scriptnum_tests.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ static void CheckCreateVch(const int64_t& num)
2929
CScriptNum scriptnum(num);
3030
BOOST_CHECK(verify(bignum, scriptnum));
3131

32-
std::vector<unsigned char> vch = bignum.getvch();
33-
3432
CScriptNum10 bignum2(bignum.getvch(), false);
35-
vch = scriptnum.getvch();
3633
CScriptNum scriptnum2(scriptnum.getvch(), false);
3734
BOOST_CHECK(verify(bignum2, scriptnum2));
3835

@@ -90,11 +87,10 @@ static void CheckSubtract(const int64_t& num1, const int64_t& num2)
9087
const CScriptNum10 bignum2(num2);
9188
const CScriptNum scriptnum1(num1);
9289
const CScriptNum scriptnum2(num2);
93-
bool invalid = false;
9490

9591
// int64_t overflow is undefined.
96-
invalid = ((num2 > 0 && num1 < std::numeric_limits<int64_t>::min() + num2) ||
97-
(num2 < 0 && num1 > std::numeric_limits<int64_t>::max() + num2));
92+
bool invalid = ((num2 > 0 && num1 < std::numeric_limits<int64_t>::min() + num2) ||
93+
(num2 < 0 && num1 > std::numeric_limits<int64_t>::max() + num2));
9894
if (!invalid)
9995
{
10096
BOOST_CHECK(verify(bignum1 - bignum2, scriptnum1 - scriptnum2));

src/test/sighash_tests.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,9 @@ BOOST_AUTO_TEST_CASE(sighash_test)
124124
#if defined(PRINT_SIGHASH_JSON)
125125
std::cout << "[\n";
126126
std::cout << "\t[\"raw_transaction, script, input_index, hashType, signature_hash (result)\"],\n";
127-
#endif
127+
int nRandomTests = 500;
128+
#else
128129
int nRandomTests = 50000;
129-
130-
#if defined(PRINT_SIGHASH_JSON)
131-
nRandomTests = 500;
132130
#endif
133131
for (int i=0; i<nRandomTests; i++) {
134132
int nHashType = InsecureRand32();

0 commit comments

Comments
 (0)