/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2014-2020  Arizona Board of Regents.
 *
 * This file is part of ndn-tools (Named Data Networking Essential Tools).
 * See AUTHORS.md for complete list of ndn-tools authors and contributors.
 *
 * ndn-tools is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 */

// The unit being tested should be included first, to ensure the header compiles on its own.
// For further information about test naming conventions, see
// https://redmine.named-data.net/projects/nfd/wiki/UnitTesting
//#include "unit-under-test.hpp"

#include "tests/test-common.hpp"

namespace ndn {
namespace tool_name {
namespace tests {
// Unit tests should go inside the ndn::tool_name::tests namespace.

// Common fixtures in ndn::tests can be imported if needed.
using namespace ndn::tests;

// See https://redmine.named-data.net/projects/nfd/wiki/UnitTesting for a guide on how to name a test suite.
BOOST_AUTO_TEST_SUITE(TestSkeleton)

BOOST_AUTO_TEST_CASE(Test1)
{
  int i = 0;

  // For reference of available Boost.Test macros, see
  // https://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/testing_tools/summary.html

  BOOST_REQUIRE_NO_THROW(i = 1);
  BOOST_CHECK_EQUAL(i, 1);
}

// Use UnitTestTimeFixture to mock clocks.
BOOST_FIXTURE_TEST_CASE(Test2, UnitTestTimeFixture)
{
  // advanceClocks() increments mock clocks.
  boost::asio::io_service io;
  this->advanceClocks(io, time::milliseconds(500));
}

BOOST_AUTO_TEST_SUITE_END()

} // namespace tests
} // namespace tool_name
} // namespace ndn
