MCPcopy Create free account
hub / github.com/distributedio/titan / TestStringLen

Function TestStringLen

db/string_test.go:216–245  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

214}
215
216func TestStringLen(t *testing.T) {
217 setValue(t, TestExistKey, value)
218 tests := []struct {
219 name string
220 key []byte
221 want int
222 }{
223 {
224 name: "TestString_Len",
225 key: TestExistKey,
226 want: 11,
227 },
228 {
229 name: "TestString_Len",
230 key: TestNoExistKey,
231 want: 0,
232 },
233 }
234 for _, tt := range tests {
235 t.Run(tt.name, func(t *testing.T) {
236 callFunc := func(txn *Transaction) {
237 s, err := GetString(txn, tt.key)
238 assert.NoError(t, err)
239 got, err := s.Len()
240 assert.Equal(t, tt.want, got)
241 }
242 MockTest(t, callFunc)
243 })
244 }
245}
246
247func TestStringExist(t *testing.T) {
248 setValue(t, TestExistKey, value)

Callers

nothing calls this directly

Calls 4

setValueFunction · 0.85
GetStringFunction · 0.85
MockTestFunction · 0.85
LenMethod · 0.45

Tested by

no test coverage detected