test: add unit tests for part two

This commit is contained in:
2025-12-22 10:55:51 +01:00
parent cc29b51c3a
commit 09176fad28

View File

@@ -39,3 +39,46 @@ func TestPartOne(t *testing.T) {
})
}
}
func TestPartTwo(t *testing.T) {
tests := []struct {
name string
input int
expected int
}{
{
name: "input 1 returns first value larger than 1",
input: 1,
expected: 2,
},
{
name: "input 2 returns first value larger than 2",
input: 2,
expected: 4,
},
{
name: "input 4 returns first value larger than 4",
input: 4,
expected: 5,
},
{
name: "input 5 returns first value larger than 5",
input: 5,
expected: 10,
},
{
name: "input 747 returns first value larger than 747",
input: 747,
expected: 806,
},
}
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)
}
})
}
}