diff --git a/pkg/test/assembly_test.go b/pkg/test/assembly_test.go index 69dfb53db..11d8272a1 100644 --- a/pkg/test/assembly_test.go +++ b/pkg/test/assembly_test.go @@ -19,6 +19,10 @@ import ( test_util "github.com/consensys/go-corset/pkg/test/util" ) +func Test_Asm_Add(t *testing.T) { + test_util.Check(t, false, "asm/add") +} + // Recusion // // func Test_Asm_Byte(t *testing.T) { diff --git a/pkg/util/word/big_endian.go b/pkg/util/word/big_endian.go index ff0a80da1..037edd173 100644 --- a/pkg/util/word/big_endian.go +++ b/pkg/util/word/big_endian.go @@ -14,7 +14,6 @@ package word import ( "bytes" - "encoding/hex" "hash/fnv" "math/big" @@ -109,11 +108,9 @@ func (p BigEndian) Bytes() []byte { } func (p BigEndian) String() string { - if len(p.bytes) == 0 { - return "0" - } + bi := p.AsBigInt() // - return hex.EncodeToString(p.bytes) + return bi.String() } func trim(bytes []byte) []byte { diff --git a/testdata/asm/add.accepts.bz2 b/testdata/asm/add.accepts.bz2 new file mode 100644 index 000000000..240f47cef Binary files /dev/null and b/testdata/asm/add.accepts.bz2 differ diff --git a/testdata/asm/add.zkasm b/testdata/asm/add.zkasm new file mode 100644 index 000000000..f0d661980 --- /dev/null +++ b/testdata/asm/add.zkasm @@ -0,0 +1,15 @@ +fn add(inst u8, arg1 u256, arg2 u256) -> (res u256) { + var c u1 + ;; + if inst == 0x01 goto insn_add + if inst == 0x03 goto insn_sub + ;; FIXME: support fail + res = 0 + return +insn_add: + c, res = arg1 + arg2 + return +insn_sub: + c, res = arg1 - arg2 + return +}