MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / TestHintEntryEncodeDecodeEdgeCases

Function TestHintEntryEncodeDecodeEdgeCases

hintfile_test.go:101–197  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

99}
100
101func TestHintEntryEncodeDecodeEdgeCases(t *testing.T) {
102 testCases := []struct {
103 name string
104 entry *HintEntry
105 }{
106 {
107 name: "Empty key",
108 entry: &HintEntry{
109 BucketId: 1,
110 KeySize: 0,
111 ValueSize: 5,
112 Timestamp: 1234567890,
113 TTL: 3600,
114 Flag: DataSetFlag,
115 Status: Committed,
116 Ds: DataStructureBTree,
117 DataPos: 100,
118 FileID: 1,
119 Key: []byte(""),
120 },
121 },
122 {
123 name: "Large key",
124 entry: &HintEntry{
125 BucketId: 1,
126 KeySize: 1000,
127 ValueSize: 5,
128 Timestamp: 1234567890,
129 TTL: 3600,
130 Flag: DataSetFlag,
131 Status: Committed,
132 Ds: DataStructureBTree,
133 DataPos: 100,
134 FileID: 1,
135 Key: make([]byte, 1000),
136 },
137 },
138 {
139 name: "Zero TTL",
140 entry: &HintEntry{
141 BucketId: 1,
142 KeySize: 3,
143 ValueSize: 5,
144 Timestamp: 1234567890,
145 TTL: 0,
146 Flag: DataSetFlag,
147 Status: Committed,
148 Ds: DataStructureBTree,
149 DataPos: 100,
150 FileID: 1,
151 Key: []byte("key"),
152 },
153 },
154 {
155 name: "Different data structures",
156 entry: &HintEntry{
157 BucketId: 1,
158 KeySize: 3,

Callers

nothing calls this directly

Calls 4

DecodeMethod · 0.95
stringEqualFunction · 0.85
RunMethod · 0.80
EncodeMethod · 0.45

Tested by

no test coverage detected