You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
977 B
Go
57 lines
977 B
Go
package day6
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestRaceWinsCount(t *testing.T) {
|
|
lines := []string{
|
|
"Time: 7 15 30",
|
|
"Distance: 9 40 200",
|
|
}
|
|
|
|
result := RaceWinsCount(lines)
|
|
|
|
if result != 288 {
|
|
t.Fatalf("expected 288, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestRaceWinsCountWithInput(t *testing.T) {
|
|
lines := []string{
|
|
"Time: 54 81 70 88",
|
|
"Distance: 446 1292 1035 1007",
|
|
}
|
|
result := RaceWinsCount(lines)
|
|
|
|
if result != 2065338 {
|
|
t.Fatalf("expected 2065338, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestRaceWinsCount2(t *testing.T) {
|
|
lines := []string{
|
|
"Time: 71530",
|
|
"Distance: 940200",
|
|
}
|
|
|
|
result := RaceWinsCount(lines)
|
|
|
|
if result != 71503 {
|
|
t.Fatalf("expected 71503, got %v", result)
|
|
}
|
|
}
|
|
|
|
func TestRaceWinsCountWithInput2(t *testing.T) {
|
|
lines := []string{
|
|
"Time: 54817088",
|
|
"Distance: 446129210351007",
|
|
}
|
|
|
|
result := RaceWinsCount(lines)
|
|
|
|
if result != 34934171 {
|
|
t.Fatalf("expected 34934171, got %v", result)
|
|
}
|
|
}
|