mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-15 23:20:49 +00:00
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestIsValidGame(t *testing.T) {
|
||
|
//t.Skip("skipping test")
|
||
|
game1 := "3 blue, 4 red; 1 red, 2 green, 6 blue; 2 green"
|
||
|
game2 := "1 blue, 2 green; 3 green, 4 blue, 1 red; 1 green, 1 blue"
|
||
|
game3 := "8 green, 6 blue, 20 red; 5 blue, 4 red, 13 green; 5 green, 1 red"
|
||
|
game4 := "1 green, 3 red, 6 blue; 3 green, 6 red; 3 green, 15 blue, 14 red"
|
||
|
game5 := "6 red, 1 blue, 3 green; 2 blue, 1 red, 2 green"
|
||
|
isValid1, _ := isValidGame(game1)
|
||
|
isValid2, _ := isValidGame(game2)
|
||
|
isValid3, _ := isValidGame(game3)
|
||
|
isValid4, _ := isValidGame(game4)
|
||
|
isValid5, _ := isValidGame(game5)
|
||
|
|
||
|
t.Run("Should be a valid game", func(t *testing.T) {
|
||
|
assert.Equal(t, true, isValid1)
|
||
|
})
|
||
|
|
||
|
t.Run("Should be a valid game", func(t *testing.T) {
|
||
|
assert.Equal(t, true, isValid2)
|
||
|
})
|
||
|
|
||
|
t.Run("Should not be a valid game", func(t *testing.T) {
|
||
|
assert.Equal(t, false, isValid3)
|
||
|
})
|
||
|
|
||
|
t.Run("Should not be a valid game", func(t *testing.T) {
|
||
|
assert.Equal(t, false, isValid4)
|
||
|
})
|
||
|
|
||
|
t.Run("Should be a valid game", func(t *testing.T) {
|
||
|
assert.Equal(t, true, isValid5)
|
||
|
})
|
||
|
}
|