]> fbox.kageds.com Git - adventofcode.git/blob - 2022/go/day07/day07_test.go
Day_1
[adventofcode.git] / 2022 / go / day07 / day07_test.go
1 package day07
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/require"
7 )
8
9 func TestPart1(t *testing.T) {
10 r := Part1(
11 `$ cd /
12 $ ls
13 dir a
14 14848514 b.txt
15 8504156 c.dat
16 dir d
17 $ cd a
18 $ ls
19 dir e
20 29116 f
21 2557 g
22 62596 h.lst
23 $ cd e
24 $ ls
25 584 i
26 $ cd ..
27 $ cd ..
28 $ cd d
29 $ ls
30 4060174 j
31 8033020 d.log
32 5626152 d.ext
33 7214296 k`)
34 require.Equal(t, 95437, r)
35 }
36
37 func TestPart2(t *testing.T) {
38 r := Part2(
39 `$ cd /
40 $ ls
41 dir a
42 14848514 b.txt
43 8504156 c.dat
44 dir d
45 $ cd a
46 $ ls
47 dir e
48 29116 f
49 2557 g
50 62596 h.lst
51 $ cd e
52 $ ls
53 584 i
54 $ cd ..
55 $ cd ..
56 $ cd d
57 $ ls
58 4060174 j
59 8033020 d.log
60 5626152 d.ext
61 7214296 k`)
62 require.Equal(t, 24933642, r)
63 }