File: utils_benchmark_test.go

package info (click to toggle)
golang-github-asaskevich-govalidator 9%2Bgit20180720.0.f9ffefc3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, experimental
  • size: 344 kB
  • sloc: makefile: 4
file content (17 lines) | stat: -rw-r--r-- 353 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package govalidator

import "testing"

func BenchmarkContains(b *testing.B) {
	b.ResetTimer()
	for n := 0; n < b.N; n++ {
		Contains("a0b01c012deffghijklmnopqrstu0123456vwxyz", "0123456789")
	}
}

func BenchmarkMatches(b *testing.B) {
	b.ResetTimer()
	for n := 0; n < b.N; n++ {
		Matches("alfkjl12309fdjldfsa209jlksdfjLAKJjs9uJH234", "[\\w\\d]+")
	}
}