Skip to content

Commit

Permalink
golang: remove copy-paste from benchmark test
Browse files Browse the repository at this point in the history
  • Loading branch information
starius committed Apr 4, 2024
1 parent c402815 commit 0bc397e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ func TestPatterns(t *testing.T) {
}
}

const userAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Google-PageRenderer Google (+https://developers.google.com/+/web/snippet/)"

func BenchmarkIsCrawler(b *testing.B) {
userAgent := "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Google-PageRenderer Google (+https://developers.google.com/+/web/snippet/)"
b.SetBytes(int64(len(userAgent)))
for n := 0; n < b.N; n++ {
IsCrawler(userAgent)
}
}

func BenchmarkMatchingCrawlers(b *testing.B) {
userAgent := "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 Google-PageRenderer Google (+https://developers.google.com/+/web/snippet/)"
b.SetBytes(int64(len(userAgent)))
for n := 0; n < b.N; n++ {
MatchingCrawlers(userAgent)
Expand Down

0 comments on commit 0bc397e

Please sign in to comment.