blob: acd44edf55ba7f394ac4e4e70c19c77b323bf2e3 [file] [log] [blame]
Alexander Afanasyev2aa39622014-01-22 11:51:11 -08001/* -*- 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
Junxiao Shid9ee45c2014-02-27 15:38:11 -07007// #include "unit-under-test.hpp"
8// Unit being tested MUST be included first, to ensure header compiles on its own.
Alexander Afanasyev2aa39622014-01-22 11:51:11 -08009
Junxiao Shid9ee45c2014-02-27 15:38:11 -070010#include "tests/test-common.hpp"
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080011
Junxiao Shid9ee45c2014-02-27 15:38:11 -070012namespace nfd {
13namespace tests {
14// Unit tests SHOULD go inside nfd::tests namespace.
15
16// Test suite SHOULD use BaseFixture or a subclass of it.
17BOOST_FIXTURE_TEST_SUITE(TestSkeleton, BaseFixture)
18
19BOOST_AUTO_TEST_CASE(Test1)
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080020{
21 int i = 0;
22 /**
23 * For reference of available Boost.Test macros, @see http://www.boost.org/doc/libs/1_55_0/libs/test/doc/html/utf/testing-tools/reference.html
24 */
25
26 BOOST_REQUIRE_NO_THROW(i = 1);
27 BOOST_REQUIRE_EQUAL(i, 1);
28}
29
Junxiao Shid9ee45c2014-02-27 15:38:11 -070030// Custom fixture SHOULD derive from BaseFixture.
31class Test2Fixture : protected BaseFixture
32{
33};
34
35BOOST_FIXTURE_TEST_CASE(Test2, Test2Fixture)
36{
37 // g_io is a shorthand of getGlobalIoService()
38 // resetGlobalIoService() is automatically called after each test case
39 g_io.run();
40}
41
Alexander Afanasyev2aa39622014-01-22 11:51:11 -080042BOOST_AUTO_TEST_SUITE_END()
Junxiao Shid9ee45c2014-02-27 15:38:11 -070043
44} // namespace tests
45} // namespace nfd