You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
856 B

  1. package main
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestCombinations(t *testing.T) {
  7. input := map[string][]interface{}{
  8. "bool": {false, true},
  9. "int": {1, 2, 3},
  10. "string": {"foo", "bar"},
  11. }
  12. c := combinations(input)
  13. assert.Equal(t, []map[string]interface{}{
  14. {"bool": false, "int": 1, "string": "foo"},
  15. {"bool": false, "int": 1, "string": "bar"},
  16. {"bool": false, "int": 2, "string": "foo"},
  17. {"bool": false, "int": 2, "string": "bar"},
  18. {"bool": false, "int": 3, "string": "foo"},
  19. {"bool": false, "int": 3, "string": "bar"},
  20. {"bool": true, "int": 1, "string": "foo"},
  21. {"bool": true, "int": 1, "string": "bar"},
  22. {"bool": true, "int": 2, "string": "foo"},
  23. {"bool": true, "int": 2, "string": "bar"},
  24. {"bool": true, "int": 3, "string": "foo"},
  25. {"bool": true, "int": 3, "string": "bar"},
  26. }, c)
  27. }