Changeset View
Changeset View
Standalone View
Standalone View
src/test/script_tests.cpp
Show First 20 Lines • Show All 3,215 Lines • ▼ Show 20 Lines | // Tests with 1 and 3 stack elements | ||||
CScript script; | CScript script; | ||||
script << OP_0 << std::vector<uint8_t>(20, '\42') << OP_1; | script << OP_0 << std::vector<uint8_t>(20, '\42') << OP_1; | ||||
BOOST_CHECK_MESSAGE( | BOOST_CHECK_MESSAGE( | ||||
!script.IsWitnessProgram(), | !script.IsWitnessProgram(), | ||||
"Failed IsWitnessProgram check with 3 stack elements"); | "Failed IsWitnessProgram check with 3 stack elements"); | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(script_can_append_self) { | |||||
CScript s, d; | |||||
s = ScriptFromHex("00"); | |||||
s += s; | |||||
d = ScriptFromHex("0000"); | |||||
BOOST_CHECK(s == d); | |||||
// check doubling a script that's large enough to require reallocation | |||||
static const char hex[] = | |||||
"04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6" | |||||
"bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f"; | |||||
s = CScript() << ParseHex(hex) << OP_CHECKSIG; | |||||
d = CScript() << ParseHex(hex) << OP_CHECKSIG << ParseHex(hex) | |||||
<< OP_CHECKSIG; | |||||
s += s; | |||||
BOOST_CHECK(s == d); | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |