MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / testListRange

Function testListRange

lists_test.go:36–59  ·  view source on GitHub ↗
(key []byte, start int64, stop int64, checkValues ...int)

Source from the content-addressed store, hash-verified

34}
35
36func testListRange(key []byte, start int64, stop int64, checkValues ...int) error {
37 c := getTestConn()
38 ctx := context.Background()
39
40 res, err := c.Do(ctx, "lrange", key, start, stop).Result()
41 if err != nil {
42 return err
43 }
44
45 vs := cast.ToIntSlice(res)
46
47 if len(vs) != len(checkValues) {
48 return fmt.Errorf("invalid return number %d != %d", len(vs), len(checkValues))
49 }
50
51 var n int
52 for i, v := range vs {
53 if v != checkValues[i] {
54 return fmt.Errorf("invalid data %d: %d != %d", i, n, checkValues[i])
55 }
56 }
57
58 return nil
59}
60
61func TestList(t *testing.T) {
62 c := getTestConn()

Callers 3

TestListFunction · 0.85
TestListMPushFunction · 0.85
TestPopFunction · 0.85

Calls 2

getTestConnFunction · 0.85
DoMethod · 0.45

Tested by

no test coverage detected