1
0
mirror of https://github.com/zellyn/go6502.git synced 2024-07-05 00:29:05 +00:00
go6502/asm/disasm_test.go
2014-08-05 22:18:03 -07:00

27 lines
610 B
Go

package asm
import "testing"
func TestSymbolRE(t *testing.T) {
tests := []struct {
line string
label string
address string
}{
{"SHAPEL EQU $1A POINTER TO", "SHAPEL", "1A"},
}
for i, tt := range tests {
groups := symRe.FindStringSubmatch(tt.line)
if groups == nil {
t.Errorf(`%d. Unable to parse '%s'`, i, tt.line)
}
if groups[1] != tt.label {
t.Errorf(`%d. want label='%s'; got '%s' for line: '%s'`, i, tt.label, groups[1], tt.line)
}
if groups[2] != tt.address {
t.Errorf(`%d. want address='%s'; got '%s' for line: '%s'`, i, tt.address, groups[2], tt.line)
}
}
}