(key []byte, start int64, stop int64, checkValues ...int)
| 34 | } |
| 35 | |
| 36 | func 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 | |
| 61 | func TestList(t *testing.T) { |
| 62 | c := getTestConn() |
no test coverage detected