add DbMgr

Change-Id: I799f6a066ef60ecd42d64de7d8d04be8996564ed
diff --git a/tests/skeleton.cpp b/tests/unit/db/db-mgr.cpp
similarity index 72%
rename from tests/skeleton.cpp
rename to tests/unit/db/db-mgr.cpp
index afa3bde..198a851 100644
--- a/tests/skeleton.cpp
+++ b/tests/unit/db/db-mgr.cpp
@@ -17,17 +17,26 @@
  * NDNS, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-// #include ""
-#include "boost-test.hpp"
+#include "db/db-mgr.hpp"
+#include "../../boost-test.hpp"
 
 namespace ndn {
 namespace ndns {
 namespace tests {
 
-BOOST_AUTO_TEST_SUITE(Skeleton)
+BOOST_AUTO_TEST_SUITE(DbMgr)
 
-BOOST_AUTO_TEST_CASE(TestCase)
+BOOST_AUTO_TEST_CASE(Basic)
 {
+  ndns::DbMgr mgr(BUILDDIR "/tests/unit/db/dbmgr-ndns.db");
+  BOOST_CHECK_EQUAL(mgr.getStatus(), ndns::DbMgr::DB_CONNECTED);
+
+  mgr.close();
+  BOOST_CHECK_EQUAL(mgr.getStatus(), ndns::DbMgr::DB_CLOSED);
+
+  // reopen
+  mgr.open();
+  BOOST_CHECK_EQUAL(mgr.getStatus(), ndns::DbMgr::DB_CONNECTED);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/logger.cpp b/tests/unit/logger.cpp
similarity index 99%
rename from tests/logger.cpp
rename to tests/unit/logger.cpp
index 2352a92..100aa5b 100644
--- a/tests/logger.cpp
+++ b/tests/unit/logger.cpp
@@ -18,7 +18,7 @@
  */
 
 #include "logger.hpp"
-#include "boost-test.hpp"
+#include "../boost-test.hpp"
 
 #include <fstream>
 
diff --git a/tests/unit/zone.cpp b/tests/unit/zone.cpp
index 0a26e76..f533d2e 100644
--- a/tests/unit/zone.cpp
+++ b/tests/unit/zone.cpp
@@ -26,13 +26,12 @@
 namespace ndns {
 namespace tests {
 
+BOOST_AUTO_TEST_SUITE(Zone)
 
-BOOST_AUTO_TEST_SUITE(ZoneTest)
-
-BOOST_AUTO_TEST_CASE(TestCase)
+BOOST_AUTO_TEST_CASE(Basic)
 {
   Name zoneName("/net/ndnsim");
-  Zone zone1;
+  ndns::Zone zone1;
   zone1.setName(zoneName);
   zone1.setId(2);
   zone1.setTtl(time::seconds(4000));
@@ -41,11 +40,11 @@
   BOOST_CHECK_EQUAL(zone1.getName(), zoneName);
   BOOST_CHECK_EQUAL(zone1.getTtl(), time::seconds(4000));
 
-  Zone zone2(zoneName);
+  ndns::Zone zone2(zoneName);
   BOOST_CHECK_EQUAL(zone1, zone2);
   BOOST_CHECK_EQUAL(zone2.getName(), zone1.getName());
 
-  BOOST_CHECK_NE(zone1, Zone("/net/ndnsim2"));
+  BOOST_CHECK_NE(zone1, ndns::Zone("/net/ndnsim2"));
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/wscript b/tests/wscript
index 383ae8c..0407962 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,6 +1,6 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
-from waflib import Utils
+from waflib import Utils, Context
 
 top = '..'
 
@@ -12,4 +12,5 @@
             source=bld.path.ant_glob(['**/*.cpp']),
             use='ndns-objects',
             install_path=None,
+            defines="BUILDDIR=\"%s\"" % Context.out_dir,
           )