From 238e1aec1262acb88eb99d14fee952a9e3a2ea1f Mon Sep 17 00:00:00 2001 From: zeekling Date: Mon, 14 Feb 2022 23:19:11 +0800 Subject: [PATCH] add shell test --- test/commands/zset.txt | 12 ++++++++++++ test/exec_redis.sh | 13 +++++++++++++ test/zset.sh | 6 ++++++ 3 files changed, 31 insertions(+) create mode 100644 test/commands/zset.txt create mode 100755 test/exec_redis.sh create mode 100755 test/zset.sh diff --git a/test/commands/zset.txt b/test/commands/zset.txt new file mode 100644 index 0000000..27accff --- /dev/null +++ b/test/commands/zset.txt @@ -0,0 +1,12 @@ +del books_zset +zadd books_zset 9.0 "think in java" +zadd books_zset 8.9 "java concurrency" +zadd books_zset 8.6 "java cookbook" +zrange books_zset 0 -1 +zrevrange books_zset 0 -1 +zcard books_zset +zscore books_zset "java concurrency" +zrank books_zset "java concurrency" +zrangebyscore books_zset -inf 8.91 withscores +zrem books_zset "java concurrency" +zrange books_zset 0 -1 diff --git a/test/exec_redis.sh b/test/exec_redis.sh new file mode 100755 index 0000000..57c5e5c --- /dev/null +++ b/test/exec_redis.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +function exec() { + ip="$1" + port="$2" + file="$3" + while read line + do + echo "> $line" + echo $line | redis-cli -h "$ip" -p "$port" + done < $file +} + diff --git a/test/zset.sh b/test/zset.sh new file mode 100755 index 0000000..b230ca8 --- /dev/null +++ b/test/zset.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +source ./exec_redis.sh + +exec "127.0.0.1" "6379" commands/zset.txt + -- 2.45.2