MCPcopy Index your code
hub / github.com/coder/coder / BenchmarkGenerateDeterministicKey

Function BenchmarkGenerateDeterministicKey

agent/agentrsa/key_test.go:25–38  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

23var result *rsa.PrivateKey
24
25func BenchmarkGenerateDeterministicKey(b *testing.B) {
26 var r *rsa.PrivateKey
27
28 for range b.N {
29 // always record the result of DeterministicPrivateKey to prevent
30 // the compiler eliminating the function call.
31 // #nosec G404 - Using math/rand is acceptable for benchmarking deterministic keys
32 r = agentrsa.GenerateDeterministicKey(rand.Int64())
33 }
34
35 // always store the result to a package level variable
36 // so the compiler cannot eliminate the Benchmark itself.
37 result = r
38}
39
40func FuzzGenerateDeterministicKey(f *testing.F) {
41 testcases := []int64{0, 1234, 1010101010}

Callers

nothing calls this directly

Calls 2

GenerateDeterministicKeyFunction · 0.92
Int64Method · 0.80

Tested by

no test coverage detected