281 lines
6.0 KiB
Rust
281 lines
6.0 KiB
Rust
//! serde regression tests for blockdata::opcodes module.
|
|
//!
|
|
|
|
#![cfg(feature = "serde")]
|
|
|
|
extern crate bitcoin;
|
|
extern crate serde_json;
|
|
|
|
macro_rules! test_opcodes {
|
|
($($op:ident),* $(,)+) => {
|
|
$(
|
|
let op = bitcoin::blockdata::opcodes::all::$op;
|
|
let want = concat!("\"", stringify!($op), "\"");
|
|
let got = ::serde_json::to_string(&op).unwrap();
|
|
assert_eq!(got, want);
|
|
)*
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn serde_regression_opcodes() {
|
|
test_opcodes! {
|
|
OP_PUSHBYTES_0,
|
|
OP_PUSHBYTES_1,
|
|
OP_PUSHBYTES_2,
|
|
OP_PUSHBYTES_3,
|
|
OP_PUSHBYTES_4,
|
|
OP_PUSHBYTES_5,
|
|
OP_PUSHBYTES_6,
|
|
OP_PUSHBYTES_7,
|
|
OP_PUSHBYTES_8,
|
|
OP_PUSHBYTES_9,
|
|
OP_PUSHBYTES_10,
|
|
OP_PUSHBYTES_11,
|
|
OP_PUSHBYTES_12,
|
|
OP_PUSHBYTES_13,
|
|
OP_PUSHBYTES_14,
|
|
OP_PUSHBYTES_15,
|
|
OP_PUSHBYTES_16,
|
|
OP_PUSHBYTES_17,
|
|
OP_PUSHBYTES_18,
|
|
OP_PUSHBYTES_19,
|
|
OP_PUSHBYTES_20,
|
|
OP_PUSHBYTES_21,
|
|
OP_PUSHBYTES_22,
|
|
OP_PUSHBYTES_23,
|
|
OP_PUSHBYTES_24,
|
|
OP_PUSHBYTES_25,
|
|
OP_PUSHBYTES_26,
|
|
OP_PUSHBYTES_27,
|
|
OP_PUSHBYTES_28,
|
|
OP_PUSHBYTES_29,
|
|
OP_PUSHBYTES_30,
|
|
OP_PUSHBYTES_31,
|
|
OP_PUSHBYTES_32,
|
|
OP_PUSHBYTES_33,
|
|
OP_PUSHBYTES_34,
|
|
OP_PUSHBYTES_35,
|
|
OP_PUS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,
|
|
OP_MIN,
|
|
OP_MAX,
|
|
OP_WITHIN,
|
|
OP_RIPEMD160,
|
|
OP_SHA1,
|
|
OP_SHA256,
|
|
OP_HASH160,
|
|
OP_HASH256,
|
|
OP_CODESEPARATOR,
|
|
OP_CHECKSIG,
|
|
OP_CHECKSIGVERIFY,
|
|
OP_CHECKMULTISIG,
|
|
OP_CHECKMULTISIGVERIFY,
|
|
OP_NOP1,
|
|
OP_CLTV,
|
|
OP_CSV,
|
|
OP_NOP4,
|
|
OP_NOP5,
|
|
OP_NOP6,
|
|
OP_NOP7,
|
|
OP_NOP8,
|
|
OP_NOP9,
|
|
OP_NOP10,
|
|
OP_CHECKSIGADD,
|
|
OP_RETURN_187,
|
|
OP_RETURN_188,
|
|
OP_RETURN_189,
|
|
OP_RETURN_190,
|
|
OP_RETURN_191,
|
|
OP_RETURN_192,
|
|
OP_RETURN_193,
|
|
OP_RETURN_194,
|
|
OP_RETURN_195,
|
|
OP_RETURN_196,
|
|
OP_RETURN_197,
|
|
OP_RETURN_198,
|
|
OP_RETURN_199,
|
|
OP_RETURN_200,
|
|
OP_RETURN_201,
|
|
OP_RETURN_202,
|
|
OP_RETURN_203,
|
|
OP_RETURN_204,
|
|
OP_RETURN_205,
|
|
OP_RETURN_206,
|
|
OP_RETURN_207,
|
|
OP_RETURN_208,
|
|
OP_RETURN_209,
|
|
OP_RETURN_210,
|
|
OP_RETURN_211,
|
|
OP_RETURN_212,
|
|
OP_RETURN_213,
|
|
OP_RETURN_214,
|
|
OP_RETURN_215,
|
|
OP_RETURN_216,
|
|
OP_RETURN_217,
|
|
OP_RETURN_218,
|
|
OP_RETURN_219,
|
|
OP_RETURN_220,
|
|
OP_RETURN_221,
|
|
OP_RETURN_222,
|
|
OP_RETURN_223,
|
|
OP_RETURN_224,
|
|
OP_RETURN_225,
|
|
OP_RETURN_226,
|
|
OP_RETURN_227,
|
|
OP_RETURN_228,
|
|
OP_RETURN_229,
|
|
OP_RETURN_230,
|
|
OP_RETURN_231,
|
|
OP_RETURN_232,
|
|
OP_RETURN_233,
|
|
OP_RETURN_234,
|
|
OP_RETURN_235,
|
|
OP_RETURN_236,
|
|
OP_RETURN_237,
|
|
OP_RETURN_238,
|
|
OP_RETURN_239,
|
|
OP_RETURN_240,
|
|
OP_RETURN_241,
|
|
OP_RETURN_242,
|
|
OP_RETURN_243,
|
|
OP_RETURN_244,
|
|
OP_RETURN_245,
|
|
OP_RETURN_246,
|
|
OP_RETURN_247,
|
|
OP_RETURN_248,
|
|
OP_RETURN_249,
|
|
OP_RETURN_250,
|
|
OP_RETURN_251,
|
|
OP_RETURN_252,
|
|
OP_RETURN_253,
|
|
OP_RETURN_254,
|
|
OP_INVALIDOPCODE,
|
|
}
|
|
}
|