mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
fix(zset): correct the wrong calculation of range.maxex (#1759)
fixes #836: correct the wrong calculation of range.maxex.
This commit is contained in:
parent
7c43cbf2b5
commit
b6b72250ca
3 changed files with 7 additions and 2 deletions
|
@ -9,7 +9,7 @@ AllowShortLoopsOnASingleLine: false
|
||||||
AllowShortFunctionsOnASingleLine: false
|
AllowShortFunctionsOnASingleLine: false
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
AlwaysBreakTemplateDeclarations: false
|
AlwaysBreakTemplateDeclarations: false
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
PackConstructorInitializers: NextLine
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
|
|
|
@ -84,7 +84,7 @@ zlexrangespec GetLexRange(bool reverse, const ZSetFamily::LexInterval& li) {
|
||||||
range.min = GetLexStr(interval.first);
|
range.min = GetLexStr(interval.first);
|
||||||
range.max = GetLexStr(interval.second);
|
range.max = GetLexStr(interval.second);
|
||||||
range.minex = (interval.first.type == ZSetFamily::LexBound::OPEN);
|
range.minex = (interval.first.type == ZSetFamily::LexBound::OPEN);
|
||||||
range.maxex = (li.second.type == ZSetFamily::LexBound::OPEN);
|
range.maxex = (interval.second.type == ZSetFamily::LexBound::OPEN);
|
||||||
|
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,11 @@ TEST_F(ZSetFamilyTest, ZRevRangeByLex) {
|
||||||
resp = Run({"zrevrangebylex", "key", "+", "[a"});
|
resp = Run({"zrevrangebylex", "key", "+", "[a"});
|
||||||
ASSERT_THAT(resp, ArgType(RespExpr::ARRAY));
|
ASSERT_THAT(resp, ArgType(RespExpr::ARRAY));
|
||||||
ASSERT_THAT(resp.GetVec(), ElementsAre("foo", "elephant", "down", "cool", "bar", "alpha"));
|
ASSERT_THAT(resp.GetVec(), ElementsAre("foo", "elephant", "down", "cool", "bar", "alpha"));
|
||||||
|
|
||||||
|
Run({"zadd", "myzset", "0", "a", "0", "b", "0", "c", "0", "d", "0", "e", "0", "f", "0", "g"});
|
||||||
|
resp = Run({"zrevrangebylex", "myzset", "(c", "-"});
|
||||||
|
ASSERT_THAT(resp, ArgType(RespExpr::ARRAY));
|
||||||
|
EXPECT_THAT(resp.GetVec(), ElementsAre("b", "a"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ZSetFamilyTest, ZRange) {
|
TEST_F(ZSetFamilyTest, ZRange) {
|
||||||
|
|
Loading…
Reference in a new issue