add project
This commit is contained in:
70
CommandTests/07_list_tests.sh
Executable file
70
CommandTests/07_list_tests.sh
Executable file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== Testing List Commands ==="
|
||||
|
||||
# Test LPUSH and RPUSH
|
||||
echo "Testing LPUSH and RPUSH..."
|
||||
dotnet run -- lpush mylist "first" -i localhost
|
||||
dotnet run -- lpush mylist "second" -i localhost
|
||||
dotnet run -- rpush mylist "third" -i localhost
|
||||
dotnet run -- rpush mylist "fourth" -i localhost
|
||||
|
||||
# Test LLEN
|
||||
echo "Testing LLEN..."
|
||||
dotnet run -- llen mylist -i localhost
|
||||
|
||||
# Test LRANGE
|
||||
echo "Testing LRANGE..."
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
dotnet run -- lrange mylist 0 1 -i localhost
|
||||
dotnet run -- lrange mylist 1 2 -i localhost
|
||||
|
||||
# Test LINDEX
|
||||
echo "Testing LINDEX..."
|
||||
dotnet run -- lindex mylist 0 -i localhost
|
||||
dotnet run -- lindex mylist 1 -i localhost
|
||||
dotnet run -- lindex mylist -1 -i localhost
|
||||
|
||||
# Test LSET
|
||||
echo "Testing LSET..."
|
||||
dotnet run -- lset mylist 1 "updated_second" -i localhost
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
|
||||
# Test LINSERT
|
||||
echo "Testing LINSERT..."
|
||||
dotnet run -- linsert mylist before "updated_second" "before_second" -i localhost
|
||||
dotnet run -- linsert mylist after "updated_second" "after_second" -i localhost
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
|
||||
# Test LREM
|
||||
echo "Testing LREM..."
|
||||
dotnet run -- lpush mylist "duplicate" -i localhost
|
||||
dotnet run -- lpush mylist "duplicate" -i localhost
|
||||
dotnet run -- lrem mylist 2 "duplicate" -i localhost
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
|
||||
# Test LTRIM
|
||||
echo "Testing LTRIM..."
|
||||
dotnet run -- ltrim mylist 1 3 -i localhost
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
|
||||
# Test LPOP and RPOP
|
||||
echo "Testing LPOP and RPOP..."
|
||||
dotnet run -- lpop mylist -i localhost
|
||||
dotnet run -- rpop mylist -i localhost
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
|
||||
# Test BLPOP and BRPOP (with timeout)
|
||||
echo "Testing BLPOP and BRPOP..."
|
||||
dotnet run -- blpop mylist 1 -i localhost
|
||||
dotnet run -- brpop mylist 1 -i localhost
|
||||
|
||||
# Test RPOPLPUSH
|
||||
echo "Testing RPOPLPUSH..."
|
||||
dotnet run -- rpush mylist "last_item" -i localhost
|
||||
dotnet run -- rpush otherlist "existing_item" -i localhost
|
||||
dotnet run -- rpoplpush mylist otherlist -i localhost
|
||||
dotnet run -- lrange mylist 0 -1 -i localhost
|
||||
dotnet run -- lrange otherlist 0 -1 -i localhost
|
||||
|
||||
echo "List tests completed!"
|
||||
Reference in New Issue
Block a user