diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-09-28 02:34:22 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-09-28 02:34:22 -0400 |
| commit | 854feb079406163a0c64978bb2c66e0f38c2a231 (patch) | |
| tree | ca6ff9be0292640aeb16242546a29b80ec820da9 | |
| parent | 2395b53df37103acdf0779f37b24cbcfcee0be6b (diff) | |
Update test to check group iterators
| -rw-r--r-- | bingo/board_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bingo/board_test.go b/bingo/board_test.go index 8d8b94f..a48eda5 100644 --- a/bingo/board_test.go +++ b/bingo/board_test.go @@ -1,13 +1,14 @@ package bingo_test import ( + "fmt" "iter" "testing" "github.com/jpappel/bingo-factory/bingo" ) -func TestRows(t *testing.T) { +func TestIters(t *testing.T) { g := bingo.Game{} testGame := func(size int, length int) { @@ -18,7 +19,9 @@ func TestRows(t *testing.T) { for i := range size { g.Board[i].Checked = false } + count := 0 for group := range iter { + fmt.Println("!") if len(group) != length { t.Logf("Mismatching %s length: %d != %d", name, length, len(group)) t.FailNow() @@ -29,7 +32,13 @@ func TestRows(t *testing.T) { t.Errorf("Incorrect value in %s!\n", name) } } + count++ } + + if count != 2 || count != size { + t.Errorf("Expected to iterate 2 or %d times, iterated %d\n", size, count) + } + for i := range size { g.Board[i].Checked = true } |
