blob: 8f6584b50660c89e2e0c16f44eb25c62e9c3e8f5 [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"
Davide Pesavento66777622020-10-09 18:46:03 -040026#include "tests/io-fixture.hpp" // optional, for IoFixture
27//#include "tests/key-chain-fixture.hpp" // optional, for KeyChainFixture
Junxiao Shi2713a3b2015-06-22 16:19:05 -070028
29namespace ndn {
30namespace tool_name {
31namespace tests {
Davide Pesaventob07d7a92020-05-13 23:30:07 -040032// Unit tests should go inside the ndn::tool_name::tests namespace.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070033
Davide Pesaventob07d7a92020-05-13 23:30:07 -040034// Common fixtures in ndn::tests can be imported if needed.
Junxiao Shi2713a3b2015-06-22 16:19:05 -070035using namespace ndn::tests;
36
Davide Pesaventob07d7a92020-05-13 23:30:07 -040037// 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 -070038BOOST_AUTO_TEST_SUITE(TestSkeleton)
39
40BOOST_AUTO_TEST_CASE(Test1)
41{
42 int i = 0;
43
44 // For reference of available Boost.Test macros, see
Davide Pesaventob07d7a92020-05-13 23:30:07 -040045 // 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 -070046
47 BOOST_REQUIRE_NO_THROW(i = 1);
Davide Pesaventob07d7a92020-05-13 23:30:07 -040048 BOOST_CHECK_EQUAL(i, 1);
Junxiao Shi2713a3b2015-06-22 16:19:05 -070049}
50
Davide Pesavento66777622020-10-09 18:46:03 -040051// Use ClockFixture or IoFixture to mock clocks.
52BOOST_FIXTURE_TEST_CASE(Test2, IoFixture)
Junxiao Shi2713a3b2015-06-22 16:19:05 -070053{
Davide Pesaventob07d7a92020-05-13 23:30:07 -040054 // advanceClocks() increments mock clocks.
Davide Pesavento66777622020-10-09 18:46:03 -040055 advanceClocks(500_ms);
Junxiao Shi2713a3b2015-06-22 16:19:05 -070056}
57
58BOOST_AUTO_TEST_SUITE_END()
59
60} // namespace tests
61} // namespace tool_name
62} // namespace ndn