]>
git.saurik.com Git - redis.git/blob - tests/unit/aofrw.tcl
1 start_server
{tags
{"aofrw"}} {
2 foreach d
{string int
} {
3 foreach e
{ziplist linkedlist
} {
4 test
"AOF rewrite of list with $e encoding, $d data" {
6 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
7 for {set j
0} {$j < $len} {incr j
} {
9 set data
[randstring
0 16 alpha
]
11 set data
[randomInt
4000000000]
15 assert_equal
[r object
encoding key
] $e
16 set d1
[r debug digest
]
20 set d2
[r debug digest
]
22 error "assertion:$d1 is not equal to $d2"
28 foreach d
{string int
} {
29 foreach e
{intset hashtable
} {
30 test
"AOF rewrite of set with $e encoding, $d data" {
32 if {$e eq
{intset
}} {set len
10} else {set len
1000}
33 for {set j
0} {$j < $len} {incr j
} {
35 set data
[randstring
0 16 alpha
]
37 set data
[randomInt
4000000000]
42 assert_equal
[r object
encoding key
] $e
44 set d1
[r debug digest
]
48 set d2
[r debug digest
]
50 error "assertion:$d1 is not equal to $d2"
56 foreach d
{string int
} {
57 foreach e
{zipmap hashtable
} {
58 test
"AOF rewrite of hash with $e encoding, $d data" {
60 if {$e eq
{zipmap
}} {set len
10} else {set len
1000}
61 for {set j
0} {$j < $len} {incr j
} {
63 set data
[randstring
0 16 alpha
]
65 set data
[randomInt
4000000000]
67 r hset key
$data $data
69 assert_equal
[r object
encoding key
] $e
70 set d1
[r debug digest
]
74 set d2
[r debug digest
]
76 error "assertion:$d1 is not equal to $d2"
82 foreach d
{string int
} {
83 foreach e
{ziplist skiplist
} {
84 test
"AOF rewrite of zset with $e encoding, $d data" {
86 if {$e eq
{ziplist
}} {set len
10} else {set len
1000}
87 for {set j
0} {$j < $len} {incr j
} {
89 set data
[randstring
0 16 alpha
]
91 set data
[randomInt
4000000000]
93 r zadd key
[expr rand
()] $data
95 assert_equal
[r object
encoding key
] $e
96 set d1
[r debug digest
]
100 set d2
[r debug digest
]
102 error "assertion:$d1 is not equal to $d2"