Junxiao Shi | f124d75 | 2014-03-01 21:26:43 -0700 | [diff] [blame^] | 1 | /* -*- 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 | #include "core/version.hpp" |
| 8 | #include "core/logger.hpp" |
| 9 | |
| 10 | #include "tests/test-common.hpp" |
| 11 | |
| 12 | namespace nfd { |
| 13 | namespace tests { |
| 14 | |
| 15 | BOOST_FIXTURE_TEST_SUITE(CoreVersion, BaseFixture) |
| 16 | |
| 17 | NFD_LOG_INIT("VersionTest"); |
| 18 | |
| 19 | BOOST_AUTO_TEST_CASE(Version) |
| 20 | { |
| 21 | NFD_LOG_INFO("NFD_VERSION " << NFD_VERSION); |
| 22 | |
| 23 | BOOST_CHECK_EQUAL(NFD_VERSION, NFD_VERSION_MAJOR * 1000000 + |
| 24 | NFD_VERSION_MINOR * 1000 + |
| 25 | NFD_VERSION_PATCH); |
| 26 | } |
| 27 | |
| 28 | BOOST_AUTO_TEST_CASE(VersionString) |
| 29 | { |
| 30 | NFD_LOG_INFO("NFD_VERSION_STRING " << NFD_VERSION_STRING); |
| 31 | |
| 32 | BOOST_STATIC_ASSERT(NFD_VERSION_MAJOR < 1000); |
| 33 | char buf[12]; |
| 34 | snprintf(buf, sizeof(buf), "%d.%d.%d", NFD_VERSION_MAJOR, NFD_VERSION_MINOR, NFD_VERSION_PATCH); |
| 35 | |
| 36 | BOOST_CHECK_EQUAL(std::string(NFD_VERSION_STRING), std::string(buf)); |
| 37 | } |
| 38 | |
| 39 | BOOST_AUTO_TEST_SUITE_END() |
| 40 | |
| 41 | } // namespace tests |
| 42 | } // namespace nfd |