mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-08-11 17:50:58 +00:00
matrix is done
Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
parent
12ac03a755
commit
33f5b5416c
8 changed files with 219 additions and 46 deletions
28
act/common/cartesian_test.go
Normal file
28
act/common/cartesian_test.go
Normal 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")
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue