Changeset View
Changeset View
Standalone View
Standalone View
src/test/script_tests.cpp
Show First 20 Lines • Show All 2,567 Lines • ▼ Show 20 Lines | static const char hex[] = | ||||
"bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"; | "bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"; | ||||
s = CScript() << ParseHex(hex) << OP_CHECKSIG; | s = CScript() << ParseHex(hex) << OP_CHECKSIG; | ||||
d = CScript() << ParseHex(hex) << OP_CHECKSIG << ParseHex(hex) | d = CScript() << ParseHex(hex) << OP_CHECKSIG << ParseHex(hex) | ||||
<< OP_CHECKSIG; | << OP_CHECKSIG; | ||||
s += s; | s += s; | ||||
BOOST_CHECK(s == d); | BOOST_CHECK(s == d); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(script_HasValidOps) { | |||||
// Exercise the HasValidOps functionality | |||||
CScript script; | |||||
script = ScriptFromHex( | |||||
"76a9141234567890abcdefa1a2a3a4a5a6a7a8a9a0aaab88ac"); // Normal script | |||||
BOOST_CHECK(script.HasValidOps()); | |||||
script = | |||||
ScriptFromHex("76a914ff34567890abcdefa1a2a3a4a5a6a7a8a9a0aaab88ac"); | |||||
BOOST_CHECK(script.HasValidOps()); | |||||
script = ScriptFromHex("ff88ac"); // Script with OP_INVALIDOPCODE explicit | |||||
BOOST_CHECK(!script.HasValidOps()); | |||||
script = ScriptFromHex("88acc0"); // Script with undefined opcode | |||||
BOOST_CHECK(!script.HasValidOps()); | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |