blob: c17607cf2f2855f95ebdc36b16892bd492bdbb26 [file] [log] [blame]
Junxiao Shid9ee45c2014-02-27 15:38:11 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NFD_TEST_COMMON_HPP
8#define NFD_TEST_COMMON_HPP
9
10#include <boost/test/unit_test.hpp>
11#include "core/global-io.hpp"
12
13namespace nfd {
14namespace tests {
15
16/** \brief base test fixture
17 *
18 * Every test case should be based on this fixture,
19 * to have per test case io_service initialization.
20 */
21class BaseFixture
22{
23protected:
24 BaseFixture()
25 : g_io(getGlobalIoService())
26 {
27 }
28
29 ~BaseFixture()
30 {
31 resetGlobalIoService();
32 }
33
34protected:
35 /// reference to global io_service
36 boost::asio::io_service& g_io;
37};
38
39} // namespace tests
40} // namespace nfd
41
42#endif // NFD_TEST_COMMON_HPP