diff --git a/internal/2016/DayOne/code_test.go b/internal/2016/DayOne/code_test.go new file mode 100644 index 0000000..9ef3749 --- /dev/null +++ b/internal/2016/DayOne/code_test.go @@ -0,0 +1,38 @@ +package dayone + +import ( + "testing" +) + +func TestPartOne(t *testing.T) { + tests := []struct { + name string + input []string + expected int + }{ + { + name: "Example 1", + input: []string{"R2", "L3"}, + expected: 5, + }, + { + name: "Example 2", + input: []string{"R2", "R2", "R2"}, + expected: 2, + }, + { + name: "Example 3", + input: []string{"R5", "L5", "R5", "R3"}, + expected: 12, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := PartOne(tt.input) + if got != tt.expected { + t.Errorf("PartOne() = %d, want %d", got, tt.expected) + } + }) + } +}