.examples
.github
alerting
api
client
config
controller
docs
jsonpath
metrics
pattern
pattern.go
pattern_bench_test.go
pattern_test.go
security
storage
test
testdata
watchdog
web
.dockerignore
.gitattributes
.gitignore
Dockerfile
LICENSE
Makefile
README.md
config.yaml
go.mod
go.sum
main.go
22 lines
371 B
Go
22 lines
371 B
Go
package pattern
|
|
|
|
import "testing"
|
|
|
|
func BenchmarkMatch(b *testing.B) {
|
|
for n := 0; n < b.N; n++ {
|
|
if !Match("*ing*", "livingroom") {
|
|
b.Error("should've matched")
|
|
}
|
|
}
|
|
b.ReportAllocs()
|
|
}
|
|
|
|
func BenchmarkMatchWithBackslash(b *testing.B) {
|
|
for n := 0; n < b.N; n++ {
|
|
if !Match("*ing*", "living\\room") {
|
|
b.Error("should've matched")
|
|
}
|
|
}
|
|
b.ReportAllocs()
|
|
}
|