MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestListStructure_RPOPLPUSH

Function TestListStructure_RPOPLPUSH

structure/list_test.go:294–315  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

292}
293
294func TestListStructure_RPOPLPUSH(t *testing.T) {
295 list, _ := initList()
296 defer list.db.Clean()
297
298 // Test RPOPLPUSH function when the source list exists
299 listErr = list.RPush(string(randkv.GetTestKey(1)), randkv.RandomValue(100), 0)
300 assert.Nil(t, listErr)
301 listErr = list.RPOPLPUSH(string(randkv.GetTestKey(1)), string(randkv.GetTestKey(2)), 0)
302 assert.Nil(t, listErr)
303
304 // Test RPOPLPUSH function when the source list does not exist
305 listErr = list.RPOPLPUSH(string(randkv.GetTestKey(3)), string(randkv.GetTestKey(2)), 0)
306 assert.Equal(t, listErr, _const.ErrKeyNotFound)
307
308 // Test RPOPLPUSH function when the source list is empty
309 listErr = list.RPush(string(randkv.GetTestKey(4)), randkv.RandomValue(100), 0)
310 assert.Nil(t, listErr)
311 _, listErr = list.RPop(string(randkv.GetTestKey(4)))
312 assert.Nil(t, listErr)
313 listErr = list.RPOPLPUSH(string(randkv.GetTestKey(4)), string(randkv.GetTestKey(2)), 0)
314 assert.Equal(t, listErr, ErrListEmpty)
315}
316
317func TestListStructure_Integration(t *testing.T) {
318 list, _ := initList()

Callers

nothing calls this directly

Calls 7

GetTestKeyFunction · 0.92
RandomValueFunction · 0.92
initListFunction · 0.85
RPOPLPUSHMethod · 0.80
RPushMethod · 0.65
RPopMethod · 0.65
CleanMethod · 0.45

Tested by

no test coverage detected