Signed-off-by: Casey Lee <cplee@nektos.com>
Tento commit je obsažen v:
Casey Lee
2020-02-17 10:11:16 -08:00
rodič 5b7019cd0b
revize f8fb88816a
8 změnil soubory, kde provedl 219 přidání a 46 odebrání

28
pkg/common/cartesian_test.go Normální soubor
Zobrazit soubor

@@ -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")
}
}