summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2013-05-30 05:17:47 -0700
committerDaniil Baturin <daniil@baturin.org>2013-05-30 05:17:47 -0700
commit4ef4010bae7c7a2ba8a8879a316d89506cd4b9b0 (patch)
treecea0e1c314b68ed4c29e0046cf2168f85d9874c4
parentcb79e7a9d6b487442a65e5326c9b2b6c5b7ae1d8 (diff)
downloadipaddrcheck-4ef4010bae7c7a2ba8a8879a316d89506cd4b9b0.tar.gz
ipaddrcheck-4ef4010bae7c7a2ba8a8879a316d89506cd4b9b0.zip
Add integration tests skeleton and some testcases, include in "make check" target.
-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