emit: converto to Boolean in Bool()
This commit is contained in:
parent
2fd63387c0
commit
4b064e18aa
3 changed files with 3 additions and 2 deletions
|
@ -46,7 +46,7 @@ func TestConvert(t *testing.T) {
|
|||
{"int64", "[]byte{0, 1, 0}", big.NewInt(256)},
|
||||
{"int64", "[]byte{0}", big.NewInt(0)},
|
||||
{"[]byte", "true", []byte{1}},
|
||||
{"[]byte", "false", []byte{}},
|
||||
{"[]byte", "false", []byte{0}},
|
||||
{"[]byte", "12", []byte{0x0C}},
|
||||
{"[]byte", "0", []byte{}},
|
||||
{"[]byte", "[]byte{0, 1, 0}", []byte{0, 1, 0}},
|
||||
|
|
|
@ -274,7 +274,7 @@ var structTestCases = []testCase{
|
|||
vm.NewBigIntegerItem(big.NewInt(1)),
|
||||
vm.NewBigIntegerItem(big.NewInt(2)),
|
||||
vm.NewByteArrayItem([]byte("hello")),
|
||||
vm.NewByteArrayItem([]byte{}),
|
||||
vm.NewBoolItem(false),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ func Bool(w *io.BinWriter, ok bool) {
|
|||
return
|
||||
}
|
||||
Opcode(w, opcode.PUSHF)
|
||||
Instruction(w, opcode.CONVERT, []byte{0x20}) // 0x20 for Boolean type
|
||||
}
|
||||
|
||||
func padRight(s int, buf []byte) []byte {
|
||||
|
|
Loading…
Reference in a new issue