Typed operands
This commit is contained in:
35
test/asm_test.go
Normal file
35
test/asm_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package test
|
||||
|
||||
import "testing"
|
||||
|
||||
import "github.com/firestuff/subcoding/asm"
|
||||
|
||||
func TestTooManyOperands(t *testing.T) {
|
||||
_, err := asm.AssembleString(`
|
||||
functions:
|
||||
- - [nop, 0]
|
||||
`)
|
||||
if err == nil {
|
||||
t.Fatal("Lack of error when passing operand to nop")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTooFewOperands(t *testing.T) {
|
||||
_, err := asm.AssembleString(`
|
||||
functions:
|
||||
- - [mov, g0]
|
||||
`)
|
||||
if err == nil {
|
||||
t.Fatal("Lack of error when passing only one operand to mov")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIncorrectSigned(t *testing.T) {
|
||||
_, err := asm.AssembleString(`
|
||||
functions:
|
||||
- - [ltu, 0, -1]
|
||||
`)
|
||||
if err == nil {
|
||||
t.Fatal("Lack of error when passing signed value to ltu")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user