4 "list-max-ziplist-value" 16
5 "list-max-ziplist-entries" 256
8 # We need a value larger than list-max-ziplist-value to make sure
9 # the list has the right encoding when it is swapped in again.
10 array set largevalue
{}
11 set largevalue
(ziplist
) "hello"
12 set largevalue
(linkedlist
) [string repeat
"hello" 4]
14 test
{LPUSH
, RPUSH
, LLENGTH
, LINDEX
- ziplist
} {
15 # first lpush then rpush
16 assert_equal
1 [r lpush myziplist1 a
]
17 assert_equal
2 [r rpush myziplist1 b
]
18 assert_equal
3 [r rpush myziplist1 c
]
19 assert_equal
3 [r llen myziplist1
]
20 assert_equal a
[r
lindex myziplist1
0]
21 assert_equal b
[r
lindex myziplist1
1]
22 assert_equal c
[r
lindex myziplist1
2]
23 assert_encoding ziplist myziplist1
25 # first rpush then lpush
26 assert_equal
1 [r rpush myziplist2 a
]
27 assert_equal
2 [r lpush myziplist2 b
]
28 assert_equal
3 [r lpush myziplist2 c
]
29 assert_equal
3 [r llen myziplist2
]
30 assert_equal c
[r
lindex myziplist2
0]
31 assert_equal b
[r
lindex myziplist2
1]
32 assert_equal a
[r
lindex myziplist2
2]
33 assert_encoding ziplist myziplist2
36 test
{LPUSH
, RPUSH
, LLENGTH
, LINDEX
- regular
list} {
37 # first lpush then rpush
38 assert_equal
1 [r lpush mylist1
$largevalue(linkedlist
)]
39 assert_encoding linkedlist mylist1
40 assert_equal
2 [r rpush mylist1 b
]
41 assert_equal
3 [r rpush mylist1 c
]
42 assert_equal
3 [r llen mylist1
]
43 assert_equal
$largevalue(linkedlist
) [r
lindex mylist1
0]
44 assert_equal b
[r
lindex mylist1
1]
45 assert_equal c
[r
lindex mylist1
2]
47 # first rpush then lpush
48 assert_equal
1 [r rpush mylist2
$largevalue(linkedlist
)]
49 assert_encoding linkedlist mylist2
50 assert_equal
2 [r lpush mylist2 b
]
51 assert_equal
3 [r lpush mylist2 c
]
52 assert_equal
3 [r llen mylist2
]
53 assert_equal c
[r
lindex mylist2
0]
54 assert_equal b
[r
lindex mylist2
1]
55 assert_equal
$largevalue(linkedlist
) [r
lindex mylist2
2]
58 test
{DEL a
list - ziplist
} {
59 assert_equal
1 [r del myziplist2
]
60 assert_equal
0 [r exists myziplist2
]
61 assert_equal
0 [r llen myziplist2
]
64 test
{DEL a
list - regular
list} {
65 assert_equal
1 [r del mylist2
]
66 assert_equal
0 [r exists mylist2
]
67 assert_equal
0 [r llen mylist2
]
70 proc create_ziplist
{key entries
} {
72 foreach entry $entries { r rpush
$key $entry }
73 assert_encoding ziplist
$key
76 proc create_linkedlist
{key entries
} {
78 foreach entry $entries { r rpush
$key $entry }
79 assert_encoding linkedlist
$key
82 foreach {type large
} [array get largevalue
] {
83 test
"BLPOP, BRPOP: single existing list - $type" {
84 set rd
[redis_deferring_client
]
85 create_
$type blist
"a b $large c d"
88 assert_equal
{blist a
} [$rd read]
90 assert_equal
{blist d
} [$rd read]
93 assert_equal
{blist b
} [$rd read]
95 assert_equal
{blist c
} [$rd read]
98 test
"BLPOP, BRPOP: multiple existing lists - $type" {
99 set rd
[redis_deferring_client
]
100 create_
$type blist1
"a $large c"
101 create_
$type blist2
"d $large f"
103 $rd blpop blist1 blist2
1
104 assert_equal
{blist1 a
} [$rd read]
105 $rd brpop blist1 blist2
1
106 assert_equal
{blist1 c
} [$rd read]
107 assert_equal
1 [r llen blist1
]
108 assert_equal
3 [r llen blist2
]
110 $rd blpop blist2 blist1
1
111 assert_equal
{blist2 d
} [$rd read]
112 $rd brpop blist2 blist1
1
113 assert_equal
{blist2 f
} [$rd read]
114 assert_equal
1 [r llen blist1
]
115 assert_equal
1 [r llen blist2
]
118 test
"BLPOP, BRPOP: second list has an entry - $type" {
119 set rd
[redis_deferring_client
]
121 create_
$type blist2
"d $large f"
123 $rd blpop blist1 blist2
1
124 assert_equal
{blist2 d
} [$rd read]
125 $rd brpop blist1 blist2
1
126 assert_equal
{blist2 f
} [$rd read]
127 assert_equal
0 [r llen blist1
]
128 assert_equal
1 [r llen blist2
]
131 test
"BRPOPLPUSH - $type" {
134 set rd
[redis_deferring_client
]
135 create_
$type blist
"a b $large c d"
137 $rd brpoplpush blist target
1
138 assert_equal d
[$rd read]
140 assert_equal d
[r rpop target
]
141 assert_equal
"a b $large c" [r
lrange blist
0 -1]
145 test
"BRPOPLPUSH with zero timeout should block indefinitely" {
146 set rd
[redis_deferring_client
]
148 $rd brpoplpush blist target
0
151 assert_equal foo
[$rd read]
152 assert_equal
{foo
} [r
lrange target
0 -1]
155 test
"BRPOPLPUSH with a client BLPOPing the target list" {
156 set rd
[redis_deferring_client
]
157 set rd2
[redis_deferring_client
]
160 $rd brpoplpush blist target
0
163 assert_equal foo
[$rd read]
164 assert_equal
{target foo
} [$rd2 read]
165 assert_equal
0 [r exists target
]
168 test
"BRPOPLPUSH with wrong source type" {
169 set rd
[redis_deferring_client
]
172 $rd brpoplpush blist target
1
173 assert_error
"ERR*wrong kind*" {$rd read}
176 test
"BRPOPLPUSH with wrong destination type" {
177 set rd
[redis_deferring_client
]
181 $rd brpoplpush blist target
1
182 assert_error
"ERR*wrong kind*" {$rd read}
184 set rd
[redis_deferring_client
]
187 $rd brpoplpush blist target
0
190 assert_error
"ERR*wrong kind*" {$rd read}
191 assert_equal
{foo
} [r
lrange blist
0 -1]
194 test
"BRPOPLPUSH inside a transaction" {
200 r brpoplpush xlist target
0
201 r brpoplpush xlist target
0
202 r brpoplpush xlist target
0
206 } {foo bar
{} {} {bar foo
}}
208 foreach {pop
} {BLPOP BRPOP
} {
209 test
"$pop: with single empty list argument" {
210 set rd
[redis_deferring_client
]
214 assert_equal
{blist1 foo
} [$rd read]
215 assert_equal
0 [r exists blist1
]
218 test
"$pop: with negative timeout" {
219 set rd
[redis_deferring_client
]
221 assert_error
"ERR*is negative*" {$rd read}
224 test
"$pop: with non-integer timeout" {
225 set rd
[redis_deferring_client
]
227 assert_error
"ERR*not an integer*" {$rd read}
230 test
"$pop: with zero timeout should block indefinitely" {
231 # To test this, use a timeout of 0 and wait a second.
232 # The blocking pop should still be waiting for a push.
233 set rd
[redis_deferring_client
]
237 assert_equal
{blist1 foo
} [$rd read]
240 test
"$pop: second argument is not a list" {
241 set rd
[redis_deferring_client
]
244 $rd $pop blist1 blist2
1
245 assert_error
"ERR*wrong kind*" {$rd read}
248 test
"$pop: timeout" {
249 set rd
[redis_deferring_client
]
251 $rd $pop blist1 blist2
1
252 assert_equal
{} [$rd read]
255 test
"$pop: arguments are empty" {
256 set rd
[redis_deferring_client
]
259 $rd $pop blist1 blist2
1
261 assert_equal
{blist1 foo
} [$rd read]
262 assert_equal
0 [r exists blist1
]
263 assert_equal
0 [r exists blist2
]
265 $rd $pop blist1 blist2
1
267 assert_equal
{blist2 foo
} [$rd read]
268 assert_equal
0 [r exists blist1
]
269 assert_equal
0 [r exists blist2
]
273 test
{BLPOP inside a transaction
} {
282 } {{xlist bar
} {xlist foo
} {}}
284 test
{LPUSHX
, RPUSHX
- generic
} {
286 assert_equal
0 [r lpushx xlist a
]
287 assert_equal
0 [r llen xlist
]
288 assert_equal
0 [r rpushx xlist a
]
289 assert_equal
0 [r llen xlist
]
292 foreach {type large
} [array get largevalue
] {
293 test
"LPUSHX, RPUSHX - $type" {
294 create_
$type xlist
"$large c"
295 assert_equal
3 [r rpushx xlist d
]
296 assert_equal
4 [r lpushx xlist a
]
297 assert_equal
"a $large c d" [r
lrange xlist
0 -1]
300 test
"LINSERT - $type" {
301 create_
$type xlist
"a $large c d"
302 assert_equal
5 [r
linsert xlist before c zz
]
303 assert_equal
"a $large zz c d" [r
lrange xlist
0 10]
304 assert_equal
6 [r
linsert xlist
after c yy
]
305 assert_equal
"a $large zz c yy d" [r
lrange xlist
0 10]
306 assert_equal
7 [r
linsert xlist
after d dd
]
307 assert_equal
-1 [r
linsert xlist
after bad ddd
]
308 assert_equal
"a $large zz c yy d dd" [r
lrange xlist
0 10]
309 assert_equal
8 [r
linsert xlist before a aa
]
310 assert_equal
-1 [r
linsert xlist before bad aaa
]
311 assert_equal
"aa a $large zz c yy d dd" [r
lrange xlist
0 10]
313 # check inserting integer encoded value
314 assert_equal
9 [r
linsert xlist before aa
42]
315 assert_equal
42 [r
lrange xlist
0 0]
319 test
{LPUSHX
, RPUSHX convert from ziplist to
list} {
320 set large
$largevalue(linkedlist
)
322 # convert when a large value is pushed
323 create_ziplist xlist a
324 assert_equal
2 [r rpushx xlist
$large]
325 assert_encoding linkedlist xlist
326 create_ziplist xlist a
327 assert_equal
2 [r lpushx xlist
$large]
328 assert_encoding linkedlist xlist
330 # convert when the length threshold is exceeded
331 create_ziplist xlist
[lrepeat
256 a
]
332 assert_equal
257 [r rpushx xlist b
]
333 assert_encoding linkedlist xlist
334 create_ziplist xlist
[lrepeat
256 a
]
335 assert_equal
257 [r lpushx xlist b
]
336 assert_encoding linkedlist xlist
339 test
{LINSERT convert from ziplist to
list} {
340 set large
$largevalue(linkedlist
)
342 # convert when a large value is inserted
343 create_ziplist xlist a
344 assert_equal
2 [r
linsert xlist before a
$large]
345 assert_encoding linkedlist xlist
346 create_ziplist xlist a
347 assert_equal
2 [r
linsert xlist
after a
$large]
348 assert_encoding linkedlist xlist
350 # convert when the length threshold is exceeded
351 create_ziplist xlist
[lrepeat
256 a
]
352 assert_equal
257 [r
linsert xlist before a a
]
353 assert_encoding linkedlist xlist
354 create_ziplist xlist
[lrepeat
256 a
]
355 assert_equal
257 [r
linsert xlist
after a a
]
356 assert_encoding linkedlist xlist
358 # don't convert when the value could not be inserted
359 create_ziplist xlist
[lrepeat
256 a
]
360 assert_equal
-1 [r
linsert xlist before foo a
]
361 assert_encoding ziplist xlist
362 create_ziplist xlist
[lrepeat
256 a
]
363 assert_equal
-1 [r
linsert xlist
after foo a
]
364 assert_encoding ziplist xlist
367 foreach {type num
} {ziplist
250 linkedlist
500} {
368 proc check_numbered_list_consistency
{key
} {
369 set len
[r llen
$key]
370 for {set i
0} {$i < $len} {incr i
} {
371 assert_equal
$i [r
lindex $key $i]
372 assert_equal
[expr $len-1-$i] [r
lindex $key [expr (-$i)-1]]
376 proc check_random_access_consistency
{key
} {
377 set len
[r llen
$key]
378 for {set i
0} {$i < $len} {incr i
} {
379 set rint
[expr int
(rand
()*$len)]
380 assert_equal
$rint [r
lindex $key $rint]
381 assert_equal
[expr $len-1-$rint] [r
lindex $key [expr (-$rint)-1]]
385 test
"LINDEX consistency test - $type" {
387 for {set i
0} {$i < $num} {incr i
} {
390 assert_encoding
$type mylist
391 check_numbered_list_consistency mylist
394 test
"LINDEX random access - $type" {
395 assert_encoding
$type mylist
396 check_random_access_consistency mylist
399 test
"Check if list is still ok after a DEBUG RELOAD - $type" {
401 assert_encoding
$type mylist
402 check_numbered_list_consistency mylist
403 check_random_access_consistency mylist
407 test
{LLEN against non-list value
error} {
410 assert_error ERR
* {r llen mylist
}
413 test
{LLEN against non existing key
} {
414 assert_equal
0 [r llen not-a-key
]
417 test
{LINDEX against non-list value
error} {
418 assert_error ERR
* {r
lindex mylist
0}
421 test
{LINDEX against non existing key
} {
422 assert_equal
"" [r
lindex not-a-key
10]
425 test
{LPUSH against non-list value
error} {
426 assert_error ERR
* {r lpush mylist
0}
429 test
{RPUSH against non-list value
error} {
430 assert_error ERR
* {r rpush mylist
0}
433 foreach {type large
} [array get largevalue
] {
434 test
"RPOPLPUSH base case - $type" {
435 r del mylist1 mylist2
436 create_
$type mylist1
"a $large c d"
437 assert_equal d
[r rpoplpush mylist1 mylist2
]
438 assert_equal c
[r rpoplpush mylist1 mylist2
]
439 assert_equal
"a $large" [r
lrange mylist1
0 -1]
440 assert_equal
"c d" [r
lrange mylist2
0 -1]
441 assert_encoding ziplist mylist2
444 test
"RPOPLPUSH with the same list as src and dst - $type" {
445 create_
$type mylist
"a $large c"
446 assert_equal
"a $large c" [r
lrange mylist
0 -1]
447 assert_equal c
[r rpoplpush mylist mylist
]
448 assert_equal
"c a $large" [r
lrange mylist
0 -1]
451 foreach {othertype otherlarge
} [array get largevalue
] {
452 test
"RPOPLPUSH with $type source and existing target $othertype" {
453 create_
$type srclist
"a b c $large"
454 create_
$othertype dstlist
"$otherlarge"
455 assert_equal
$large [r rpoplpush srclist dstlist
]
456 assert_equal c
[r rpoplpush srclist dstlist
]
457 assert_equal
"a b" [r
lrange srclist
0 -1]
458 assert_equal
"c $large $otherlarge" [r
lrange dstlist
0 -1]
460 # When we rpoplpush'ed a large value, dstlist should be
461 # converted to the same encoding as srclist.
462 if {$type eq
"linkedlist"} {
463 assert_encoding linkedlist dstlist
469 test
{RPOPLPUSH against non existing key
} {
470 r del srclist dstlist
471 assert_equal
{} [r rpoplpush srclist dstlist
]
472 assert_equal
0 [r exists srclist
]
473 assert_equal
0 [r exists dstlist
]
476 test
{RPOPLPUSH against non
list src key
} {
477 r del srclist dstlist
479 assert_error ERR
* {r rpoplpush srclist dstlist
}
480 assert_type
string srclist
481 assert_equal
0 [r exists newlist
]
484 test
{RPOPLPUSH against non
list dst key
} {
485 create_ziplist srclist
{a b c d
}
487 assert_error ERR
* {r rpoplpush srclist dstlist
}
488 assert_type
string dstlist
489 assert_equal
{a b c d
} [r
lrange srclist
0 -1]
492 test
{RPOPLPUSH against non existing src key
} {
493 r del srclist dstlist
494 assert_equal
{} [r rpoplpush srclist dstlist
]
497 foreach {type large
} [array get largevalue
] {
498 test
"Basic LPOP/RPOP - $type" {
499 create_
$type mylist
"$large 1 2"
500 assert_equal
$large [r lpop mylist
]
501 assert_equal
2 [r rpop mylist
]
502 assert_equal
1 [r lpop mylist
]
503 assert_equal
0 [r llen mylist
]
506 assert_equal
{} [r lpop mylist
]
507 assert_equal
{} [r rpop mylist
]
511 test
{LPOP
/RPOP against non
list value
} {
513 assert_error ERR
*kind
* {r lpop notalist
}
514 assert_error ERR
*kind
* {r rpop notalist
}
517 foreach {type num
} {ziplist
250 linkedlist
500} {
518 test
"Mass RPOP/LPOP - $type" {
521 for {set i
0} {$i < $num} {incr i
} {
525 assert_encoding
$type mylist
527 for {set i
0} {$i < [expr $num/2]} {incr i
} {
528 incr sum2
[r lpop mylist
]
529 incr sum2
[r rpop mylist
]
531 assert_equal
$sum1 $sum2
535 foreach {type large
} [array get largevalue
] {
536 test
"LRANGE basics - $type" {
537 create_
$type mylist
"$large 1 2 3 4 5 6 7 8 9"
538 assert_equal
{1 2 3 4 5 6 7 8} [r
lrange mylist
1 -2]
539 assert_equal
{7 8 9} [r
lrange mylist
-3 -1]
540 assert_equal
{4} [r
lrange mylist
4 4]
543 test
"LRANGE inverted indexes - $type" {
544 create_
$type mylist
"$large 1 2 3 4 5 6 7 8 9"
545 assert_equal
{} [r
lrange mylist
6 2]
548 test
"LRANGE out of range indexes including the full list - $type" {
549 create_
$type mylist
"$large 1 2 3"
550 assert_equal
"$large 1 2 3" [r
lrange mylist
-1000 1000]
553 test
"LRANGE out of range negative end index - $type" {
554 create_
$type mylist
"$large 1 2 3"
555 assert_equal
$large [r
lrange mylist
0 -4]
556 assert_equal
{} [r
lrange mylist
0 -5]
560 test
{LRANGE against non existing key
} {
561 assert_equal
{} [r
lrange nosuchkey
0 1]
564 foreach {type large
} [array get largevalue
] {
565 proc trim_list
{type min max
} {
568 create_
$type mylist
"1 2 3 4 $large"
569 r ltrim mylist
$min $max
573 test
"LTRIM basics - $type" {
574 assert_equal
"1" [trim_list
$type 0 0]
575 assert_equal
"1 2" [trim_list
$type 0 1]
576 assert_equal
"1 2 3" [trim_list
$type 0 2]
577 assert_equal
"2 3" [trim_list
$type 1 2]
578 assert_equal
"2 3 4 $large" [trim_list
$type 1 -1]
579 assert_equal
"2 3 4" [trim_list
$type 1 -2]
580 assert_equal
"4 $large" [trim_list
$type -2 -1]
581 assert_equal
"$large" [trim_list
$type -1 -1]
582 assert_equal
"1 2 3 4 $large" [trim_list
$type -5 -1]
583 assert_equal
"1 2 3 4 $large" [trim_list
$type -10 10]
584 assert_equal
"1 2 3 4 $large" [trim_list
$type 0 5]
585 assert_equal
"1 2 3 4 $large" [trim_list
$type 0 10]
588 test
"LTRIM out of range negative end index - $type" {
589 assert_equal
{1} [trim_list
$type 0 -5]
590 assert_equal
{} [trim_list
$type 0 -6]
594 test
"LTRIM stress testing - $type" {
599 # Start with the large value to ensure the
600 # right encoding is used.
601 r rpush mylist
$large
602 lappend mylist
$large
604 for {set i
0} {$i < $startlen} {incr i
} {
605 set str
[randomInt
9223372036854775807]
610 for {set i
0} {$i < 1000} {incr i
} {
611 set min
[expr {int
(rand
()*$startlen)}]
612 set max
[expr {$min+int
(rand
()*$startlen)}]
613 set mylist
[lrange $mylist $min $max]
614 r ltrim mylist
$min $max
615 assert_equal
$mylist [r
lrange mylist
0 -1]
617 for {set j
[r llen mylist
]} {$j < $startlen} {incr j
} {
618 set str
[randomInt
9223372036854775807]
627 foreach {type large
} [array get largevalue
] {
628 test
"LSET - $type" {
629 create_
$type mylist
"99 98 $large 96 95"
632 assert_equal
"99 foo $large 96 bar" [r
lrange mylist
0 -1]
635 test
"LSET out of range index - $type" {
636 assert_error ERR
*range
* {r
lset mylist
10 foo
}
640 test
{LSET against non existing key
} {
641 assert_error ERR
*key
* {r
lset nosuchkey
10 foo
}
644 test
{LSET against non
list value
} {
646 assert_error ERR
*value
* {r
lset nolist
0 foo
}
649 foreach {type e
} [array get largevalue
] {
650 test
"LREM remove all the occurrences - $type" {
651 create_
$type mylist
"$e foo bar foobar foobared zap bar test foo"
652 assert_equal
2 [r lrem mylist
0 bar
]
653 assert_equal
"$e foo foobar foobared zap test foo" [r
lrange mylist
0 -1]
656 test
"LREM remove the first occurrence - $type" {
657 assert_equal
1 [r lrem mylist
1 foo
]
658 assert_equal
"$e foobar foobared zap test foo" [r
lrange mylist
0 -1]
661 test
"LREM remove non existing element - $type" {
662 assert_equal
0 [r lrem mylist
1 nosuchelement
]
663 assert_equal
"$e foobar foobared zap test foo" [r
lrange mylist
0 -1]
666 test
"LREM starting from tail with negative count - $type" {
667 create_
$type mylist
"$e foo bar foobar foobared zap bar test foo foo"
668 assert_equal
1 [r lrem mylist
-1 bar
]
669 assert_equal
"$e foo bar foobar foobared zap test foo foo" [r
lrange mylist
0 -1]
672 test
"LREM starting from tail with negative count (2) - $type" {
673 assert_equal
2 [r lrem mylist
-2 foo
]
674 assert_equal
"$e foo bar foobar foobared zap test" [r
lrange mylist
0 -1]
677 test
"LREM deleting objects that may be int encoded - $type" {
678 create_
$type myotherlist
"$e 1 2 3"
679 assert_equal
1 [r lrem myotherlist
1 2]
680 assert_equal
3 [r llen myotherlist
]
689 "list-max-ziplist-value" 200000
690 "list-max-ziplist-entries" 256
693 test
{Explicit regression
for a
list bug
} {
694 set mylist
{49376042582 {BkG2o
\pIC
]4YYJa9cJ4GWZalG
[4tin
;1D2whSkCOW`mX
;SFXGyS8sedcff3fQI^tgPCC
@^Nu1J6o
]meM
@Lko
]t_jRyo
<xSJ1oObDYd`ppZuW6P
@fS278YaOx
=s6lvdFlMbP0
[SbkI^Kr
\HBXtuFaA^mDx
:yzS4a
[skiiPWhT
<nNfAf
=aQVfclcuwDrfe
;iVuKdNvB9kbfq
>tK?tH
[\EvWqS
]b`o2OCtjg
:?nUTwdjpcUm
]y
:pg5q24q7LlCOwQE^
}}
696 r rpush l
[lindex $mylist 0]
697 r rpush l
[lindex $mylist 1]
698 assert_equal
[r
lindex l
0] [lindex $mylist 0]
699 assert_equal
[r
lindex l
1] [lindex $mylist 1]
703 test
{ziplist implementation
: value
encoding and backlink
} {
704 for {set j
0} {$j < 100} {incr j
} {
707 for {set i
0} {$i < 200} {incr i
} {
709 set data
[string repeat x
[randomInt
100000]]
711 set data
[randomInt
65536]
713 set data
[randomInt
4294967296]
715 set data
[randomInt
18446744073709551616]
720 assert_equal
[llength $l] [r llen l
]
722 for {set i
199} {$i >= 0} {incr i
-1} {
723 if {[lindex $l $i] ne
[r
lindex l
$i]} {
724 assert_equal
[lindex $l $i] [r
lindex l
$i]
730 test
{ziplist implementation
: encoding stress testing
} {
731 for {set j
0} {$j < 200} {incr j
} {
734 set len
[randomInt
400]
735 for {set i
0} {$i < $len} {incr i
} {
741 set l
[concat [list $rv] $l]
745 assert_equal
[llength $l] [r llen l
]
746 for {set i
0} {$i < 200} {incr i
} {
747 if {[lindex $l $i] ne
[r
lindex l
$i]} {
748 assert_equal
[lindex $l $i] [r
lindex l
$i]