(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestScript_RemoveOpcode(t *testing.T) { |
| 147 | tests := []struct { |
| 148 | name string |
| 149 | before []byte |
| 150 | remove byte |
| 151 | after []byte |
| 152 | }{ |
| 153 | { |
| 154 | // Nothing to remove. |
| 155 | name: "nothing to remove", |
| 156 | before: []byte{OP_NOP}, |
| 157 | remove: OP_CODESEPARATOR, |
| 158 | after: []byte{OP_NOP}, |
| 159 | }, |
| 160 | { |
| 161 | // Test basic opcode removal. |
| 162 | name: "codeseparator 1", |
| 163 | before: []byte{OP_NOP, OP_CODESEPARATOR, OP_TRUE}, |
| 164 | remove: OP_CODESEPARATOR, |
| 165 | after: []byte{OP_NOP, OP_TRUE}, |
| 166 | }, |
| 167 | } |
| 168 | |
| 169 | for _, v := range tests { |
| 170 | value := v |
| 171 | |
| 172 | testScript := NewScriptRaw(value.before) |
| 173 | afterRemove := testScript.RemoveOpcode(value.remove) |
| 174 | wantScript := NewScriptRaw(value.after) |
| 175 | |
| 176 | assert.Equal(t, wantScript, afterRemove, value.name) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | func TestScript_RemoveOpcodeByData(t *testing.T) { |
| 181 | tests := []struct { |
nothing calls this directly
no test coverage detected