-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14_test.go
43 lines (36 loc) · 827 Bytes
/
14_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import "testing"
func TestAOC202214Part1(t *testing.T) {
test := struct {
input string
output int
}{
input: `498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9`,
output: 24,
}
got, err := AOC2022141Helper(test.input)
if err != nil {
t.Fatalf("AOC202214Helper() err: %v", err)
}
if got != test.output {
t.Errorf("AOC202214Helper() missmatch:\nwant: %d\ngot: %d", test.output, got)
}
}
func TestAOC202214Part2(t *testing.T) {
test := struct {
input string
output int
}{
input: `498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9`,
output: 93,
}
got, err := AOC2022142Helper(test.input)
if err != nil {
t.Fatalf("AOC202214Helper() err: %v", err)
}
if got != test.output {
t.Errorf("AOC202214Helper() missmatch:\nwant: %d\ngot: %d", test.output, got)
}
}