(t *testing.B)
| 413 | } |
| 414 | |
| 415 | func Benchmark_RoutePatternMatch(t *testing.B) { |
| 416 | benchCaseFn := func(testCollection routeCaseCollection) { |
| 417 | for _, c := range testCollection.testCases { |
| 418 | // skip all cases for partial checks |
| 419 | if c.partialCheck { |
| 420 | continue |
| 421 | } |
| 422 | var matchRes bool |
| 423 | state := "match" |
| 424 | if !c.match { |
| 425 | state = "not match" |
| 426 | } |
| 427 | t.Run(testCollection.pattern+"_"+state+"_"+c.url, func(b *testing.B) { |
| 428 | for b.Loop() { |
| 429 | if match := RoutePatternMatch(c.url, testCollection.pattern); match { |
| 430 | // Get testCases from the original path |
| 431 | matchRes = true |
| 432 | } |
| 433 | } |
| 434 | require.Equal(t, c.match, matchRes, "route: '%s', url: '%s'", testCollection.pattern, c.url) |
| 435 | }) |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | for _, testCollection := range benchmarkCases { |
| 440 | benchCaseFn(testCollection) |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | func Test_Route_TooManyParams_Panic(t *testing.T) { |
| 445 | t.Parallel() |
nothing calls this directly
no test coverage detected