2017-day9: balanced parens with a twist

This commit is contained in:
alexchao26
2020-12-14 20:20:17 -05:00
parent 1878c6c91c
commit 0bc9afb7e0
2 changed files with 85 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package main
import (
"testing"
"github.com/alexchao26/advent-of-code-go/util"
)
func Test_streamProcessing(t *testing.T) {
tests := []struct {
name string
input string
part int
want int
}{
{"part1_example 1", "{}", 1, 1},
{"part1_example 2", "{{}}", 1, 3},
{"part1_example 1", "{{}, {}}", 1, 5},
{"part1_example 1", "{{},<aksdljfsd!<> {}}", 1, 5},
{"part1_actual", util.ReadFile("input.txt"), 1, 16021},
{"part2_actual", util.ReadFile("input.txt"), 2, 7685},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := streamProcessing(tt.input, tt.part); got != tt.want {
t.Errorf("streamProcessing() = %v, want %v", got, tt.want)
}
})
}
}