Changeset View
Changeset View
Standalone View
Standalone View
src/test/script_tests.cpp
Show First 20 Lines • Show All 2,743 Lines • ▼ Show 20 Lines | for (int i = 0; i < 67000; i++) { | ||||
CScript script; | CScript script; | ||||
script << i; | script << i; | ||||
BOOST_CHECK_MESSAGE(script.IsPushOnly(), | BOOST_CHECK_MESSAGE(script.IsPushOnly(), | ||||
"Number " << i << " is not pure push."); | "Number " << i << " is not pure push."); | ||||
BOOST_CHECK_MESSAGE(VerifyScript(script, CScript() << OP_1, | BOOST_CHECK_MESSAGE(VerifyScript(script, CScript() << OP_1, | ||||
SCRIPT_VERIFY_MINIMALDATA, | SCRIPT_VERIFY_MINIMALDATA, | ||||
BaseSignatureChecker(), &err), | BaseSignatureChecker(), &err), | ||||
"Number " << i << " push is not minimal data."); | "Number " << i << " push is not minimal data."); | ||||
BOOST_CHECK_MESSAGE(script.IsMinimalPushOnly(), | |||||
"Number " << i << " push is not minimally pushed."); | |||||
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); | BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); | ||||
} | } | ||||
for (unsigned int i = 0; i <= MAX_SCRIPT_ELEMENT_SIZE; i++) { | for (unsigned int i = 0; i <= MAX_SCRIPT_ELEMENT_SIZE; i++) { | ||||
std::vector<uint8_t> data(i, '\111'); | std::vector<uint8_t> data(i, '\111'); | ||||
CScript script; | CScript script; | ||||
script << data; | script << data; | ||||
BOOST_CHECK_MESSAGE(script.IsPushOnly(), | BOOST_CHECK_MESSAGE(script.IsPushOnly(), | ||||
"Length " << i << " is not pure push."); | "Length " << i << " is not pure push."); | ||||
BOOST_CHECK_MESSAGE(VerifyScript(script, CScript() << OP_1, | BOOST_CHECK_MESSAGE(VerifyScript(script, CScript() << OP_1, | ||||
SCRIPT_VERIFY_MINIMALDATA, | SCRIPT_VERIFY_MINIMALDATA, | ||||
BaseSignatureChecker(), &err), | BaseSignatureChecker(), &err), | ||||
"Length " << i << " push is not minimal data."); | "Length " << i << " push is not minimal data."); | ||||
BOOST_CHECK_MESSAGE(script.IsMinimalPushOnly(), | |||||
"Number " << i << " push is not minimally pushed."); | |||||
BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); | BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(script_GetScriptAsm) { | BOOST_AUTO_TEST_CASE(script_GetScriptAsm) { | ||||
BOOST_CHECK_EQUAL("OP_CHECKLOCKTIMEVERIFY", | BOOST_CHECK_EQUAL("OP_CHECKLOCKTIMEVERIFY", | ||||
ScriptToAsmStr(CScript() << OP_NOP2, true)); | ScriptToAsmStr(CScript() << OP_NOP2, true)); | ||||
BOOST_CHECK_EQUAL( | BOOST_CHECK_EQUAL( | ||||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |