day 12 memo hurting my brain

This commit is contained in:
alexchao26
2024-08-01 16:54:28 -04:00
parent e915846f02
commit 57eae313ea
2 changed files with 325 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
package main
import (
"testing"
)
var example = `???.### 1,1,3
.??..??...?##. 1,1,3
?#?#?#?#?#?#?#? 1,3,1,6
????.#...#... 4,1,1
????.######..#####. 1,6,5
?###???????? 3,2,1`
func Test_part1(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{
name: "example",
input: example,
want: 21,
},
{
name: "actual",
input: input,
want: 7792,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part1(tt.input); got != tt.want {
t.Errorf("part1() = %v, want %v", got, tt.want)
}
})
}
}
func Test_part2(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
{
name: "example",
input: example,
want: 525152,
},
{
name: "actual",
input: input,
want: 13012052341533,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part2(tt.input); got != tt.want {
t.Errorf("part2() = %v, want %v", got, tt.want)
}
})
}
}