2020-day18: refactor to slightly nicer stack implementation, still str <-> int conversions everywhere...

This commit is contained in:
alexchao26
2020-12-18 19:36:19 -05:00
parent a5e3c80111
commit 6c83ac5e5a
2 changed files with 81 additions and 99 deletions
+6 -6
View File
@@ -43,7 +43,7 @@ func Test_part2(t *testing.T) {
}
}
func Test_handleFlat(t *testing.T) {
func Test_calcFlatSlicePart2(t *testing.T) {
type args struct {
input []string
}
@@ -52,16 +52,16 @@ func Test_handleFlat(t *testing.T) {
args args
want string
}{
{"example", args{
input: []string{"1", "+", "3", "*", "4", "+", "5"},
},
{
"example",
args{input: []string{"1", "+", "3", "*", "4", "+", "5"}},
"36",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := handleFlat(tt.args.input); !reflect.DeepEqual(got, tt.want) {
t.Errorf("handleFlat() = %v, want %v", got, tt.want)
if got := calcFlatSlicePart2(tt.args.input); !reflect.DeepEqual(got, tt.want) {
t.Errorf("calcFlatSlicePart2() = %v, want %v", got, tt.want)
}
})
}