x86: rel types and generated tests

This commit is contained in:
Michael McLoughlin
2018-11-27 22:08:11 -08:00
parent 3881907ec8
commit 4395adacc8
13 changed files with 18188 additions and 19 deletions

46
internal/gen/util_test.go Normal file
View 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")
}
}