28 lines
449 B
Go
28 lines
449 B
Go
package cif
|
|
|
|
import "testing"
|
|
|
|
func TestParseSpeed(t *testing.T) {
|
|
testCases := []struct {
|
|
input string
|
|
expected int32
|
|
}{
|
|
{"075", 75},
|
|
{"125", 125},
|
|
{"40", 40},
|
|
{"040", 40},
|
|
{"134", 60},
|
|
{"179", 80},
|
|
{"186", 186},
|
|
{"417", 186},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
result := parseSpeed(&tc.input)
|
|
|
|
if result != tc.expected {
|
|
t.Errorf("For speed: %s, expected: %d, but got: %d", tc.input, tc.expected, result)
|
|
}
|
|
}
|
|
}
|