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

Function TestSortedSetRangeByLex

IceFireDB-PubSub/test/cmd_sorted_set_test.go:1034–1256  ·  view source on GitHub ↗

Test ZRANGEBYLEX, ZREVRANGEBYLEX, ZLEXCOUNT

(t *testing.T)

Source from the content-addressed store, hash-verified

1032
1033// Test ZRANGEBYLEX, ZREVRANGEBYLEX, ZLEXCOUNT
1034func TestSortedSetRangeByLex(t *testing.T) {
1035 server.Clear()
1036 c, err := proto.Dial(server.Addr())
1037 ok(t, err)
1038 defer c.Close()
1039 s := server.Direct()
1040
1041 s.ZAdd("z", 12, "zero kelvin")
1042 s.ZAdd("z", 12, "minusfour")
1043 s.ZAdd("z", 12, "one")
1044 s.ZAdd("z", 12, "oneone")
1045 s.ZAdd("z", 12, "two")
1046 s.ZAdd("z", 12, "zwei")
1047 s.ZAdd("z", 12, "three")
1048 s.ZAdd("z", 12, "drei")
1049 s.ZAdd("z", 12, "inf")
1050
1051 // Normal cases
1052 {
1053 mustDo(t, c,
1054 "ZRANGEBYLEX", "z", "-", "+",
1055 proto.Strings(
1056 "drei",
1057 "inf",
1058 "minusfour",
1059 "one",
1060 "oneone",
1061 "three",
1062 "two",
1063 "zero kelvin",
1064 "zwei",
1065 ),
1066 )
1067
1068 mustDo(t, c,
1069 "ZRANGEBYLEX", "z", "[zz", "+",
1070 proto.Strings(),
1071 )
1072
1073 mustDo(t, c,
1074 "ZREVRANGEBYLEX", "z", "+", "-",
1075 proto.Strings(
1076 "zwei",
1077 "zero kelvin",
1078 "two",
1079 "three",
1080 "oneone",
1081 "one",
1082 "minusfour",
1083 "inf",
1084 "drei",
1085 ),
1086 )
1087
1088 mustDo(t, c,
1089 "ZLEXCOUNT", "z", "-", "+",
1090 proto.Int(9),
1091 )

Callers

nothing calls this directly

Calls 14

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
StringsFunction · 0.92
IntFunction · 0.92
ErrorFunction · 0.92
SetMethod · 0.80
okFunction · 0.70
mustDoFunction · 0.70
must0Function · 0.70
errWrongNumberFunction · 0.70

Tested by

no test coverage detected