MCPcopy Create free account
hub / github.com/maruel/panicparse / BenchmarkScanSnapshot_Passthru

Function BenchmarkScanSnapshot_Passthru

stack/context_test.go:2217–2245  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

2215}
2216
2217func BenchmarkScanSnapshot_Passthru(b *testing.B) {
2218 b.ReportAllocs()
2219 buf := make([]byte, b.N)
2220 for i := range buf {
2221 buf[i] = 'i'
2222 if i%16 == 0 {
2223 buf[i] = '\n'
2224 }
2225 }
2226 prefix := bytes.Buffer{}
2227 prefix.Grow(len(buf))
2228 r := bytes.NewReader(buf)
2229 opts := defaultOpts()
2230 b.ResetTimer()
2231 s, suffix, err := ScanSnapshot(r, &prefix, opts)
2232 if err != io.EOF {
2233 b.Fatal(err)
2234 }
2235 if s != nil {
2236 b.Fatalf("unexpected %v", s)
2237 }
2238 b.StopTimer()
2239 if !bytes.Equal(prefix.Bytes(), buf) {
2240 b.Fatal("unexpected prefix")
2241 }
2242 if len(suffix) != 0 {
2243 b.Fatal("unexpected suffix")
2244 }
2245}
2246
2247//
2248

Callers

nothing calls this directly

Calls 2

defaultOptsFunction · 0.85
ScanSnapshotFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…