add project
This commit is contained in:
82
CommandTests/09_sorted_set_tests.sh
Executable file
82
CommandTests/09_sorted_set_tests.sh
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== Testing Sorted Set Commands ==="
|
||||
|
||||
# Test ZADD and ZRANGE
|
||||
echo "Testing ZADD and ZRANGE..."
|
||||
dotnet run -- zadd leaderboard 100 "player1" -i localhost
|
||||
dotnet run -- zadd leaderboard 200 "player2" -i localhost
|
||||
dotnet run -- zadd leaderboard 150 "player3" -i localhost
|
||||
dotnet run -- zrange leaderboard 0 -1 -i localhost
|
||||
dotnet run -- zrange leaderboard 0 -1 withscores -i localhost
|
||||
|
||||
# Test ZSCORE
|
||||
echo "Testing ZSCORE..."
|
||||
dotnet run -- zscore leaderboard "player1" -i localhost
|
||||
dotnet run -- zscore leaderboard "player2" -i localhost
|
||||
|
||||
# Test ZRANK and ZREVRANK
|
||||
echo "Testing ZRANK and ZREVRANK..."
|
||||
dotnet run -- zrank leaderboard "player1" -i localhost
|
||||
dotnet run -- zrevrank leaderboard "player1" -i localhost
|
||||
|
||||
# Test ZCARD
|
||||
echo "Testing ZCARD..."
|
||||
dotnet run -- zcard leaderboard -i localhost
|
||||
|
||||
# Test ZREM
|
||||
echo "Testing ZREM..."
|
||||
dotnet run -- zrem leaderboard "player2" -i localhost
|
||||
dotnet run -- zrange leaderboard 0 -1 -i localhost
|
||||
|
||||
# Test ZRANGEBYSCORE and ZREVRANGEBYSCORE
|
||||
echo "Testing ZRANGEBYSCORE and ZREVRANGEBYSCORE..."
|
||||
dotnet run -- zadd scores 50 "user1" -i localhost
|
||||
dotnet run -- zadd scores 75 "user2" -i localhost
|
||||
dotnet run -- zadd scores 90 "user3" -i localhost
|
||||
dotnet run -- zadd scores 120 "user4" -i localhost
|
||||
|
||||
dotnet run -- zrangebyscore scores 60 100 -i localhost
|
||||
dotnet run -- zrangebyscore scores 60 100 withscores -i localhost
|
||||
dotnet run -- zrevrangebyscore scores 100 60 -i localhost
|
||||
|
||||
# Test ZCOUNT
|
||||
echo "Testing ZCOUNT..."
|
||||
dotnet run -- zcount scores 60 100 -i localhost
|
||||
|
||||
# Test ZINCRBY
|
||||
echo "Testing ZINCRBY..."
|
||||
dotnet run -- zincrby scores 25 "user1" -i localhost
|
||||
dotnet run -- zscore scores "user1" -i localhost
|
||||
|
||||
# Test ZUNIONSTORE and ZINTERSTORE
|
||||
echo "Testing ZUNIONSTORE and ZINTERSTORE..."
|
||||
dotnet run -- zadd set1 1 "a" 2 "b" 3 "c" -i localhost
|
||||
dotnet run -- zadd set2 2 "b" 3 "c" 4 "d" -i localhost
|
||||
|
||||
dotnet run -- zunionstore union_result 2 set1 set2 -i localhost
|
||||
dotnet run -- zinterstore inter_result 2 set1 set2 -i localhost
|
||||
|
||||
dotnet run -- zrange union_result 0 -1 withscores -i localhost
|
||||
dotnet run -- zrange inter_result 0 -1 withscores -i localhost
|
||||
|
||||
# Test ZSCAN
|
||||
echo "Testing ZSCAN..."
|
||||
dotnet run -- zscan scores 0 -i localhost
|
||||
|
||||
# Test ZPOPMAX and ZPOPMIN
|
||||
echo "Testing ZPOPMAX and ZPOPMIN..."
|
||||
dotnet run -- zpopmax scores -i localhost
|
||||
dotnet run -- zpopmin scores -i localhost
|
||||
|
||||
# Test ZREMRANGEBYRANK and ZREMRANGEBYSCORE
|
||||
echo "Testing ZREMRANGEBYRANK and ZREMRANGEBYSCORE..."
|
||||
dotnet run -- zadd test_set 10 "item1" 20 "item2" 30 "item3" 40 "item4" -i localhost
|
||||
dotnet run -- zremrangebyrank test_set 1 2 -i localhost
|
||||
dotnet run -- zrange test_set 0 -1 -i localhost
|
||||
|
||||
dotnet run -- zadd test_set2 10 "item1" 20 "item2" 30 "item3" 40 "item4" -i localhost
|
||||
dotnet run -- zremrangebyscore test_set2 15 35 -i localhost
|
||||
dotnet run -- zrange test_set2 0 -1 -i localhost
|
||||
|
||||
echo "Sorted Set tests completed!"
|
||||
Reference in New Issue
Block a user