(b *testing.B)
| 172 | } |
| 173 | |
| 174 | func BenchmarkEncodeSliceInterface(b *testing.B) { |
| 175 | val := []any{"foo", "bar"} |
| 176 | sig := SignatureOf(val) |
| 177 | buf := &bytes.Buffer{} |
| 178 | fds := make([]int, 0) |
| 179 | |
| 180 | b.ReportAllocs() |
| 181 | b.ResetTimer() |
| 182 | for n := 0; n < b.N; n++ { |
| 183 | buf.Reset() |
| 184 | |
| 185 | enc := newEncoder(buf, binary.LittleEndian, fds) |
| 186 | err := enc.Encode(val) |
| 187 | if err != nil { |
| 188 | b.Fatal(err) |
| 189 | } |
| 190 | |
| 191 | dec := newDecoder(buf, binary.LittleEndian, enc.fds) |
| 192 | _, err = dec.Decode(sig) |
| 193 | if err != nil { |
| 194 | b.Fatal(err) |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | func TestEncodeSliceNamedInterface(t *testing.T) { |
| 200 | val := []empty{"foo", "bar"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…