x86: rel types and generated tests
This commit is contained in:
46
internal/gen/util_test.go
Normal file
46
internal/gen/util_test.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package gen
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCross(t *testing.T) {
|
||||
x := [][]string{
|
||||
{"a", "b", "c"},
|
||||
{"1", "2"},
|
||||
{"!", "?"},
|
||||
}
|
||||
expect := [][]string{
|
||||
{"a", "1", "!"},
|
||||
{"a", "1", "?"},
|
||||
{"a", "2", "!"},
|
||||
{"a", "2", "?"},
|
||||
{"b", "1", "!"},
|
||||
{"b", "1", "?"},
|
||||
{"b", "2", "!"},
|
||||
{"b", "2", "?"},
|
||||
{"c", "1", "!"},
|
||||
{"c", "1", "?"},
|
||||
{"c", "2", "!"},
|
||||
{"c", "2", "?"},
|
||||
}
|
||||
got := cross(x)
|
||||
if !reflect.DeepEqual(got, expect) {
|
||||
t.Errorf("bad cross product")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCrossSimple(t *testing.T) {
|
||||
x := [][]string{
|
||||
{"a", "b"},
|
||||
}
|
||||
expect := [][]string{
|
||||
{"a"},
|
||||
{"b"},
|
||||
}
|
||||
got := cross(x)
|
||||
if !reflect.DeepEqual(got, expect) {
|
||||
t.Errorf("bad cross product")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user