github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/crypto/bip39/bench_test.go (about) 1 package bip39 2 3 import "testing" 4 5 var words = []string{ 6 "wolf afraid artwork blanket carpet cricket wolf afraid artwork blanket carpet cricket", 7 "artwork blanket carpet cricket disorder disorder artwork blanket carpet cricket disorder disorder", 8 "carpet cricket disorder cricket cricket artwork carpet cricket disorder cricket cricket artwork ", 9 } 10 11 func BenchmarkIsMnemonicValid(b *testing.B) { 12 b.ReportAllocs() 13 var sharp interface{} 14 for i := 0; i < b.N; i++ { 15 for _, word := range words { 16 ok := IsMnemonicValid(word) 17 if !ok { 18 b.Fatal("returned false") 19 } 20 sharp = ok 21 } 22 } 23 if sharp == nil { 24 b.Fatal("benchmark was not run") 25 } 26 }