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

Function TestZSetStructure_adjustMinMax

structure/zset_test.go:917–932  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

915
916}
917func TestZSetStructure_adjustMinMax(t *testing.T) {
918 zss, _ := NewZSetStructure(config.DefaultOptions)
919 fz := newZSetNodes()
920
921 _, _, err := zss.adjustMinMax(fz, 100, 0)
922 assert.Equal(t, ErrInvalidArgs, err)
923 //
924 _ = fz.InsertNode(30, "mem1", "")
925 _ = fz.InsertNode(200, "mem1", "")
926 minScore, maxScore, err := zss.adjustMinMax(fz, 10, 50)
927 assert.NoError(t, err)
928 // as the min now is 30, our provided min of 10 will be turned into 30
929 // as our param of max is 50 and maximum score is 200, it won't change
930 assert.Equal(t, 30, minScore)
931 assert.Equal(t, 50, maxScore)
932}
933
934func TestZset_getNodeByRank(t *testing.T) {
935 sl := newSkipList()

Callers

nothing calls this directly

Calls 4

adjustMinMaxMethod · 0.95
NewZSetStructureFunction · 0.85
newZSetNodesFunction · 0.85
InsertNodeMethod · 0.80

Tested by

no test coverage detected