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

Function TestScript_PushInt64

model/script/script_test.go:821–846  ·  view source on GitHub ↗

func () { }

(t *testing.T)

Source from the content-addressed store, hash-verified

819//}
820
821func TestScript_PushInt64(t *testing.T) {
822 tests := []struct {
823 in int64
824 want error
825 wantData []byte
826 description string
827 }{
828 {-2, nil, []byte{0x01, 0x82}, "Input data is -2"},
829 {-1, nil, []byte{0x4f}, "Input data is -1"},
830 {0, nil, []byte{0x00}, "Input data is 0"},
831 {1, nil, []byte{0x51}, "Input data is 1"},
832 {16, nil, []byte{0x60}, "Input data is 16"},
833 {17, nil, []byte{0x01, 0x11}, "Input data is 17"},
834 }
835
836 for _, v := range tests {
837 value := v
838
839 bScript := NewEmptyScript()
840 result := bScript.PushInt64(value.in)
841 assert.Equal(t, value.want, result, value.description)
842
843 data := bScript.GetData()
844 assert.Equal(t, value.wantData, data, value.description)
845 }
846}
847
848func TestScript_PushSingleData(t *testing.T) {
849 tests := []struct {

Callers

nothing calls this directly

Calls 4

NewEmptyScriptFunction · 0.85
PushInt64Method · 0.80
GetDataMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected