blob: 83b3f3f988fcdc7ea6200dda78cb40b4a3a570cd [file] [log] [blame]
Weiqi Shif0330d52014-07-09 10:54:27 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesavento11904062022-04-14 22:33:28 -04002/*
Davide Pesavento01a2a8c2024-12-13 14:25:50 -05003 * Copyright (c) 2018-2024, Regents of the University of California.
Weiqi Shif0330d52014-07-09 10:54:27 -07004 *
5 * This file is part of NDN repo-ng (Next generation of NDN repository).
6 * See AUTHORS.md for complete list of repo-ng authors and contributors.
7 *
8 * repo-ng 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 * repo-ng 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 * repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef REPO_TESTS_REPO_STORAGE_FIXTURE_HPP
21#define REPO_TESTS_REPO_STORAGE_FIXTURE_HPP
22
23#include "storage/repo-storage.hpp"
Davide Pesavento11904062022-04-14 22:33:28 -040024#include "storage/sqlite-storage.hpp"
Weiqi Shif0330d52014-07-09 10:54:27 -070025
Davide Pesavento01a2a8c2024-12-13 14:25:50 -050026#include <filesystem>
Weiqi Shif0330d52014-07-09 10:54:27 -070027
Davide Pesavento11904062022-04-14 22:33:28 -040028namespace repo::tests {
Weiqi Shif0330d52014-07-09 10:54:27 -070029
30class RepoStorageFixture
31{
32public:
Weiqi Shif0330d52014-07-09 10:54:27 -070033 ~RepoStorageFixture()
34 {
Davide Pesavento01a2a8c2024-12-13 14:25:50 -050035 std::error_code ec;
36 std::filesystem::remove_all(std::filesystem::path("unittestdb"), ec);
Weiqi Shif0330d52014-07-09 10:54:27 -070037 }
38
Weiqi Shif0330d52014-07-09 10:54:27 -070039public:
Davide Pesavento01a2a8c2024-12-13 14:25:50 -050040 std::shared_ptr<Storage> store = std::make_shared<SqliteStorage>("unittestdb");
41 std::shared_ptr<RepoStorage> handle = std::make_shared<RepoStorage>(*store);
Weiqi Shif0330d52014-07-09 10:54:27 -070042};
43
Davide Pesavento11904062022-04-14 22:33:28 -040044} // namespace repo::tests
Weiqi Shif0330d52014-07-09 10:54:27 -070045
46#endif // REPO_TESTS_REPO_STORAGE_FIXTURE_HPP