aoc21/d2/d2_test.go

34 lines
341 B
Go
Raw Normal View History

2022-02-07 22:00:52 +02:00
package d2
import (
"testing"
"github.com/stretchr/testify/assert"
)
2022-02-21 22:28:30 +02:00
func TestP1(t *testing.T) {
2022-02-07 22:00:52 +02:00
input := `
forward 5
down 5
forward 8
up 3
down 8
forward 2`
2022-02-21 22:28:30 +02:00
assert.EqualValues(t, 150, P1(input))
2022-02-07 22:00:52 +02:00
}
2022-02-08 21:38:18 +02:00
2022-02-21 22:28:30 +02:00
func TestP2(t *testing.T) {
2022-02-08 21:38:18 +02:00
input := `
forward 5
down 5
forward 8
up 3
down 8
forward 2`
2022-02-21 22:28:30 +02:00
assert.EqualValues(t, 900, P2(input))
2022-02-08 21:38:18 +02:00
}