build: Fixing build and unit tests
Use only C++ and boost methods (memory copying, comparison, time
operations), which are guaranteed to be present on all platforms
with C++ and boost libraries.
Change-Id: Ia2883555c55909a4f7a877cf6d5fbd49b12c73c8
diff --git a/tests/test-encode-decode-certificate.cpp b/tests/test-encode-decode-certificate.cpp
index b8f0159..8da32bb 100644
--- a/tests/test-encode-decode-certificate.cpp
+++ b/tests/test-encode-decode-certificate.cpp
@@ -1,6 +1,5 @@
/**
* Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
* See COPYING for copyright and distribution information.
*/
diff --git a/tests/test-sec-tpm-file.cpp b/tests/test-sec-tpm-file.cpp
index 9d75a38..a74a84b 100644
--- a/tests/test-sec-tpm-file.cpp
+++ b/tests/test-sec-tpm-file.cpp
@@ -32,10 +32,12 @@
SecTpmFile tpm;
Name keyName("/tmp/ksk-123456");
- tpm.generateKeyPairInTpm(keyName, KEY_TYPE_RSA, 2048);
+ try {
+ tpm.generateKeyPairInTpm(keyName, KEY_TYPE_RSA, 2048);
+ }
+ catch(const SecTpm::Error&) {
+ }
-
-
Data data("/tmp/test/1");
const uint8_t content[] = {0x01, 0x02, 0x03, 0x04};
diff --git a/tests/test-time.cpp b/tests/test-time.cpp
new file mode 100644
index 0000000..bc77fbd
--- /dev/null
+++ b/tests/test-time.cpp
@@ -0,0 +1,23 @@
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#include <boost/test/unit_test.hpp>
+
+#include <../src/util/time.hpp>
+
+BOOST_AUTO_TEST_SUITE(TestTime)
+
+BOOST_AUTO_TEST_CASE (Simple)
+{
+ ndn::MillisecondsSince1970 value = ndn::getNowMilliseconds();
+ BOOST_CHECK_GT(value, 1390966967032);
+
+ BOOST_CHECK_EQUAL(ndn::toIsoString(1390966967032), "20140129T034247.032000");
+ BOOST_CHECK_EQUAL(ndn::fromIsoString("20140129T034247.032000"), 1390966967032);
+
+ BOOST_CHECK_EQUAL(ndn::fromIsoString("20140129T034247.032000Z"), 1390966967032);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/wscript b/tests/wscript
index 73f722a..c63c031 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -7,6 +7,6 @@
target="unit-tests",
features = "cxx cxxprogram",
source = bld.path.ant_glob(['**/*.cpp']),
- use = 'lib-objects',
+ use = 'ndn-cpp-dev',
install_prefix = None,
)