#!/bin/bash echo "=== Testing Set Commands ===" # Test SADD and SMEMBERS echo "Testing SADD and SMEMBERS..." dotnet run -- sadd set1 "apple" -i localhost dotnet run -- sadd set1 "banana" -i localhost dotnet run -- sadd set1 "cherry" -i localhost dotnet run -- smembers set1 -i localhost # Test SISMEMBER echo "Testing SISMEMBER..." dotnet run -- sismember set1 "apple" -i localhost dotnet run -- sismember set1 "orange" -i localhost # Test SCARD echo "Testing SCARD..." dotnet run -- scard set1 -i localhost # Test SPOP and SRANDMEMBER echo "Testing SPOP and SRANDMEMBER..." dotnet run -- sadd set2 "one" "two" "three" "four" "five" -i localhost dotnet run -- spop set2 -i localhost dotnet run -- srandmember set2 -i localhost dotnet run -- srandmember set2 2 -i localhost # Test SREM echo "Testing SREM..." dotnet run -- srem set1 "banana" -i localhost dotnet run -- smembers set1 -i localhost # Test Set operations with multiple sets echo "Testing Set operations..." dotnet run -- sadd set3 "apple" "banana" "grape" -i localhost dotnet run -- sadd set4 "banana" "cherry" "date" -i localhost # Test SINTER echo "Testing SINTER..." dotnet run -- sinter set1 set3 set4 -i localhost # Test SUNION echo "Testing SUNION..." dotnet run -- sunion set1 set3 set4 -i localhost # Test SDIFF echo "Testing SDIFF..." dotnet run -- sdiff set3 set4 -i localhost # Test SINTERSTORE, SUNIONSTORE, SDIFFSTORE echo "Testing SINTERSTORE, SUNIONSTORE, SDIFFSTORE..." dotnet run -- sinterstore result1 set1 set3 -i localhost dotnet run -- sunionstore result2 set1 set3 -i localhost dotnet run -- sdiffstore result3 set3 set4 -i localhost dotnet run -- smembers result1 -i localhost dotnet run -- smembers result2 -i localhost dotnet run -- smembers result3 -i localhost # Test SSCAN echo "Testing SSCAN..." dotnet run -- sscan set3 0 -i localhost # Test SMOVE echo "Testing SMOVE..." dotnet run -- sadd source_set "item1" "item2" "item3" -i localhost dotnet run -- sadd dest_set "existing_item" -i localhost dotnet run -- smove source_set dest_set "item2" -i localhost dotnet run -- smembers source_set -i localhost dotnet run -- smembers dest_set -i localhost echo "Set tests completed!"