photoprism/pkg/rnd/uuid_test.go
letreturn c57cacb834
Benchmarks: Use b.Loop() to simplify the code and enhance performance #5226
Signed-off-by: letreturn <letreturn@outlook.com>
2025-10-02 17:00:13 +02:00

29 lines
414 B
Go

package rnd
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUUID(t *testing.T) {
for n := 0; n < 5; n++ {
s := UUID()
t.Logf("UUID %d: %s", n, s)
assert.Equal(t, 36, len(s))
}
}
func BenchmarkUUID(b *testing.B) {
for b.Loop() {
UUID()
}
}
func TestState(t *testing.T) {
for n := 0; n < 5; n++ {
s := State()
t.Logf("UUID %d: %s", n, s)
assert.Equal(t, 36, len(s))
}
}