MCPcopy Create free account
hub / github.com/google/gapid / TestAppend

Function TestAppend

core/data/slice/slice_test.go:149–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestAppend(t *testing.T) {
150 ctx := log.Testing(t)
151
152 for _, test := range []struct {
153 data []int
154 val interface{}
155 expected []int
156 }{
157 // Insertion (with: slice).
158 {[]int{1, 2, 3}, []int{7, 8, 9}, []int{1, 2, 3, 7, 8, 9}},
159 {[]int{1, 2, 3}, []int{9}, []int{1, 2, 3, 9}},
160
161 // Insertion (with: element).
162 {[]int{1, 2, 3}, 9, []int{1, 2, 3, 9}},
163 } {
164 got := make([]int, len(test.data))
165 copy(got, test.data)
166 slice.Append(&got, test.val)
167 assert.For(ctx, "Append(%v, %v)", test.data, test.val).
168 That(got).DeepEquals(test.expected)
169 }
170}
171
172func TestReverse(t *testing.T) {
173 ctx := log.Testing(t)

Callers

nothing calls this directly

Calls 4

ThatMethod · 0.80
ForMethod · 0.80
AppendMethod · 0.45
DeepEqualsMethod · 0.45

Tested by

no test coverage detected