Skip to content

Commit

Permalink
Confirm the reason for the comment for each Tcl type
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxianrong committed Mar 19, 2024
1 parent f1f94c7 commit 3b823e6
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 48 deletions.
4 changes: 2 additions & 2 deletions tests/test_helper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ set ::all_tests {
unit/pubsub
unit/slowlog
unit/maxmemory
unit/bitops
unit/hyperloglog
unit/type
unit/acl
unit/type/geo
unit/geo
unit/type/bitops
unit/type/list
unit/type/list-2
unit/type/list-3
Expand Down
28 changes: 28 additions & 0 deletions tests/unit/type/geo.tcl → tests/unit/geo.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,34 @@ start_server {tags {"geo"}} {
assert_equal [r zrange points 0 -1] [r zrange points2 0 -1]
}

# The return value of Pika is inconsistent with Redis
# test {GEORANGE STOREDIST option: plain usage} {
# r del points
# r geoadd points 13.361389 38.115556 "Palermo" \
# 15.087269 37.502669 "Catania"
# r georadius points 13.361389 38.115556 500 km storedist points2
# set res [r zrange points2 0 -1 withscores]
# assert {[lindex $res 1] < 1}
# assert {[lindex $res 3] > 166}
# assert {[lindex $res 3] < 167}
# }

# The return value of Pika is inconsistent with Redis
# test {GEORANGE STOREDIST option: COUNT ASC and DESC} {
# r del points
# r geoadd points 13.361389 38.115556 "Palermo" \
# 15.087269 37.502669 "Catania"
# r georadius points 13.361389 38.115556 500 km storedist points2 asc count 1
# assert {[r zcard points2] == 1}
# set res [r zrange points2 0 -1 withscores]
# assert {[lindex $res 0] eq "Palermo"}
#
# r georadius points 13.361389 38.115556 500 km storedist points2 desc count 1
# assert {[r zcard points2] == 1}
# set res [r zrange points2 0 -1 withscores]
# assert {[lindex $res 0] eq "Catania"}
# }

test {GEOADD + GEORANGE randomized test} {
set attempt 30
while {[incr attempt -1]} {
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/hyperloglog.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ start_server {tags {"hll"}} {
# }
# }

The return value of Pika is inconsistent with Redis
# test {Corrupted sparse HyperLogLogs are detected: Additionl at tail} {
# r del hll
# r pfadd hll a b c
Expand All @@ -90,6 +91,7 @@ start_server {tags {"hll"}} {
# set e
# } {*INVALIDOBJ*}

The return value of Pika is inconsistent with Redis
# test {Corrupted sparse HyperLogLogs are detected: Broken magic} {
# r del hll
# r pfadd hll a b c
Expand All @@ -99,6 +101,7 @@ start_server {tags {"hll"}} {
# set e
# } {*WRONGTYPE*}

The return value of Pika is inconsistent with Redis
# test {Corrupted sparse HyperLogLogs are detected: Invalid encoding} {
# r del hll
# r pfadd hll a b c
Expand All @@ -108,6 +111,7 @@ start_server {tags {"hll"}} {
# set e
# } {*WRONGTYPE*}

The return value of Pika is inconsistent with Redis
# test {Corrupted dense HyperLogLogs are detected: Wrong length} {
# r del hll
# r pfadd hll a b c
Expand All @@ -117,6 +121,7 @@ start_server {tags {"hll"}} {
# set e
# } {*WRONGTYPE*}

The return value of Pika is inconsistent with Redis
# test {PFADD, PFCOUNT, PFMERGE type checking works} {
# r set foo bar
# catch {r pfadd foo 1} e
Expand All @@ -138,6 +143,7 @@ start_server {tags {"hll"}} {
r pfcount hll
} {5}

The return value of Pika is inconsistent with Redis
# test {PFCOUNT multiple-keys merge returns cardinality of union} {
# r del hll1 hll2 hll3
# for {set x 1} {$x < 100000} {incr x} {
Expand All @@ -153,6 +159,7 @@ start_server {tags {"hll"}} {
# }
# }

The return value of Pika is inconsistent with Redis
# test {HYPERLOGLOG press test: 5w, 10w, 15w, 20w, 30w, 50w, 100w} {
# r del hll1
# for {set x 1} {$x <= 1000000} {incr x} {
Expand Down Expand Up @@ -240,6 +247,7 @@ start_server {tags {"hll"}} {
# llength [r pfdebug getreg hll]
# } {16384}

# The return value of Pika is inconsistent with Redis
# test {PFADD / PFCOUNT cache invalidation works} {
# r del hll
# r pfadd hll a b c
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/multi.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ start_server {tags {"multi"}} {
r exec
} {PONG}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {EXEC fail on WATCHed key modified (1 key of 1 watched)} {
# r set x 30
# r watch x
Expand All @@ -104,7 +104,7 @@ start_server {tags {"multi"}} {
# r exec
# } {}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {EXEC fail on WATCHed key modified (1 key of 5 watched)} {
# r set x 30
# r watch a b x k z
Expand All @@ -114,7 +114,7 @@ start_server {tags {"multi"}} {
# r exec
# } {}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {EXEC fail on WATCHed key modified by SORT with STORE even if the result is empty} {
# r flushdb
# r lpush foo barsync"
Expand Down Expand Up @@ -164,7 +164,7 @@ start_server {tags {"multi"}} {
r unwatch
} {OK}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {FLUSHALL is able to touch the watched keys} {
# r set x 30
# r watch x
Expand All @@ -183,7 +183,7 @@ start_server {tags {"multi"}} {
r exec
} {PONG}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {FLUSHDB is able to touch the watched keys} {
# r set x 30
# r watch x
Expand All @@ -202,7 +202,7 @@ start_server {tags {"multi"}} {
r exec
} {PONG}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {WATCH is able to remember the DB a key belongs to} {
# r select 5
# r set x 30
Expand All @@ -218,7 +218,7 @@ start_server {tags {"multi"}} {
# set res
# } {PONG}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test {WATCH will consider touched keys target of EXPIRE} {
# r del x
# r set x foo
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/pubsub.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ start_server {tags {"pubsub"}} {
__consume_subscribe_messages $client punsubscribe $channels
}

# bug need fix
# The return value of Pika is inconsistent with Redis
# test "Pub/Sub PING" {
# set rd1 [redis_deferring_client]
# subscribe $rd1 somechannel
Expand Down
42 changes: 30 additions & 12 deletions tests/unit/bitops.tcl → tests/unit/type/bitops.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ start_server {tags {"bitops"}} {
r bitcount no-key
} 0

# Note The cause is to be confirmed
# catch {unset num}
# foreach vec [list "" "\xaa" "\x00\x00\xff" "foobar" "123"] {
# incr num
Expand All @@ -52,6 +53,7 @@ start_server {tags {"bitops"}} {
# }
# }

# Note The cause is to be confirmed
# test {BITCOUNT fuzzing without start/end} {
# for {set j 0} {$j < 100} {incr j} {
# set str [randstring 0 3000]
Expand All @@ -60,6 +62,7 @@ start_server {tags {"bitops"}} {
# }
# }

# Note The cause is to be confirmed
# test {BITCOUNT fuzzing with start/end} {
# for {set j 0} {$j < 100} {incr j} {
# set str [randstring 0 3000]
Expand Down Expand Up @@ -189,6 +192,7 @@ start_server {tags {"bitops"}} {
r get dest
} {2}

# Note The cause is to be confirmed
# test {BITOP with non string source key} {
# r del c
# r set a 1
Expand All @@ -204,36 +208,43 @@ start_server {tags {"bitops"}} {
r bitop or x a b
} {32}

# Note The cause is to be confirmed
# test {BITPOS bit=0 with empty key returns 0} {
# r del str
# r bitpos str 0
# } {0}

# Note The cause is to be confirmed
# test {BITPOS bit=1 with empty key returns -1} {
# r del str
# r bitpos str 1
# } {-1}
#

# Note The cause is to be confirmed
# test {BITPOS bit=0 with string less than 1 word works} {
# r set str "\xff\xf0\x00"
# r bitpos str 0
# } {12}
#

# Note The cause is to be confirmed
# test {BITPOS bit=1 with string less than 1 word works} {
# r set str "\x00\x0f\x00"
# r bitpos str 1
# } {12}
#

# Note The cause is to be confirmed
# test {BITPOS bit=0 starting at unaligned address} {
# r set str "\xff\xf0\x00"
# r bitpos str 0 1
# } {12}
#

# Note The cause is to be confirmed
# test {BITPOS bit=1 starting at unaligned address} {
# r set str "\x00\x0f\xff"
# r bitpos str 1 1
# } {12}
#

# Note The cause is to be confirmed
# test {BITPOS bit=0 unaligned+full word+reminder} {
# r del str
# r set str "\xff\xff\xff" ; # Prefix
Expand All @@ -253,7 +264,8 @@ start_server {tags {"bitops"}} {
# assert {[r bitpos str 0 7] == 216}
# assert {[r bitpos str 0 8] == 216}
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=1 unaligned+full word+reminder} {
# r del str
# r set str "\x00\x00\x00" ; # Prefix
Expand All @@ -273,15 +285,17 @@ start_server {tags {"bitops"}} {
# assert {[r bitpos str 1 7] == 216}
# assert {[r bitpos str 1 8] == 216}
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=1 returns -1 if string is all 0 bits} {
# r set str ""
# for {set j 0} {$j < 20} {incr j} {
# assert {[r bitpos str 1] == -1}
# r append str "\x00"
# }
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=0 works with intervals} {
# r set str "\x00\xff\x00"
# assert {[r bitpos str 0 0 -1] == 0}
Expand All @@ -290,7 +304,8 @@ start_server {tags {"bitops"}} {
# assert {[r bitpos str 0 2 200] == 16}
# assert {[r bitpos str 0 1 1] == -1}
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=1 works with intervals} {
# r set str "\x00\xff\x00"
# assert {[r bitpos str 1 0 -1] == 8}
Expand All @@ -299,14 +314,16 @@ start_server {tags {"bitops"}} {
# assert {[r bitpos str 1 2 200] == -1}
# assert {[r bitpos str 1 1 1] == 8}
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=0 changes behavior if end is given} {
# r set str "\xff\xff\xff"
# assert {[r bitpos str 0] == 24}
# assert {[r bitpos str 0 0] == 24}
# assert {[r bitpos str 0 0 -1] == -1}
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=1 fuzzy testing using SETBIT} {
# r del str
# set max 524288; # 64k
Expand All @@ -322,7 +339,8 @@ start_server {tags {"bitops"}} {
# }
# }
# }
#

# Note The cause is to be confirmed
# test {BITPOS bit=0 fuzzy testing using SETBIT} {
# set max 524288; # 64k
# set first_zero_pos $max
Expand Down
8 changes: 2 additions & 6 deletions tests/unit/type/list.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ start_server {
} {
source "tests/unit/type/list-common.tcl"

# No cause has been confirmed
test {LPUSH, RPUSH, LLENGTH, LINDEX, LPOP - ziplist} {
# first lpush then rpush
assert_equal 1 [r lpush myziplist1 a]
Expand Down Expand Up @@ -36,7 +35,6 @@ start_server {
#assert_encoding ziplist myziplist2
}

# No cause has been confirmed
test {LPUSH, RPUSH, LLENGTH, LINDEX, LPOP - regular list} {
# first lpush then rpush
assert_equal 1 [r lpush mylist1 $largevalue(linkedlist)]
Expand Down Expand Up @@ -458,11 +456,11 @@ start_server {
assert_equal {blist1 foo} [$rd read]
assert_equal 0 [r exists blist1]
}
# No cause has been confirmed(fix)

test "$pop: with negative timeout" {
set rd [redis_deferring_client]
$rd $pop blist1 -1
assert_error "ERR timeout can't be a negative value and can't exceed the number of seconds in 10 years" {$rd read}
assert_error "ERR*" {$rd read}
}

test "$pop: with non-integer timeout" {
Expand Down Expand Up @@ -566,7 +564,6 @@ start_server {
set e
} {*ERR*syntax*error*}

# No cause has been confirmed(fix)
test {LPUSHX, RPUSHX convert from ziplist to list} {
set large $largevalue(linkedlist)

Expand All @@ -587,7 +584,6 @@ start_server {
# assert_encoding linkedlist xlist
}

# No cause has been confirmed(fix)
test {LINSERT convert from ziplist to list} {
set large $largevalue(linkedlist)

Expand Down
Loading

0 comments on commit 3b823e6

Please sign in to comment.