committed by
GitHub
parent
b0ac74488c
commit
cde7e9483b
25
pass/isa_test.go
Normal file
25
pass/isa_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package pass
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/mmcloughlin/avo/ir"
|
||||
)
|
||||
|
||||
func TestRequiredISAExtensions(t *testing.T) {
|
||||
f := ir.NewFunction("ISAs")
|
||||
f.AddInstruction(&ir.Instruction{ISA: nil})
|
||||
f.AddInstruction(&ir.Instruction{ISA: []string{"B", "A"}})
|
||||
f.AddInstruction(&ir.Instruction{ISA: []string{"A", "C"}})
|
||||
|
||||
err := RequiredISAExtensions(f)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
expect := []string{"A", "B", "C"}
|
||||
if !reflect.DeepEqual(f.ISA, expect) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user