git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/validate/utils_benchmark_test.go (about)

     1  package validate
     2  
     3  import "testing"
     4  
     5  func BenchmarkContains(b *testing.B) {
     6  	b.ResetTimer()
     7  	for n := 0; n < b.N; n++ {
     8  		Contains("a0b01c012deffghijklmnopqrstu0123456vwxyz", "0123456789")
     9  	}
    10  }
    11  
    12  func BenchmarkMatches(b *testing.B) {
    13  	b.ResetTimer()
    14  	for n := 0; n < b.N; n++ {
    15  		Matches("alfkjl12309fdjldfsa209jlksdfjLAKJjs9uJH234", "[\\w\\d]+")
    16  	}
    17  }