tests: Conditional compilation of tests (including boost-based unit tests)
To compile tests, code needs to be configured with --with-tests option,
otherwise all tests are disabled.
Tests that are based on Boost's unit test framework are enabled only if
the framework is detected during the configure time.
Change-Id: Ia1768e24b088e4f19d2a8799c6d5baeabb2f44c5
diff --git a/tests_boost/Makefile.am b/tests_boost/Makefile.am
new file mode 100644
index 0000000..baf187a
--- /dev/null
+++ b/tests_boost/Makefile.am
@@ -0,0 +1,11 @@
+
+noinst_PROGRAMS=unit-tests
+
+# for i in `find . -name '*.cpp'`; do echo " $i \\"; done
+unit_tests_SOURCES = \
+ main.cpp \
+ test-encode-decode-certificate.cpp \
+ test-encode-decode-data.cpp \
+ test-encode-decode-interest.cpp
+
+unit_tests_LDADD = ../libndn-cpp.la @BOOST_SYSTEM_LIB@ @BOOST_UNIT_TEST_FRAMEWORK_LIB@
diff --git a/tests_boost/test-encode-decode-certificate.cpp b/tests_boost/test-encode-decode-certificate.cpp
index 4743c95..9acc569 100644
--- a/tests_boost/test-encode-decode-certificate.cpp
+++ b/tests_boost/test-encode-decode-certificate.cpp
@@ -9,6 +9,11 @@
#include <ndn-cpp/security/certificate/certificate.hpp>
#include <ndn-cpp/security/certificate/public-key.hpp>
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
+
#include <cryptopp/cryptlib.h>
#include <cryptopp/rsa.h>
#include <cryptopp/files.h>
diff --git a/tests_boost/test-encode-decode-data.cpp b/tests_boost/test-encode-decode-data.cpp
index a89011b..198fe71 100644
--- a/tests_boost/test-encode-decode-data.cpp
+++ b/tests_boost/test-encode-decode-data.cpp
@@ -11,6 +11,12 @@
#include <fstream>
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wtautological-compare"
+#endif
+
+
#include <cryptopp/rsa.h>
#include <cryptopp/osrng.h>
#include <cryptopp/files.h>
@@ -187,8 +193,6 @@
Block dataBlock;
BOOST_REQUIRE_NO_THROW(dataBlock = d.wireEncode());
- ofstream of("data.tlv");
- of.write((const char*)dataBlock.wire(), dataBlock.size());
BOOST_REQUIRE_EQUAL_COLLECTIONS(Data1, Data1+sizeof(Data1),
dataBlock.begin(), dataBlock.end());