Skip to content

Commit 01f75bf

Browse files
committed
New SORT tests checking the new more deterministic behavior of SORT sorting algorithm.
1 parent de79a2e commit 01f75bf

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/unit/sort.tcl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,32 @@ start_server {
164164
r lrange mylist 0 -1
165165
} {a b c d e f g h i l m n o p q r s t u v z}
166166

167+
test "SORT will complain with numerical sorting and bad doubles (1)" {
168+
r del myset
169+
r sadd myset 1 2 3 4 not-a-double
170+
set e {}
171+
catch {r sort myset} e
172+
set e
173+
} {*ERR*double*}
174+
175+
test "SORT will complain with numerical sorting and bad doubles (2)" {
176+
r del myset
177+
r sadd myset 1 2 3 4
178+
r mset score:1 10 score:2 20 score:3 30 score:4 not-a-double
179+
set e {}
180+
catch {r sort myset by score:*} e
181+
set e
182+
} {*ERR*double*}
183+
184+
test "SORT BY sub-sorts lexicographically if score is the same" {
185+
r del myset
186+
r sadd myset u v z a b c d e f g h i l m n o p q r s t
187+
foreach ele {a b c d e f g h i l m n o p q r s t u v z} {
188+
set score:$ele 100
189+
}
190+
r sort myset by score:*
191+
} {a b c d e f g h i l m n o p q r s t u v z}
192+
167193
tags {"slow"} {
168194
set num 100
169195
set res [create_random_dataset $num lpush]

0 commit comments

Comments
 (0)