matrix is done

Signed-off-by: Casey Lee <[email protected]>
This commit is contained in:
Casey Lee committed 2020-02-20 21:06:03 -05:00
1 parent 5b7019cd0b
commit f8fb88816a
8 files changed
+219 -46

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package common
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCartisianProduct(t *testing.T) {
assert := assert.New(t)
input := map[string][]interface{}{
"foo": []interface{}{1, 2, 3, 4},
"bar": []interface{}{"a", "b", "c"},
"baz": []interface{}{false, true},
}
output := CartesianProduct(input)
assert.Len(output, 24)
for _, v := range output {
assert.Len(v, 3)
assert.Contains(v, "foo")
assert.Contains(v, "bar")
assert.Contains(v, "baz")
}
}