go test -v -run=^$ -bench=Benchmark_Communication_Flow -benchmem -count=4
(b *testing.B)
| 3289 | |
| 3290 | // go test -v -run=^$ -bench=Benchmark_Communication_Flow -benchmem -count=4 |
| 3291 | func Benchmark_Communication_Flow(b *testing.B) { |
| 3292 | app := New() |
| 3293 | |
| 3294 | app.Get("/", func(c Ctx) error { |
| 3295 | return c.SendString("Hello, World!") |
| 3296 | }) |
| 3297 | |
| 3298 | h := app.Handler() |
| 3299 | |
| 3300 | fctx := &fasthttp.RequestCtx{} |
| 3301 | fctx.Request.Header.SetMethod(MethodGet) |
| 3302 | fctx.Request.SetRequestURI("/") |
| 3303 | |
| 3304 | b.ReportAllocs() |
| 3305 | |
| 3306 | for b.Loop() { |
| 3307 | h(fctx) |
| 3308 | } |
| 3309 | |
| 3310 | require.Equal(b, 200, fctx.Response.Header.StatusCode()) |
| 3311 | require.Equal(b, "Hello, World!", string(fctx.Response.Body())) |
| 3312 | } |
| 3313 | |
| 3314 | func Benchmark_Communication_Flow_Parallel(b *testing.B) { |
| 3315 | app := New() |
nothing calls this directly
no test coverage detected
searching dependent graphs…