summaryrefslogtreecommitdiffstats
path: root/tests/check_cidrs.sh
blob: ee89e379a0022245cd911c34ab405d66dab7133d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

set -e

cmd=../src/ipset

$cmd f
$cmd x
$cmd n test hash:net
for x in `seq 1 32`; do
    $cmd a test 10.0.0.0/$x
    n=`$cmd l test | wc -l`
    n=$((n - 7))
    test $n -eq $x || exit 1
done
for x in `seq 32 -1 1`; do
    $cmd d test 10.0.0.0/$x
    n=`$cmd l test | wc -l`
    # We deleted one element
    n=$((n - 7 + 1))
    test $n -eq $x || exit 1
done
$cmd x test