| 1 | package operandscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/ |
| 2 | |
| 3 | import "testingscip-go gomod github.com/golang/go/src go1.18 testing/" |
| 4 | |
| 5 | func TestConstantsscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/TestConstants().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 6 | cases := []struct { |
| 7 | Const Constantscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/Constant# |
| 8 | Asm string |
| 9 | Bytes int |
| 10 | }{ |
| 11 | {F32scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/F32#(3.1415), "$(3.1415)", 4}, |
| 12 | {F32scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/F32#(42), "$(42.0)", 4}, |
| 13 | {F64scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/F64#(3.1415), "$(3.1415)", 8}, |
| 14 | {F64scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/F64#(42), "$(42.0)", 8}, |
| 15 | {U8scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/U8#(42), "$0x2a", 1}, |
| 16 | {U16scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/U16#(42), "$0x002a", 2}, |
| 17 | {U32scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/U32#(42), "$0x0000002a", 4}, |
| 18 | {U64scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/U64#(42), "$0x000000000000002a", 8}, |
| 19 | {I8scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/I8#(-42), "$-42", 1}, |
| 20 | {I16scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/I16#(-42), "$-42", 2}, |
| 21 | {I32scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/I32#(-42), "$-42", 4}, |
| 22 | {I64scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/I64#(-42), "$-42", 8}, |
| 23 | {Stringscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/String#("hello"), "$\"hello\"", 5}, |
| 24 | {Stringscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/String#("quot:\"q\""), "$\"quot:\\\"q\\\"\"", 8}, |
| 25 | } |
| 26 | for _, c := range cases { |
| 27 | if c.Const.Asmscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/Op#Asm.() != c.Asm { |
| 28 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("%v.Asm() = %v; expect %v", c.Const, c.Const.Asmscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/Op#Asm.(), c.Asm) |
| 29 | } |
| 30 | if c.Const.Bytesscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/Constant#Bytes.() != c.Bytes { |
| 31 | t.Errorfscip-go gomod github.com/golang/go/src go1.18 testing/common#Errorf().("%v.Bytes() = %v; expect %v", c.Const, c.Const.Bytesscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/operand`/Constant#Bytes.(), c.Bytes) |
| 32 | } |
| 33 | } |
| 34 | } |