blob: 5b6db55beb014c806bc4b3bb83795d8e55ce1fef [file] [log] [blame]
peizhen guo410e0e12014-08-12 13:24:14 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014, Regents of the University of California
4 *
5 * This file is part of NSL (NDN Signature Logger).
6 * See AUTHORS.md for complete list of NSL authors and contributors.
7 *
8 * NSL is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NSL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * NSL, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 *
Yingdi Yu0c3e5912015-03-17 14:22:38 -070019 * See AUTHORS.md for complete list of nsl authors and contributors.
peizhen guo410e0e12014-08-12 13:24:14 -070020 */
peizhen guo410e0e12014-08-12 13:24:14 -070021
Yingdi Yu0c3e5912015-03-17 14:22:38 -070022#ifndef NSL_TESTS_DB_FIXTURE_HPP
23#define NSL_TESTS_DB_FIXTURE_HPP
24
25#include "db.hpp"
26#include <boost/filesystem.hpp>
peizhen guo410e0e12014-08-12 13:24:14 -070027
28namespace nsl {
Yingdi Yu0c3e5912015-03-17 14:22:38 -070029namespace tests {
peizhen guo410e0e12014-08-12 13:24:14 -070030
Yingdi Yu0c3e5912015-03-17 14:22:38 -070031class DbFixture
peizhen guo410e0e12014-08-12 13:24:14 -070032{
Yingdi Yu0c3e5912015-03-17 14:22:38 -070033public:
34 DbFixture()
35 : m_dbTmpPath(boost::filesystem::path(TEST_DB_PATH) / "DbTest")
36 {
37 db.open(m_dbTmpPath.c_str());
38 }
peizhen guo410e0e12014-08-12 13:24:14 -070039
Yingdi Yu0c3e5912015-03-17 14:22:38 -070040 ~DbFixture()
41 {
42 boost::filesystem::remove_all(m_dbTmpPath);
43 }
peizhen guo410e0e12014-08-12 13:24:14 -070044
Yingdi Yu0c3e5912015-03-17 14:22:38 -070045protected:
46 boost::filesystem::path m_dbTmpPath;
47
48public:
49 Db db;
50};
51
52} // namespace tests
peizhen guo410e0e12014-08-12 13:24:14 -070053} // namespace nsl
Yingdi Yu0c3e5912015-03-17 14:22:38 -070054
55#endif // NSL_TESTS_DB_FIXTURE_HPP