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

Function TestStringAppend

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

Source from the content-addressed store, hash-verified

278}
279
280func TestStringAppend(t *testing.T) {
281 setValue(t, TestExistKey, value)
282 type args struct {
283 value []byte
284 }
285 tests := []struct {
286 name string
287 args args
288 key []byte
289 want int
290 }{
291 {
292 name: "TestString_AppendExistKey",
293 args: args{
294 value: value,
295 },
296 key: TestExistKey,
297 want: 22,
298 },
299 {
300 name: "TestString_AppendNoExistKey",
301 args: args{
302 value: value,
303 },
304 key: TestNoExistKey,
305 want: 11,
306 },
307 }
308 for _, tt := range tests {
309 t.Run(tt.name, func(t *testing.T) {
310 callFunc := func(txn *Transaction) {
311 s, err := GetString(txn, tt.key)
312 assert.NoError(t, err)
313 got, err := s.Append(tt.args.value)
314 assert.Equal(t, tt.want, got)
315 }
316 MockTest(t, callFunc)
317 })
318 }
319}
320
321func TestStringGetSet(t *testing.T) {
322 setValue(t, []byte("GetSetExistKey"), value)

Callers

nothing calls this directly

Calls 4

setValueFunction · 0.85
GetStringFunction · 0.85
MockTestFunction · 0.85
AppendMethod · 0.80

Tested by

no test coverage detected