diff --git a/internal/2015/DayFour/code_test.go b/internal/2015/DayFour/code_test.go new file mode 100644 index 0000000..f147b15 --- /dev/null +++ b/internal/2015/DayFour/code_test.go @@ -0,0 +1,45 @@ +package dayfour + +import ( + "testing" +) + +func TestPartOne(t *testing.T) { + tests := []struct { + name string + input []byte + expected int + }{ + {"abcdef", []byte("abcdef"), 609043}, + {"pqrstuv", []byte("pqrstuv"), 1048970}, + } + + 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) + } + }) + } +} + +func TestPartTwo(t *testing.T) { + tests := []struct { + name string + input []byte + expected int + }{ + {"abcdef", []byte("abcdef"), 6742839}, + {"pqrstuv", []byte("pqrstuv"), 5714438}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := PartTwo(tt.input) + if got != tt.expected { + t.Errorf("PartTwo() = %d, want %d", got, tt.expected) + } + }) + } +}