summaryrefslogtreecommitdiffstats
path: root/debian/tests
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/check4
-rw-r--r--debian/tests/control15
-rw-r--r--debian/tests/deagrregate2
-rw-r--r--debian/tests/geo4
-rw-r--r--debian/tests/info4
-rw-r--r--debian/tests/json2
-rw-r--r--debian/tests/net11
-rw-r--r--debian/tests/random7
-rw-r--r--debian/tests/resolv2
-rw-r--r--debian/tests/reversedns2
-rw-r--r--debian/tests/split1
11 files changed, 54 insertions, 0 deletions
diff --git a/debian/tests/check b/debian/tests/check
new file mode 100644
index 0000000..12f860a
--- /dev/null
+++ b/debian/tests/check
@@ -0,0 +1,4 @@
+ipcalc-ng -c 192.168.0.1
+ipcalc-ng -c 192.168.0.256 2>&1 | grep 'bad IPv4 address'
+ipcalc-ng -c 2804:14c:87c5:d3f8:6245:cbff:fe6d:d19/64
+ipcalc-ng -c 2804:14c:87c5:d3f8:6245:cbff:fe6d:g19/64 2>&1 | grep 'bad IPv6 address'
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..520037c
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,15 @@
+Test-Command: ipcalc-ng -v
+Restrictions: superficial
+
+Test-Command: ipcalc-ng --help 2>&1 | grep '^Usage:'
+Restrictions: superficial
+
+Tests: check, deagrregate, geo, info, net, random, reversedns, split
+Depends: @, geoip-database, libgeoip1
+
+Tests: json
+Depends: @, geoip-database, libgeoip1, jq
+
+Tests: resolv
+Depends: @, geoip-database, libgeoip1
+Restrictions: flaky
diff --git a/debian/tests/deagrregate b/debian/tests/deagrregate
new file mode 100644
index 0000000..416b6ce
--- /dev/null
+++ b/debian/tests/deagrregate
@@ -0,0 +1,2 @@
+ipcalc-ng -d 192.168.1.3-192.168.1.23 | grep -A4 'Deaggregated'
+ipcalc-ng --no-decorate -d 192.168.1.3-192.168.1.23 | grep '^192\.'
diff --git a/debian/tests/geo b/debian/tests/geo
new file mode 100644
index 0000000..b01728a
--- /dev/null
+++ b/debian/tests/geo
@@ -0,0 +1,4 @@
+ipcalc-ng -g 200.189.123.110 | egrep '(COUNTRYCODE=BR|COUNTRY=Brazil)'
+ipcalc-ng -g 193.92.150.2/255.255.255.224 | egrep '(COUNTRYCODE=GR|COUNTRY=Greece)'
+ipcalc-ng -g 2a03:2880:20:4f06:face:b00c:0:14/64 | egrep '(COUNTRYCODE=IE|COUNTRY=Ireland)'
+ipcalc-ng -g 2804:14c:87c5:d3f8:6245:cbff:fe6d:d19/64 | egrep '(COUNTRYCODE=BR|COUNTRY=Brazil)'
diff --git a/debian/tests/info b/debian/tests/info
new file mode 100644
index 0000000..8f11db7
--- /dev/null
+++ b/debian/tests/info
@@ -0,0 +1,4 @@
+ipcalc-ng --all-info 193.92.150.2/24
+ipcalc-ng --all-info 2a03:2880:20:4f06:face:b00c:0:14/64
+ipcalc-ng -pnmb --minaddr --maxaddr --geoinfo --addrspace 193.92.150.2/255.255.255.224
+ipcalc-ng -pnmb --minaddr --maxaddr --addrspace --geoinfo 2a03:2880:20:4f06:face:b00c:0:14/64
diff --git a/debian/tests/json b/debian/tests/json
new file mode 100644
index 0000000..a8c16ff
--- /dev/null
+++ b/debian/tests/json
@@ -0,0 +1,2 @@
+ipcalc-ng --all-info -j 2a03:2880:20:4f06:face:b00c:0:14/64 | jq .
+ipcalc-ng --all-info -j 200.202.17.0/24 | jq .
diff --git a/debian/tests/net b/debian/tests/net
new file mode 100644
index 0000000..d679754
--- /dev/null
+++ b/debian/tests/net
@@ -0,0 +1,11 @@
+ipcalc-ng -a 192.168.1.1
+ipcalc-ng -b 192.168.1.1
+ipcalc-ng -b 192.168.1.0
+ipcalc-ng -b 192.168.1.0/24
+ipcalc-ng -b 192.168.1.0/32
+ipcalc-ng -b 192.168.1.0/24
+ipcalc-ng -a 192.168.1.0/24
+ipcalc-ng -m 192.168.1.0/24
+ipcalc-ng -m 192.168.1.1
+ipcalc-ng -p 192.168.1.1
+ipcalc-ng -p 192.168.1.0/255.255.255.0
diff --git a/debian/tests/random b/debian/tests/random
new file mode 100644
index 0000000..a05244b
--- /dev/null
+++ b/debian/tests/random
@@ -0,0 +1,7 @@
+ipcalc-ng -r 24 | grep '255.255.255.0 = 24'
+ipcalc-ng -r 29 | grep '255.255.255.248 = 29'
+ipcalc-ng -r 30 | grep '255.255.255.252 = 30'
+ipcalc-ng -r 255.255.255.0 | grep '255.255.255.0 = 24'
+ipcalc-ng -r 255.255.255.248 | grep '255.255.255.248 = 29'
+ipcalc-ng -r 255.255.255.252 | grep '255.255.255.252 = 30'
+
diff --git a/debian/tests/resolv b/debian/tests/resolv
new file mode 100644
index 0000000..9c4defb
--- /dev/null
+++ b/debian/tests/resolv
@@ -0,0 +1,2 @@
+ipcalc-ng -h 8.8.8.8 | grep 'HOSTNAME=.*google*'
+ipcalc-ng -o pr.gov.br
diff --git a/debian/tests/reversedns b/debian/tests/reversedns
new file mode 100644
index 0000000..b364534
--- /dev/null
+++ b/debian/tests/reversedns
@@ -0,0 +1,2 @@
+ipcalc-ng --reverse-dns 10.0.0.1 | grep '1.0.0.10.in-addr.arpa'
+ipcalc-ng --reverse-dns 10.0.0.0/8 | grep '10.in-addr.arpa'
diff --git a/debian/tests/split b/debian/tests/split
new file mode 100644
index 0000000..2b50a63
--- /dev/null
+++ b/debian/tests/split
@@ -0,0 +1 @@
+ipcalc-ng -S 30 192.168.0.0/24 | grep -A2 'Total.*64'