diff options
author | Daniil Baturin <daniil@vyos.io> | 2020-06-10 19:55:40 +0300 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2020-06-10 19:55:40 +0300 |
commit | 079d3f39b3b7bdbb54e06980f6f0705928378d6e (patch) | |
tree | d30647987149abfdc721dded8e6b1a61989d2421 | |
parent | 8dc86262d85c26b54426f3fa41e1e281c1ad1910 (diff) | |
download | ipaddrcheck-079d3f39b3b7bdbb54e06980f6f0705928378d6e.tar.gz ipaddrcheck-079d3f39b3b7bdbb54e06980f6f0705928378d6e.zip |
Add tests for --is-any-host
-rwxr-xr-x | tests/integration_tests.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/integration_tests.sh b/tests/integration_tests.sh index b6a2489..9999005 100755 --- a/tests/integration_tests.sh +++ b/tests/integration_tests.sh @@ -74,6 +74,26 @@ ipv6_cidr_negative=( 2001:db8::/129 ) +ipv4_host_positive=( + 192.0.2.1/24 + 192.0.2.100/32 + 192.0.2.100/31 +) + +ipv4_host_negative=( + 192.0.2.0/24 + 192.0.2.64/27 +) + +ipv6_host_positive=( + 2001:db8:1::1/64 + 2001:db8:1::1/127 +) + +ipv6_host_negative=( + 2001:db8::/32 +) + string="garbage" # begin ipaddrcheck_integration @@ -189,6 +209,31 @@ do done # --is-any-host +for address in \ + ${ipv4_host_positive[*]} +do + assert_raises "$IPADDRCHECK --is-any-host $address" 0 +done + +for address in \ + ${ipv4_host_negative[*]} +do + assert_raises "$IPADDRCHECK --is-any-host $address" 1 +done + +for address in \ + ${ipv6_host_positive[*]} +do + assert_raises "$IPADDRCHECK --is-any-host $address" 0 +done + +for address in \ + ${ipv6_host_negative[*]} +do + assert_raises "$IPADDRCHECK --is-any-host $address" 1 +done + + # --is-any-net # --is-ipv4-host # --is-ipv4-net |