1
0
Fork 0
mirror of https://github.com/Luzifer/aoc2019.git synced 2024-12-22 05:51:16 +00:00
aoc2019/helpers_test.go
Knut Ahlers ef7a1c5e33
Add solution for Day 3
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2019-12-03 17:14:23 +01:00

16 lines
361 B
Go

package aoc2019
import "testing"
func TestManhattenDistance(t *testing.T) {
for expDist, p := range map[int][4]int{
2: {0, 0, 0, 2},
3: {0, 0, 3, 0},
6: {-3, 0, 3, 0},
7: {-3, 0, 0, 4},
} {
if dist := manhattenDistance(p[0], p[1], p[2], p[3]); dist != expDist {
t.Errorf("Unexpected distance for %+v: exp=%d got=%d", p, expDist, dist)
}
}
}