-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path15_test.go
46 lines (40 loc) · 1.34 KB
/
15_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
44
45
46
package main
import "testing"
func TestAOC202215(t *testing.T) {
test := struct {
input string
first int
second int
}{
input: `Sensor at x=2, y=18: closest beacon is at x=-2, y=15
Sensor at x=9, y=16: closest beacon is at x=10, y=16
Sensor at x=13, y=2: closest beacon is at x=15, y=3
Sensor at x=12, y=14: closest beacon is at x=10, y=16
Sensor at x=10, y=20: closest beacon is at x=10, y=16
Sensor at x=14, y=17: closest beacon is at x=10, y=16
Sensor at x=8, y=7: closest beacon is at x=2, y=10
Sensor at x=2, y=0: closest beacon is at x=2, y=10
Sensor at x=0, y=11: closest beacon is at x=2, y=10
Sensor at x=20, y=14: closest beacon is at x=25, y=17
Sensor at x=17, y=20: closest beacon is at x=21, y=22
Sensor at x=16, y=7: closest beacon is at x=15, y=3
Sensor at x=14, y=3: closest beacon is at x=15, y=3
Sensor at x=20, y=1: closest beacon is at x=15, y=3`,
first: 26,
second: 56000011,
}
got, err := AOC2022151Helper(test.input, 10)
if err != nil {
t.Fatalf("AOC2022151Helper() err: %v", err)
}
if got != test.first {
t.Errorf("AOC2022151Helper() missmatch:\nwant: %d\ngot: %d", test.first, got)
}
got, err = AOC2022152Helper(test.input, 0, 20)
if err != nil {
t.Fatalf("AOC2022152Helper() err: %v", err)
}
if got != test.second {
t.Errorf("AOC2022152Helper() missmatch:\nwant: %d\ngot: %d", test.second, got)
}
}