mirror of
https://github.com/onyx-and-iris/aoc2023.git
synced 2024-11-24 19:30:48 +00:00
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPowerForGame(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"
|
|
|
|
power1, _ := powerForGame(game1)
|
|
power2, _ := powerForGame(game2)
|
|
power3, _ := powerForGame(game3)
|
|
power4, _ := powerForGame(game4)
|
|
power5, _ := powerForGame(game5)
|
|
|
|
t.Run("Should have power value 48", func(t *testing.T) {
|
|
assert.Equal(t, 48, power1)
|
|
})
|
|
|
|
t.Run("Should have power value 12", func(t *testing.T) {
|
|
assert.Equal(t, 12, power2)
|
|
})
|
|
|
|
t.Run("Should have power value 1560", func(t *testing.T) {
|
|
assert.Equal(t, 1560, power3)
|
|
})
|
|
|
|
t.Run("Should have power value 630", func(t *testing.T) {
|
|
assert.Equal(t, 630, power4)
|
|
})
|
|
|
|
t.Run("Should have power value 36", func(t *testing.T) {
|
|
assert.Equal(t, 36, power5)
|
|
})
|
|
}
|