summaryrefslogtreecommitdiffstats
path: root/tests/hash:ip,port,ip.t
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-11-05 17:03:50 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-11-05 17:03:50 +0100
commitde983b4ca4a93380b2190dcc86ffb722e7fbbf56 (patch)
tree90f95cf21e9964f76b51c80a223964f34ce67cf4 /tests/hash:ip,port,ip.t
parent73361cd4105b8b1e993f8220e2844d1ff0798000 (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,ip.t')
-rw-r--r--tests/hash:ip,port,ip.t36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/hash:ip,port,ip.t b/tests/hash:ip,port,ip.t
index 26710c6..8096d0c 100644
--- a/tests/hash:ip,port,ip.t
+++ b/tests/hash:ip,port,ip.t
@@ -62,4 +62,40 @@
0 n=`ipset list test|grep '^10.0'|wc -l` && test $n -eq 3072
# Destroy set
0 ipset -X test
+# Create set
+0 ipset create test hash:ip,port,ip
+# Add a single element
+0 ipset add test 10.0.0.1,tcp:80,2.2.2.1
+# 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.1
+# 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.1
+# 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.1
+# 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.1
+# 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.1
+# 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.1
+# 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.1
+# Check number of elements
+0 n=`ipset save test|wc -l` && test $n -eq 1
+# Destroy set
+0 ipset -X test
# eof