blob: 44223a6a65d2ce42f2cd883f28689c1e734ac252 [file] [log] [blame]
Junxiao Shi2713a3b2015-06-22 16:19:05 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesaventob07d7a92020-05-13 23:30:07 -04002/*
3 * Copyright (c) 2014-2020 Arizona Board of Regents.
Junxiao Shi2713a3b2015-06-22 16:19:05 -07004 *
5 * This file is part of ndn-tools (Named Data Networking Essential Tools).
6 * See AUTHORS.md for complete list of ndn-tools authors and contributors.
7 *
8 * ndn-tools 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 * ndn-tools 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 * ndn-tools, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19
Davide Pesaventob07d7a92020-05-13 23:30:07 -040020// The unit being tested should be included first, to ensure the header compiles on its own.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070021// For further information about test naming conventions, see
Davide Pesaventob07d7a92020-05-13 23:30:07 -040022// https://redmine.named-data.net/projects/nfd/wiki/UnitTesting
23//#include "unit-under-test.hpp"
Junxiao Shi2713a3b2015-06-22 16:19:05 -070024
25#include "tests/test-common.hpp"
26
27namespace ndn {
28namespace tool_name {
29namespace tests {
Davide Pesaventob07d7a92020-05-13 23:30:07 -040030// Unit tests should go inside the ndn::tool_name::tests namespace.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070031
Davide Pesaventob07d7a92020-05-13 23:30:07 -040032// Common fixtures in ndn::tests can be imported if needed.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070033using namespace ndn::tests;
34
Davide Pesaventob07d7a92020-05-13 23:30:07 -040035// See https://redmine.named-data.net/projects/nfd/wiki/UnitTesting for a guide on how to name a test suite.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070036BOOST_AUTO_TEST_SUITE(TestSkeleton)
37
38BOOST_AUTO_TEST_CASE(Test1)
39{
40 int i = 0;
41
42 // For reference of available Boost.Test macros, see
Davide Pesaventob07d7a92020-05-13 23:30:07 -040043 // https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/testing_tools/summary.html
Junxiao Shi2713a3b2015-06-22 16:19:05 -070044
45 BOOST_REQUIRE_NO_THROW(i = 1);
Davide Pesaventob07d7a92020-05-13 23:30:07 -040046 BOOST_CHECK_EQUAL(i, 1);
Junxiao Shi2713a3b2015-06-22 16:19:05 -070047}
48
49// Use UnitTestTimeFixture to mock clocks.
50BOOST_FIXTURE_TEST_CASE(Test2, UnitTestTimeFixture)
51{
Davide Pesaventob07d7a92020-05-13 23:30:07 -040052 // advanceClocks() increments mock clocks.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070053 boost::asio::io_service io;
54 this->advanceClocks(io, time::milliseconds(500));
55}
56
57BOOST_AUTO_TEST_SUITE_END()
58
59} // namespace tests
60} // namespace tool_name
61} // namespace ndn