8#include <boost/test/unit_test.hpp>
19 std::vector<unsigned char> bytes = {
OP_0, 32};
20 bytes.insert(bytes.end(), 32, 0);
58 bytes.insert(bytes.end(), 32, 0);
62 bytes.insert(bytes.end(), 32, 0);
66 bytes.insert(bytes.end(), 32, 0);
72bool IsExpectedWitnessProgram(
const CScript&
script,
const int expectedVersion,
const std::vector<unsigned char>& expectedProgram)
75 std::vector<unsigned char> actualProgram;
76 if (!
script.IsWitnessProgram(actualVersion, actualProgram)) {
87 std::vector<unsigned char> dummyProgram;
88 return !
script.IsWitnessProgram(dummyVersion, dummyProgram);
96 std::vector<unsigned char> program = {42, 18};
98 wit <<
OP_0 << program;
99 BOOST_CHECK(IsExpectedWitnessProgram(wit, 0, program));
104 wit <<
OP_16 << program;
105 BOOST_CHECK(IsExpectedWitnessProgram(wit, 16, program));
108 std::vector<unsigned char> bytes = {
OP_5,
static_cast<unsigned char>(program.size())};
109 bytes.insert(bytes.end(), program.begin(), program.end());
110 BOOST_CHECK(IsExpectedWitnessProgram(
CScript(bytes.begin(), bytes.end()), 5, program));
115 std::vector<unsigned char> program(10);
123 std::vector<unsigned char> program(1);
125 nowit <<
OP_0 << program;
130 nowit <<
OP_0 << program;
136 std::vector<unsigned char> program(10);
152 bytes.insert(bytes.end(), 32, 0);
156 bytes.insert(bytes.end(), 32, 0);
160 bytes.insert(bytes.end(), 32, 0);
Serialized script, used inside transaction inputs and outputs.
bool IsPayToWitnessScriptHash() const
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
std::vector< unsigned char > ToByteVector(const T &in)
BOOST_AUTO_TEST_CASE(IsPayToWitnessScriptHash_Valid)