(t *testing.T)
| 120 | } |
| 121 | |
| 122 | func TestInsertBefore(t *testing.T) { |
| 123 | ctx := log.Testing(t) |
| 124 | |
| 125 | for _, test := range []struct { |
| 126 | data []int |
| 127 | at int |
| 128 | val interface{} |
| 129 | expected []int |
| 130 | }{ |
| 131 | // Insertion (with: slice). |
| 132 | {[]int{1, 2, 3}, 0, []int{9}, []int{9, 1, 2, 3}}, |
| 133 | {[]int{1, 2, 3}, 1, []int{9}, []int{1, 9, 2, 3}}, |
| 134 | {[]int{1, 2, 3}, 2, []int{9}, []int{1, 2, 9, 3}}, |
| 135 | |
| 136 | // Insertion (with: element). |
| 137 | {[]int{1, 2, 3}, 0, 9, []int{9, 1, 2, 3}}, |
| 138 | {[]int{1, 2, 3}, 1, 9, []int{1, 9, 2, 3}}, |
| 139 | {[]int{1, 2, 3}, 2, 9, []int{1, 2, 9, 3}}, |
| 140 | } { |
| 141 | got := make([]int, len(test.data)) |
| 142 | copy(got, test.data) |
| 143 | slice.InsertBefore(&got, test.at, test.val) |
| 144 | assert.For(ctx, "InsertBefore(%v, %v, %v)", test.data, test.at, test.val). |
| 145 | That(got).DeepEquals(test.expected) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func TestAppend(t *testing.T) { |
| 150 | ctx := log.Testing(t) |
nothing calls this directly
no test coverage detected