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

Function TestScript_SerializeUnSerialize

model/script/script_test.go:109–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestScript_SerializeUnSerialize(t *testing.T) {
110 var buf bytes.Buffer
111
112 testScript := NewEmptyScript()
113 testScript.Serialize(&buf)
114
115 serializeSize := testScript.SerializeSize()
116 encodeSize := testScript.EncodeSize()
117
118 resultScript := NewEmptyScript()
119 resultScript.Unserialize(&buf, false)
120
121 flag := testScript.IsEqual(resultScript)
122
123 assert.Equal(t, testScript, resultScript)
124 assert.Equal(t, serializeSize, encodeSize)
125 assert.Equal(t, true, flag)
126}
127
128func TestScript_IsSpendable(t *testing.T) {
129 tests := []struct {

Callers

nothing calls this directly

Calls 7

NewEmptyScriptFunction · 0.85
SerializeMethod · 0.45
SerializeSizeMethod · 0.45
EncodeSizeMethod · 0.45
UnserializeMethod · 0.45
IsEqualMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected