From: Jonatan Schlag Date: Wed, 31 May 2017 13:06:33 +0000 (+0200) Subject: test: add test for function ip_is_network X-Git-Tag: 009~250^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3fa921294d27bb1b9c34358e0d1001912ed735ba;p=network.git test: add test for function ip_is_network Signed-off-by: Jonatan Schlag --- diff --git a/test/functions/ip/ip_is_network b/test/functions/ip/ip_is_network new file mode 100755 index 00000000..6570ad28 --- /dev/null +++ b/test/functions/ip/ip_is_network @@ -0,0 +1,27 @@ +#!/bin/bash + +. ${networkdir}/functions + +. ${testdir}/constants.sh + +failed=0 + +for network in ${VALID_NETWORKS[@]}; do + if ip_is_network ${network}; then + echo "OK: network: ${network} is valid" + else + echo "ERROR: network ${network} is invalid" + failed=1 + fi +done + +for network in ${INVALID_NETWORKS[@]}; do + if ! ip_is_network ${network}; then + echo "OK: network: ${network} is invalid" + else + echo "ERROR: network: ${network} is valid" + failed=1 + fi +done + +exit ${failed}