(t *testing.T)
| 253 | } |
| 254 | |
| 255 | func TestScript_RemoveOpCodeByIndex(t *testing.T) { |
| 256 | tests := []struct { |
| 257 | name string |
| 258 | before []byte |
| 259 | remove int |
| 260 | after []byte |
| 261 | }{ |
| 262 | { |
| 263 | // Nothing to remove. |
| 264 | name: "nothing to remove", |
| 265 | before: []byte{OP_NOP}, |
| 266 | remove: 0, |
| 267 | after: []byte{}, |
| 268 | }, |
| 269 | { |
| 270 | // Test basic opcode removal. |
| 271 | name: "codeseparator 1", |
| 272 | before: []byte{OP_NOP, OP_CODESEPARATOR, OP_TRUE}, |
| 273 | remove: 1, |
| 274 | after: []byte{OP_NOP, OP_TRUE}, |
| 275 | }, |
| 276 | } |
| 277 | |
| 278 | for _, v := range tests { |
| 279 | value := v |
| 280 | |
| 281 | testScript := NewScriptRaw(value.before) |
| 282 | afterRemove := testScript.RemoveOpCodeByIndex(value.remove) |
| 283 | wantScript := NewScriptRaw(value.after) |
| 284 | |
| 285 | assert.Equal(t, wantScript, afterRemove, value.name) |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | func TestScript_IsCommitment(t *testing.T) { |
| 290 | scriptRaw := []byte{0x6a, 0x13, 0xe1, 0x2a, 0x40, 0xd4, 0xa2, 0x21, 0x8d, 0x33, 0xf2, |
nothing calls this directly
no test coverage detected