MCPcopy Index your code
hub / github.com/nutsdb/nutsdb / GetTestBytes

Function GetTestBytes

internal/testutils/test_utils.go:27–39  ·  view source on GitHub ↗
(i int)

Source from the content-addressed store, hash-verified

25const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
26
27func GetTestBytes(i int) []byte {
28 // Optimized version without fmt.Sprintf to reduce benchmark overhead
29 // Format: "nutsdb-000000000" (7 prefix + 9 digits = 16 bytes)
30 buf := make([]byte, 16)
31 copy(buf, "nutsdb-")
32
33 // Convert i to 9-digit string with leading zeros
34 for j := 15; j >= 7; j-- {
35 buf[j] = byte('0' + i%10)
36 i /= 10
37 }
38 return buf
39}
40
41func GetRandomBytes(length int) []byte {
42 b := make([]byte, length)

Callers 15

setupIteratorBenchmarkFunction · 0.92
BenchmarkIterator_SeekFunction · 0.92
TestTx_SAddFunction · 0.92
TestTx_SRem2Function · 0.92
TestTx_SMembersFunction · 0.92
TestTx_SCardFunction · 0.92
TestTx_SDiffByOneBucketFunction · 0.92
TestTx_SDiffByTwoBucketsFunction · 0.92
TestTx_SPopFunction · 0.92
TestTx_SMoveByOneBucketFunction · 0.92

Calls

no outgoing calls

Tested by 15

setupIteratorBenchmarkFunction · 0.74
BenchmarkIterator_SeekFunction · 0.74
TestTx_SAddFunction · 0.74
TestTx_SRem2Function · 0.74
TestTx_SMembersFunction · 0.74
TestTx_SCardFunction · 0.74
TestTx_SDiffByOneBucketFunction · 0.74
TestTx_SDiffByTwoBucketsFunction · 0.74
TestTx_SPopFunction · 0.74
TestTx_SMoveByOneBucketFunction · 0.74