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

Function TestScript_IsCommitment

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

Source from the content-addressed store, hash-verified

287}
288
289func TestScript_IsCommitment(t *testing.T) {
290 scriptRaw := []byte{0x6a, 0x13, 0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
291 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31}
292 testScript := NewScriptRaw(scriptRaw)
293 result := testScript.IsCommitment([]byte{0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
294 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31})
295 assert.Equal(t, true, result)
296
297 scriptRaw1 := []byte{0x6b, 0x13, 0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
298 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31}
299 testScript1 := NewScriptRaw(scriptRaw1)
300 result1 := testScript1.IsCommitment([]byte{0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
301 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31})
302 assert.Equal(t, false, result1)
303
304 scriptRaw2 := []byte{0x6a, 0x13, 0xe2, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
305 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31}
306 testScript2 := NewScriptRaw(scriptRaw2)
307 result2 := testScript2.IsCommitment([]byte{0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
308 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31})
309 assert.Equal(t, false, result2)
310
311 scriptRaw3 := []byte{0x6a, 0x13, 0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
312 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31}
313 testScript3 := NewScriptRaw(scriptRaw3)
314 result3 := testScript3.IsCommitment([]byte{0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2,
315 0x08, 0xb9, 0xa0, 0x44, 0x78, 0x94, 0xdc, 0x9b, 0xea, 0x31})
316 assert.Equal(t, false, result3)
317}
318
319func TestBytesToBool(t *testing.T) {
320 tests := []struct {

Callers

nothing calls this directly

Calls 3

NewScriptRawFunction · 0.85
IsCommitmentMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected