]> fbox.kageds.com Git - adventofcode.git/blob - 2023/go/day05/day05_test.go
Day 6
[adventofcode.git] / 2023 / go / day05 / day05_test.go
1 package day05
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/require"
7 )
8
9 func TestPart1(t *testing.T) {
10 r := Part1(
11 `seeds: 79 14 55 13
12
13 seed-to-soil map:
14 50 98 2
15 52 50 48
16
17 soil-to-fertilizer map:
18 0 15 37
19 37 52 2
20 39 0 15
21
22 fertilizer-to-water map:
23 49 53 8
24 0 11 42
25 42 0 7
26 57 7 4
27
28 water-to-light map:
29 88 18 7
30 18 25 70
31
32 light-to-temperature map:
33 45 77 23
34 81 45 19
35 68 64 13
36
37 temperature-to-humidity map:
38 0 69 1
39 1 0 69
40
41 humidity-to-location map:
42 60 56 37
43 56 93 4`)
44 require.Equal(t, 35, r)
45 }
46
47 func TestPart2(t *testing.T) {
48 r := Part2(
49 `seeds: 79 14 55 13
50
51 seed-to-soil map:
52 50 98 2
53 52 50 48
54
55 soil-to-fertilizer map:
56 0 15 37
57 37 52 2
58 39 0 15
59
60 fertilizer-to-water map:
61 49 53 8
62 0 11 42
63 42 0 7
64 57 7 4
65
66 water-to-light map:
67 88 18 7
68 18 25 70
69
70 light-to-temperature map:
71 45 77 23
72 81 45 19
73 68 64 13
74
75 temperature-to-humidity map:
76 0 69 1
77 1 0 69
78
79 humidity-to-location map:
80 60 56 37
81 56 93 4`)
82 require.Equal(t, 46, r)
83 }