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

Function TestList_LPush

internal/data/list_test.go:74–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestList_LPush(t *testing.T) {
75 for _, listImpl := range []data.ListImplementationType{data.ListImplDoublyLinkedList, data.ListImplBTree} {
76 list := data.NewList(listImpl)
77 // Test LPush
78 key := string(testutils.GetTestBytes(0))
79 expectRecords := testutils.GenerateRecords(5)
80 seqInfo := data.HeadTailSeq{Head: data.InitialListSeq, Tail: data.InitialListSeq + 1}
81
82 for i := 0; i < len(expectRecords); i++ {
83 seq := seqInfo.GenerateSeq(true)
84 newKey := utils.EncodeListKey([]byte(key), seq)
85 expectRecords[i].Key = newKey
86 ListPush(t, list, string(newKey), expectRecords[i], true, nil)
87 }
88
89 ListCmp(t, list, key, expectRecords, true)
90 }
91}
92
93func TestList_RPush(t *testing.T) {
94 for _, listImpl := range []data.ListImplementationType{data.ListImplDoublyLinkedList, data.ListImplBTree} {

Callers

nothing calls this directly

Calls 7

GenerateSeqMethod · 0.95
NewListFunction · 0.92
GetTestBytesFunction · 0.92
GenerateRecordsFunction · 0.92
EncodeListKeyFunction · 0.92
ListPushFunction · 0.85
ListCmpFunction · 0.85

Tested by

no test coverage detected