blob: 5cb6622ee06e3a45283406520582cba2755df901 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -07002/**
Davide Pesaventoeee3e822016-11-26 19:19:34 +01003 * Copyright (c) 2013-2016 Regents of the University of California.
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070020 */
21
22#include "version.hpp"
Davide Pesaventoeee3e822016-11-26 19:19:34 +010023#include "common.hpp"
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070024
25#include "boost-test.hpp"
Davide Pesaventoeee3e822016-11-26 19:19:34 +010026
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070027#include <stdio.h>
28
29namespace ndn {
30namespace tests {
31
32BOOST_AUTO_TEST_SUITE(TestVersion)
33
Davide Pesaventoeee3e822016-11-26 19:19:34 +010034BOOST_AUTO_TEST_CASE(VersionNumber)
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070035{
Davide Pesaventoeee3e822016-11-26 19:19:34 +010036 BOOST_TEST_MESSAGE("NDN_CXX_VERSION = " + to_string(NDN_CXX_VERSION));
37
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070038 BOOST_CHECK_EQUAL(NDN_CXX_VERSION, NDN_CXX_VERSION_MAJOR * 1000000 +
39 NDN_CXX_VERSION_MINOR * 1000 +
40 NDN_CXX_VERSION_PATCH);
41}
42
43BOOST_AUTO_TEST_CASE(VersionString)
44{
Davide Pesaventoeee3e822016-11-26 19:19:34 +010045 BOOST_TEST_MESSAGE("NDN_CXX_VERSION_STRING = " NDN_CXX_VERSION_STRING);
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070046
Davide Pesaventoeee3e822016-11-26 19:19:34 +010047 BOOST_STATIC_ASSERT(NDN_CXX_VERSION_MAJOR < 1000);
48 BOOST_STATIC_ASSERT(NDN_CXX_VERSION_MINOR < 1000);
49 BOOST_STATIC_ASSERT(NDN_CXX_VERSION_PATCH < 1000);
50 char buf[12];
51 ::snprintf(buf, sizeof(buf), "%d.%d.%d",
52 NDN_CXX_VERSION_MAJOR, NDN_CXX_VERSION_MINOR, NDN_CXX_VERSION_PATCH);
53
54 BOOST_CHECK_EQUAL(NDN_CXX_VERSION_STRING, buf);
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070055}
56
Davide Pesaventoeee3e822016-11-26 19:19:34 +010057BOOST_AUTO_TEST_SUITE_END() // TestVersion
Alexander Afanasyeva06fdda2014-04-29 19:15:00 -070058
59} // namespace tests
60} // namespace ndn