diff options
author | Jeff Garzik <jgarzik@bitpay.com> | 2013-06-10 06:17:38 -0700 |
---|---|---|
committer | Jeff Garzik <jgarzik@bitpay.com> | 2013-06-10 06:17:38 -0700 |
commit | f59530ce6eb5a889e6eb750024ddb20e7b0df9d7 (patch) | |
tree | e224b540dce7890cbf54f43215a05213bd5cb494 /src/test | |
parent | 8b313c93311813e8697807a701604d182ee83d44 (diff) | |
parent | 6e68524e95da2bedc21b1d95c4a206b902ab7c22 (diff) |
Merge pull request #2154 from CodeShark/dependencycleanup
Clean up code dependencies
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/data/tx_invalid.json | 2 | ||||
-rw-r--r-- | src/test/data/tx_valid.json | 2 | ||||
-rw-r--r-- | src/test/script_P2SH_tests.cpp | 18 | ||||
-rw-r--r-- | src/test/transaction_tests.cpp | 24 |
4 files changed, 23 insertions, 23 deletions
diff --git a/src/test/data/tx_invalid.json b/src/test/data/tx_invalid.json index 81e77b7df8..a26f4a87db 100644 --- a/src/test/data/tx_invalid.json +++ b/src/test/data/tx_invalid.json @@ -23,7 +23,7 @@ [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7a052c840ba73af26755de42cf01cc9e0a49fef0 EQUAL"]], "010000000100010000000000000000000000000000000000000000000000000000000000000000000009085768617420697320ffffffff010000000000000000015100000000", true], -["Tests for CTransaction::CheckTransaction()"], +["Tests for CheckTransaction()"], ["No inputs"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7a052c840ba73af26755de42cf01cc9e0a49fef0 EQUAL"]], "0100000000010000000000000000015100000000", true], diff --git a/src/test/data/tx_valid.json b/src/test/data/tx_valid.json index 8aeb30f35b..faf911a97f 100644 --- a/src/test/data/tx_valid.json +++ b/src/test/data/tx_valid.json @@ -50,7 +50,7 @@ [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x8febbed40483661de6958d957412f82deed8e2f7 EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006e493046022100c66c9cdf4c43609586d15424c54707156e316d88b0a1534c9e6b0d4f311406310221009c0fe51dbc9c4ab7cc25d3fdbeccf6679fe6827f08edf2b4a9f16ee3eb0e438a0123210338e8034509af564c62644c07691942e0c056752008a173c89f60ab2a88ac2ebfacffffffff010000000000000000015100000000", true], -["Tests for CTransaction::CheckTransaction()"], +["Tests for CheckTransaction()"], ["MAX_MONEY output"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x32afac281462b822adbec5094b8d4d337dd5bd6a EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006e493046022100e1eadba00d9296c743cb6ecc703fd9ddc9b3cd12906176a226ae4c18d6b00796022100a71aef7d2874deff681ba6080f1b278bac7bb99c61b08a85f4311970ffe7f63f012321030c0588dc44d92bdcbf8e72093466766fdc265ead8db64517b0c542275b70fffbacffffffff010040075af0750700015100000000", true], diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp index 65f0ad0cdc..23cb3a8e0a 100644 --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(sign) txFrom.vout[i+4].scriptPubKey = standardScripts[i]; txFrom.vout[i+4].nValue = COIN; } - BOOST_CHECK(txFrom.IsStandard()); + BOOST_CHECK(IsStandardTx(txFrom)); CTransaction txTo[8]; // Spending transactions for (int i = 0; i < 8; i++) @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(set) txFrom.vout[i].scriptPubKey = outer[i]; txFrom.vout[i].nValue = CENT; } - BOOST_CHECK(txFrom.IsStandard()); + BOOST_CHECK(IsStandardTx(txFrom)); CTransaction txTo[4]; // Spending transactions for (int i = 0; i < 4; i++) @@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(set) for (int i = 0; i < 4; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); - BOOST_CHECK_MESSAGE(txTo[i].IsStandard(), strprintf("txTo[%d].IsStandard", i)); + BOOST_CHECK_MESSAGE(IsStandardTx(txTo[i]), strprintf("txTo[%d].IsStandard", i)); } } @@ -305,15 +305,15 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard) txTo.vin[2].prevout.hash = txFrom.GetHash(); BOOST_CHECK(SignSignature(keystore, txFrom, txTo, 2)); - BOOST_CHECK(txTo.AreInputsStandard(coins)); - BOOST_CHECK_EQUAL(txTo.GetP2SHSigOpCount(coins), 1U); + BOOST_CHECK(::AreInputsStandard(txTo, coins)); + BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txTo, coins), 1U); // Make sure adding crap to the scriptSigs makes them non-standard: for (int i = 0; i < 3; i++) { CScript t = txTo.vin[i].scriptSig; txTo.vin[i].scriptSig = (CScript() << 11) + t; - BOOST_CHECK(!txTo.AreInputsStandard(coins)); + BOOST_CHECK(!::AreInputsStandard(txTo, coins)); txTo.vin[i].scriptSig = t; } @@ -329,11 +329,11 @@ BOOST_AUTO_TEST_CASE(AreInputsStandard) txToNonStd.vin[1].prevout.hash = txFrom.GetHash(); txToNonStd.vin[1].scriptSig << OP_0 << Serialize(oneOfEleven); - BOOST_CHECK(!txToNonStd.AreInputsStandard(coins)); - BOOST_CHECK_EQUAL(txToNonStd.GetP2SHSigOpCount(coins), 11U); + BOOST_CHECK(!::AreInputsStandard(txToNonStd, coins)); + BOOST_CHECK_EQUAL(GetP2SHSigOpCount(txToNonStd, coins), 11U); txToNonStd.vin[0].scriptSig.clear(); - BOOST_CHECK(!txToNonStd.AreInputsStandard(coins)); + BOOST_CHECK(!::AreInputsStandard(txToNonStd, coins)); } BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp index ddff2acd4e..53d1307b69 100644 --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(tx_valid) stream >> tx; CValidationState state; - BOOST_CHECK_MESSAGE(tx.CheckTransaction(state), strTest); + BOOST_CHECK_MESSAGE(CheckTransaction(tx, state), strTest); BOOST_CHECK(state.IsValid()); for (unsigned int i = 0; i < tx.vin.size(); i++) @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(tx_invalid) stream >> tx; CValidationState state; - fValid = tx.CheckTransaction(state) && state.IsValid(); + fValid = CheckTransaction(tx, state) && state.IsValid(); for (unsigned int i = 0; i < tx.vin.size() && fValid; i++) { @@ -163,11 +163,11 @@ BOOST_AUTO_TEST_CASE(basic_transaction_tests) CTransaction tx; stream >> tx; CValidationState state; - BOOST_CHECK_MESSAGE(tx.CheckTransaction(state) && state.IsValid(), "Simple deserialized transaction should be valid."); + BOOST_CHECK_MESSAGE(CheckTransaction(tx, state) && state.IsValid(), "Simple deserialized transaction should be valid."); // Check that duplicate txins fail tx.vin.push_back(tx.vin[0]); - BOOST_CHECK_MESSAGE(!tx.CheckTransaction(state) || !state.IsValid(), "Transaction with duplicate txins should be invalid."); + BOOST_CHECK_MESSAGE(!CheckTransaction(tx, state) || !state.IsValid(), "Transaction with duplicate txins should be invalid."); } // @@ -230,16 +230,16 @@ BOOST_AUTO_TEST_CASE(test_Get) t1.vout[0].nValue = 90*CENT; t1.vout[0].scriptPubKey << OP_1; - BOOST_CHECK(t1.AreInputsStandard(coins)); - BOOST_CHECK_EQUAL(t1.GetValueIn(coins), (50+21+22)*CENT); + BOOST_CHECK(AreInputsStandard(t1, coins)); + BOOST_CHECK_EQUAL(coins.GetValueIn(t1), (50+21+22)*CENT); // Adding extra junk to the scriptSig should make it non-standard: t1.vin[0].scriptSig << OP_11; - BOOST_CHECK(!t1.AreInputsStandard(coins)); + BOOST_CHECK(!AreInputsStandard(t1, coins)); // ... as should not having enough: t1.vin[0].scriptSig = CScript(); - BOOST_CHECK(!t1.AreInputsStandard(coins)); + BOOST_CHECK(!AreInputsStandard(t1, coins)); } BOOST_AUTO_TEST_CASE(test_IsStandard) @@ -260,16 +260,16 @@ BOOST_AUTO_TEST_CASE(test_IsStandard) key.MakeNewKey(true); t.vout[0].scriptPubKey.SetDestination(key.GetPubKey().GetID()); - BOOST_CHECK(t.IsStandard()); + BOOST_CHECK(IsStandardTx(t)); t.vout[0].nValue = 5011; // dust - BOOST_CHECK(!t.IsStandard()); + BOOST_CHECK(!IsStandardTx(t)); t.vout[0].nValue = 6011; // not dust - BOOST_CHECK(t.IsStandard()); + BOOST_CHECK(IsStandardTx(t)); t.vout[0].scriptPubKey = CScript() << OP_1; - BOOST_CHECK(!t.IsStandard()); + BOOST_CHECK(!IsStandardTx(t)); } BOOST_AUTO_TEST_SUITE_END() |