all repos — captcha @ b9845ccf32c801cd41486d4ae298b60dfc68fee5

Go package captcha implements generation and verification of image and audio CAPTCHAs.

audio_test.go (view raw)

 1package captcha
 2
 3import "testing"
 4
 5func BenchmarkNewAudio(b *testing.B) {
 6	b.StopTimer()
 7	d := RandomDigits(DefaultLen)
 8	b.StartTimer()
 9	for i := 0; i < b.N; i++ {
10		NewAudio(d)
11	}
12}
13
14func BenchmarkAudioWriteTo(b *testing.B) {
15	b.StopTimer()
16	d := RandomDigits(DefaultLen)
17	b.StartTimer()
18	for i := 0; i < b.N; i++ {
19		a := NewAudio(d)
20		a.WriteTo(devNull{}) //TODO(dchest): use ioutil.Discard when its available
21	}
22}