photoprism/pkg/rnd/passcode_test.go

22 lines
350 B
Go
Raw Normal View History

package rnd
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGeneratePasscode(t *testing.T) {
for n := 0; n < 10; n++ {
code := GeneratePasscode()
t.Logf("Passcode %d: %s", n, code)
assert.Equal(t, 19, len(code))
}
}
func BenchmarkGeneratePasscode(b *testing.B) {
for n := 0; n < b.N; n++ {
GeneratePasscode()
}
}