summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Makefile.am5
-rwxr-xr-xtests/integration_tests.sh17
2 files changed, 21 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9b04635..ee90ab2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,7 @@
-TESTS = check_ipaddrcheck
+TESTS = check_ipaddrcheck integration_tests.sh
+
+TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) PATH=.:../src:$$PATH
+
check_PROGRAMS = check_ipaddrcheck
check_ipaddrcheck_SOURCES = check_ipaddrcheck.c ../src/ipaddrcheck_functions.c
check_ipaddrcheck_CFLAGS = @CHECK_CFLAGS@
diff --git a/tests/integration_tests.sh b/tests/integration_tests.sh
new file mode 100755
index 0000000..8900425
--- /dev/null
+++ b/tests/integration_tests.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+. ./assert.sh
+
+IPADDRCHECK=ipaddrcheck
+
+# begin ipaddrcheck_integration
+
+assert_raises "$IPADDRCHECK --is-valid 192.0.2.1" 0
+assert_raises "$IPADDRCHECK --is-valid 192.0.2.1/24" 0
+assert_raises "$IPADDRCHECK --is-valid 192.0.2.0/26" 0
+assert_raises "$IPADDRCHECK --is-valid 2001:db8::1" 0
+assert_raises "$IPADDRCHECK --is-valid 2001:db8::/56" 0
+assert_raises "$IPADDRCHECK --is-valid 192.0.2.666" 1
+assert_raises "$IPADDRCHECK --is-valid garbage" 1
+
+assert_end ipaddrcheck_integration