blob: fb551e353641af23057503e682ee0eb21de41c4e [file] [log] [blame]
Junxiao Shif124d752014-03-01 21:26:43 -07001/* -*- 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
12namespace nfd {
13namespace tests {
14
15BOOST_FIXTURE_TEST_SUITE(CoreVersion, BaseFixture)
16
17NFD_LOG_INIT("VersionTest");
18
19BOOST_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
28BOOST_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
39BOOST_AUTO_TEST_SUITE_END()
40
41} // namespace tests
42} // namespace nfd