| 30 | } |
| 31 | |
| 32 | func TestParseDefSymbol(t *testing.T) { |
| 33 | p := Parser{} |
| 34 | |
| 35 | result, err := p.Parse(strings.NewReader(` |
| 36 | %counter = 0x0015 |
| 37 | %foo = 91 |
| 38 | %bar = 0x2198 |
| 39 | %WOOHoo93 =0x104 |
| 40 | `)) |
| 41 | |
| 42 | expected := []Instruction{ |
| 43 | DEFSYMBOL{"counter", 0x0015}, |
| 44 | DEFSYMBOL{"foo", 91}, |
| 45 | DEFSYMBOL{"bar", 0x2198}, |
| 46 | DEFSYMBOL{"WOOHoo93", 0x104}, |
| 47 | } |
| 48 | |
| 49 | if err != nil { |
| 50 | t.FailNow() |
| 51 | } |
| 52 | |
| 53 | if result[0] != expected[0] { |
| 54 | t.FailNow() |
| 55 | } |
| 56 | |
| 57 | if result[1] != expected[1] { |
| 58 | t.FailNow() |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | |
| 63 | func TestParseCALL(t *testing.T) { |