diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-11-05 17:03:50 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-11-05 17:03:50 +0100 |
commit | de983b4ca4a93380b2190dcc86ffb722e7fbbf56 (patch) | |
tree | 90f95cf21e9964f76b51c80a223964f34ce67cf4 /tests/hash:ip,port,net.t | |
parent | 73361cd4105b8b1e993f8220e2844d1ff0798000 (diff) |
Add tests to check completely ranges with hash types
Test all possible range variations with the hash types in order
to catch bugs like the range bug in hash:ip,port,net.
Diffstat (limited to 'tests/hash:ip,port,net.t')
-rw-r--r-- | tests/hash:ip,port,net.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/hash:ip,port,net.t b/tests/hash:ip,port,net.t index dad551a..e0c8c08 100644 --- a/tests/hash:ip,port,net.t +++ b/tests/hash:ip,port,net.t @@ -92,4 +92,40 @@ 0 ipset -T test 2.2.2.2,80,1.1.1.3 # Delete test set 0 ipset destroy test +# Create set +0 ipset create test hash:ip,port,net +# Add a single element +0 ipset add test 10.0.0.1,tcp:80,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 2 +# Delete the single element +0 ipset del test 10.0.0.1,tcp:80,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 1 +# Add an IP range +0 ipset add test 10.0.0.1-10.0.0.10,tcp:80,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 11 +# Delete the IP range +0 ipset del test 10.0.0.1-10.0.0.10,tcp:80,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 1 +# Add a port range +0 ipset add test 10.0.0.1,tcp:80-89,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 11 +# Delete the port range +0 ipset del test 10.0.0.1,tcp:80-89,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 1 +# Add an IP and port range +0 ipset add test 10.0.0.1-10.0.0.10,tcp:80-89,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 101 +# Delete the IP and port range +0 ipset del test 10.0.0.1-10.0.0.10,tcp:80-89,2.2.2.0/24 +# Check number of elements +0 n=`ipset save test|wc -l` && test $n -eq 1 +# Destroy set +0 ipset -X test # eof |