add project
This commit is contained in:
62
CommandTests/03_hash_tests.sh
Executable file
62
CommandTests/03_hash_tests.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== Testing Hash Commands ==="
|
||||
|
||||
# Test HSET and HGET
|
||||
echo "Testing HSET and HGET..."
|
||||
dotnet run -- hset user:1000 name "John Doe" -i localhost
|
||||
dotnet run -- hset user:1000 email "john@example.com" -i localhost
|
||||
dotnet run -- hset user:1000 age "30" -i localhost
|
||||
|
||||
dotnet run -- hget user:1000 name -i localhost
|
||||
dotnet run -- hget user:1000 email -i localhost
|
||||
dotnet run -- hget user:1000 age -i localhost
|
||||
|
||||
# Test HGETALL
|
||||
echo "Testing HGETALL..."
|
||||
dotnet run -- hgetall user:1000 -i localhost
|
||||
|
||||
# Test HKEYS and HVALS
|
||||
echo "Testing HKEYS and HVALS..."
|
||||
dotnet run -- hkeys user:1000 -i localhost
|
||||
dotnet run -- hvals user:1000 -i localhost
|
||||
|
||||
# Test HEXISTS
|
||||
echo "Testing HEXISTS..."
|
||||
dotnet run -- hexists user:1000 name -i localhost
|
||||
dotnet run -- hexists user:1000 phone -i localhost
|
||||
|
||||
# Test HLEN
|
||||
echo "Testing HLEN..."
|
||||
dotnet run -- hlen user:1000 -i localhost
|
||||
|
||||
# Test HINCRBY and HINCRBYFLOAT
|
||||
echo "Testing HINCRBY and HINCRBYFLOAT..."
|
||||
dotnet run -- hset user:1000 score "100" -i localhost
|
||||
dotnet run -- hincrby user:1000 score "10" -i localhost
|
||||
dotnet run -- hincrbyfloat user:1000 score "5.5" -i localhost
|
||||
|
||||
# Test HMSET and HMGET
|
||||
echo "Testing HMSET and HMGET..."
|
||||
dotnet run -- hmset user:1001 name "Jane Smith" email "jane@example.com" age "25" -i localhost
|
||||
dotnet run -- hmget user:1001 name email age -i localhost
|
||||
|
||||
# Test HSETNX
|
||||
echo "Testing HSETNX..."
|
||||
dotnet run -- hsetnx user:1000 name "New Name" -i localhost
|
||||
dotnet run -- hsetnx user:1000 phone "123-456-7890" -i localhost
|
||||
|
||||
# Test HSTRLEN
|
||||
echo "Testing HSTRLEN..."
|
||||
dotnet run -- hstrlen user:1000 name -i localhost
|
||||
|
||||
# Test HDEL
|
||||
echo "Testing HDEL..."
|
||||
dotnet run -- hdel user:1000 age -i localhost
|
||||
dotnet run -- hgetall user:1000 -i localhost
|
||||
|
||||
# Test HSCAN
|
||||
echo "Testing HSCAN..."
|
||||
dotnet run -- hscan user:1000 0 -i localhost
|
||||
|
||||
echo "Hash tests completed!"
|
||||
Reference in New Issue
Block a user