ms-runner/runner/runner_test.go

35 lines
639 B
Go
Raw Normal View History

2024-11-01 18:22:43 +00:00
//go:build wtf
2024-06-20 16:41:25 +00:00
package runner
import (
2024-11-01 18:22:43 +00:00
"testing"
2024-06-20 16:41:25 +00:00
)
type ENTestPair struct {
2024-11-01 18:22:43 +00:00
test string
result []int
2024-06-20 16:41:25 +00:00
}
2024-11-01 18:22:43 +00:00
var ENTests = []ENTestPair{
{"123", []int{123}},
{"abc123abc", []int{123}},
{"", []int{}},
{"0", []int{0}},
{"1a2a3a6", []int{1, 2, 3, 6}},
2024-06-20 16:41:25 +00:00
}
func TestExtractNumbers(t *testing.T) {
2024-11-01 18:22:43 +00:00
for _, test := range ENTests {
result := extractNumbers(test.test)
if len(result) != len(test.result) {
t.Error("for", test.test, "expected", test.result, "got", result)
}
for i := 0; i < len(result); i++ {
if result[i] != test.result[i] {
t.Error("for", test.test, "expected", test.result, "got", result)
}
}
}
2024-06-20 16:41:25 +00:00
}