Files
mtusi2026lab7-fork/src/backend/services/password_bench_test.go
T

20 lines
392 B
Go

package services
import "testing"
func BenchmarkPasswordVerification(b *testing.B) {
const password = "synthetic-benchmark-password"
hash, err := HashPassword(password)
if err != nil {
b.Fatal(err)
}
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
ok, err := VerifyPassword(password, hash)
if err != nil || !ok {
b.Fatalf("verification failed: %v", err)
}
}
}