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

Function testListIndex

lists_test.go:18–34  ·  view source on GitHub ↗
(key []byte, index int64, v int)

Source from the content-addressed store, hash-verified

16)
17
18func testListIndex(key []byte, index int64, v int) error {
19 c := getTestConn()
20 ctx := context.Background()
21
22 n, err := c.Do(ctx, "lindex", key, index).Int()
23 if err == redis.Nil && v != 0 {
24 return fmt.Errorf("must nil")
25 } else if err != nil && err != redis.Nil {
26 r, _ := c.Do(ctx, "lindex", key, index).Result()
27 log.Println("lindex err: ", spew.Sdump(r))
28 return err
29 } else if n != v {
30 return fmt.Errorf("index err number %d != %d", n, v)
31 }
32
33 return nil
34}
35
36func testListRange(key []byte, start int64, stop int64, checkValues ...int) error {
37 c := getTestConn()

Callers 1

TestListFunction · 0.85

Calls 2

getTestConnFunction · 0.85
DoMethod · 0.45

Tested by

no test coverage detected