(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestReduce(t *testing.T) { |
| 103 | arr := []string{"cat", "dog", "cat", "cow"} |
| 104 | initialState := make(map[string]int) |
| 105 | finalState := Reduce(arr, countAnimals, initialState) |
| 106 | expected := map[string]int{ |
| 107 | "cat": 2, |
| 108 | "dog": 1, |
| 109 | "cow": 1, |
| 110 | } |
| 111 | |
| 112 | if !reflect.DeepEqual(finalState, expected) { |
| 113 | t.Errorf("expected %v, received %v", expected, finalState) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func guard(i int) bool { |
| 118 | return i%2 == 0 |
nothing calls this directly
no test coverage detected
searching dependent graphs…