summaryrefslogtreecommitdiffstats
path: root/tests/hash:ip,port.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.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.t')
-rw-r--r--tests/hash:ip,port.t34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/hash:ip,port.t b/tests/hash:ip,port.t
index cd1140e..253c6af 100644
--- a/tests/hash:ip,port.t
+++ b/tests/hash:ip,port.t
@@ -80,6 +80,40 @@
0 ipset add test 10.0.0.0-10.0.3.255,tcp:80-82
# Check that correct number of elements are added
0 n=`ipset list test|grep '^10.0'|wc -l` && test $n -eq 3072
+# Flush set
+0 ipset flush test
+# Add an single element
+0 ipset add test 10.0.0.1,tcp:80
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# 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
+# Check number of elements
+0 n=`ipset save test|wc -l` && test $n -eq 1
# Destroy set
0 ipset -X test
# eof