aoc2024/day-17/internal/two/computer_internal_test.go

34 lines
627 B
Go
Raw Normal View History

2024-12-18 15:02:35 +00:00
package two
import (
"slices"
"testing"
)
func TestComputerRunProgram1(t *testing.T) {
tt := map[string]struct {
registers map[string]int64
program []int64
}{
"register C contains 9 with program 2,6, should set register B to 1": {
registers: map[string]int64{
"A": 117440,
"B": 0,
"C": 0,
},
program: []int64{0, 3, 5, 4, 3, 0},
},
}
c := newComputer(nil)
for name, tc := range tt {
t.Run(name, func(t *testing.T) {
c.registers = tc.registers
got := c.run(tc.program)
if !slices.Equal(got, tc.program) {
t.Errorf("output: %q, expected %q", got, tc.program)
}
})
}
}