simulator_test.go 708 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/stretchr/testify/assert"
  5. "testing"
  6. )
  7. func TestSimulation_Run(t *testing.T) {
  8. type fields struct {
  9. Game *Game
  10. }
  11. tests := []struct {
  12. name string
  13. fields fields
  14. wantErr assert.ErrorAssertionFunc
  15. }{
  16. {
  17. name: "simple words",
  18. fields: fields{
  19. Game: &Game{
  20. Words: map[string]*Word{
  21. "aaa": {Word: "aaa"},
  22. "aab": {Word: "aab"},
  23. "abb": {Word: "abb"},
  24. },
  25. },
  26. },
  27. wantErr: assert.NoError,
  28. },
  29. }
  30. for _, tt := range tests {
  31. t.Run(tt.name, func(t *testing.T) {
  32. s := Simulation{
  33. Game: tt.fields.Game,
  34. }
  35. tt.wantErr(t, s.SimulateAllPossibleGames(), fmt.Sprintf("SimulateAllPossibleGames()"))
  36. })
  37. }
  38. }