(t *testing.T)
| 24 | } |
| 25 | |
| 26 | func TestConvertStringToInt(t *testing.T) { |
| 27 | t.Parallel() |
| 28 | input := []string{"1", "2", "3", "4", "5"} |
| 29 | expected := []int{1, 2, 3, 4, 5} |
| 30 | result := Convert(input, func(s string) int { |
| 31 | n, _ := strconv.Atoi(s) |
| 32 | return n |
| 33 | }) |
| 34 | |
| 35 | if len(result) != len(expected) { |
| 36 | t.Errorf("Expected length %d, got %d", len(expected), len(result)) |
| 37 | } |
| 38 | |
| 39 | for i := range expected { |
| 40 | if result[i] != expected[i] { |
| 41 | t.Errorf("At index %d: expected %v, got %v", i, expected[i], result[i]) |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func TestConvertFloatToInt(t *testing.T) { |
| 47 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…