(b *testing.B)
| 485 | } |
| 486 | |
| 487 | func BenchmarkTreeGet(b *testing.B) { |
| 488 | h1 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 489 | h2 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) |
| 490 | |
| 491 | tr := &node{} |
| 492 | tr.InsertRoute(mGET, "/", h1) |
| 493 | tr.InsertRoute(mGET, "/ping", h2) |
| 494 | tr.InsertRoute(mGET, "/pingall", h2) |
| 495 | tr.InsertRoute(mGET, "/ping/{id}", h2) |
| 496 | tr.InsertRoute(mGET, "/ping/{id}/woop", h2) |
| 497 | tr.InsertRoute(mGET, "/ping/{id}/{opt}", h2) |
| 498 | tr.InsertRoute(mGET, "/pinggggg", h2) |
| 499 | tr.InsertRoute(mGET, "/hello", h1) |
| 500 | |
| 501 | mctx := NewRouteContext() |
| 502 | |
| 503 | b.ReportAllocs() |
| 504 | b.ResetTimer() |
| 505 | |
| 506 | for i := 0; i < b.N; i++ { |
| 507 | mctx.Reset() |
| 508 | tr.FindRoute(mctx, mGET, "/ping/123/456") |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | func TestWalker(t *testing.T) { |
| 513 | r := bigMux() |
nothing calls this directly
no test coverage detected