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

Function TestScriptStandardPush

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

Source from the content-addressed store, hash-verified

528}
529
530func TestScriptStandardPush(t *testing.T) {
531 for i := 0; i < 67000; i++ {
532 s := script.NewEmptyScript()
533 s.PushInt64(int64(i))
534 if !s.IsPushOnly() {
535 t.Errorf("Number %d is not pure push.", i)
536 }
537 if VerifyScript(nil, s, script.NewScriptRaw([]byte{opcodes.OP_1}),
538 0, 0, script.ScriptVerifyMinmalData, NewScriptRealChecker()) != nil {
539 t.Errorf("Number %d push is not minimal data.", i)
540 }
541 }
542 for i := 0; i <= script.MaxScriptElementSize; i++ {
543 s := script.NewEmptyScript()
544 s.PushSingleData(bytes.Repeat([]byte{'\111'}, i))
545 if !s.IsPushOnly() {
546 t.Errorf("Length %d is not pure push.", i)
547 }
548 if VerifyScript(nil, s, script.NewScriptRaw([]byte{opcodes.OP_1}),
549 0, 0, script.ScriptVerifyMinmalData, NewScriptRealChecker()) != nil {
550 t.Errorf("Length %d push is not minimal data.", i)
551 }
552 }
553}
554
555func TestIsPushOnlyOnInvalidScripts(t *testing.T) {
556 s := script.NewEmptyScript()

Callers

nothing calls this directly

Calls 5

VerifyScriptFunction · 0.85
NewScriptRealCheckerFunction · 0.85
PushInt64Method · 0.80
IsPushOnlyMethod · 0.80
PushSingleDataMethod · 0.80

Tested by

no test coverage detected