]> git.ipfire.org Git - network.git/commitdiff
test: add test for function ip_protocol_is_supported
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 31 May 2017 13:04:38 +0000 (15:04 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 31 May 2017 13:04:38 +0000 (15:04 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
test/functions/ip/ip_protocol_is_supported [new file with mode: 0755]

diff --git a/test/functions/ip/ip_protocol_is_supported b/test/functions/ip/ip_protocol_is_supported
new file mode 100755 (executable)
index 0000000..39acf65
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. ${networkdir}/functions
+
+. ${testdir}/constants.sh
+
+failed=0
+
+for proto in ${IP_TEST_SUPPORTED_PROTOCOLS[@]}; do
+       if ip_protocol_is_supported ${proto}; then
+               echo "OK: IP protocol ${proto} is supported"
+       else
+               echo "ERROR: IP protocol ${proto} is not supported"
+               failed=1
+       fi
+done
+
+for proto in ${IP_TEST_UNSUPPORTED_PROTOCOLS[@]}; do
+       if ! ip_protocol_is_supported ${proto}; then
+               echo "OK: IP protocol ${proto} is not supported"
+       else
+               echo "ERROR: IP protocol ${proto} is  supported"
+               failed=1
+       fi
+done
+
+exit ${failed}