Closed Mixficsol closed 4 months ago
以这段代码举例, r 代表 Redis 执行,所以下面这段代码意思是先执行 Del novar 命令,然后再执行 setnx novar foobared 命令检查返回值是不是 1, 然后执行 get novar 检查返回值是不是 foobared,这就是一个最简单的 TCL 样例
r
Redis
Del novar
setnx novar foobared
1
get novar
foobared
TCL
test "SETNX target key missing" { r del novar assert_equal 1 [r setnx novar foobared] assert_equal "foobared" [r get novar] }
./pikatests.sh all
Set
./pikiwidbtests.sh type/set
在 test_helpter.tcl 文件下注释了大部分的测试,如果有需要可以自行解开(因为现在大部分测试都跑不过,所以我都先注释掉了)
test_helpter.tcl
set ::all_tests { # unit/printver # unit/basic # unit/scan # unit/multi # unit/quit # unit/type/list # unit/pubsub # unit/slowlog # unit/maxmemory # unit/bitops # unit/hyperloglog # unit/type # unit/acl # unit/type/list-2 # unit/type/list-3 # unit/type/set # unit/type/zset # unit/type/string unit/type/hash # unit/expire # unit/protocol # unit/other # unit/auth # unit/sort # unit/aofrw # unit/scripting # unit/introspection # unit/limits # unit/obuf-limits # unit/dump # unit/memefficiency # unit/command # unit/tcl/replication # unit/tcl/replication-2 # unit/tcl/replication-3 # unit/tcl/replication-4 # unit/tcl/replication-psync # unit/tcl/aof # unit/tcl/rdb # unit/tcl/convert-zipmap-hash-on-load }
快速入门 TCL
以这段代码举例,
r
代表Redis
执行,所以下面这段代码意思是先执行Del novar
命令,然后再执行setnx novar foobared
命令检查返回值是不是1
, 然后执行get novar
检查返回值是不是foobared
,这就是一个最简单的TCL
样例./pikatests.sh all
测试 PikiwiDB 所有命令Set
类型的命令, 执行./pikiwidbtests.sh type/set
测试 PikiwiDB SET 命令(其他的类似)在
test_helpter.tcl
文件下注释了大部分的测试,如果有需要可以自行解开(因为现在大部分测试都跑不过,所以我都先注释掉了)