timetable-mgr/cif/convert_test.go

28 lines
449 B
Go
Raw Normal View History

package cif
import "testing"
func TestParseSpeed(t *testing.T) {
testCases := []struct {
2024-04-07 21:28:48 +01:00
input string
expected int32
}{
2024-04-07 21:28:48 +01:00
{"075", 75},
{"125", 125},
{"40", 40},
{"040", 40},
{"134", 60},
{"179", 80},
{"186", 186},
{"417", 186},
}
for _, tc := range testCases {
2024-04-07 21:28:48 +01:00
result := parseSpeed(&tc.input)
if result != tc.expected {
t.Errorf("For speed: %s, expected: %d, but got: %d", tc.input, tc.expected, result)
}
}
}