1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 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()
}
}
|