MCPcopy Create free account
hub / github.com/copernet/copernicus / TestScriptPushData

Function TestScriptPushData

logic/lscript/lscript_test.go:507–528  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

505}
506
507func TestScriptPushData(t *testing.T) {
508 direct := []byte{1, 0x5a}
509 pushdata1 := []byte{opcodes.OP_PUSHDATA1, 1, 0x5a}
510 pushdata2 := []byte{opcodes.OP_PUSHDATA2, 1, 0, 0x5a}
511 pushdata4 := []byte{opcodes.OP_PUSHDATA4, 1, 0, 0, 0, 0x5a}
512 pushdatascript := [][]byte{pushdata1, pushdata2, pushdata4}
513 directStack := util.NewStack()
514 if err := EvalScript(directStack, script.NewScriptRaw(direct),
515 nil, 0, 0, script.ScriptVerifyP2SH, NewScriptRealChecker()); err != nil {
516 t.Error(err)
517 }
518 for i := 0; i < 3; i++ {
519 pushdataStack := util.NewStack()
520 if err := EvalScript(pushdataStack, script.NewScriptRaw(pushdatascript[i]),
521 nil, 0, 0, script.ScriptVerifyP2SH, NewScriptRealChecker()); err != nil {
522 t.Error(err)
523 }
524 if !reflect.DeepEqual(directStack, pushdataStack) {
525 t.Errorf("ResultStack should be the same")
526 }
527 }
528}
529
530func TestScriptStandardPush(t *testing.T) {
531 for i := 0; i < 67000; i++ {

Callers

nothing calls this directly

Calls 3

EvalScriptFunction · 0.85
NewScriptRealCheckerFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected