From 23d265bbbeb78db74dd9753b38d0b8a06703dd5e Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 8 Oct 2018 23:24:06 +0300 Subject: [PATCH] Add test/check_cmake_version.cpp --- test/CMakeLists.txt | 1 + test/check_cmake_version.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/check_cmake_version.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c432f08..79bb453 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,3 +3,4 @@ # See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt boost_test_jamfile(FILE Jamfile LIBRARIES Boost::mp11 Boost::core) +boost_test(SOURCES check_cmake_version.cpp ARGUMENTS ${PROJECT_VERSION} LIBRARIES Boost::core Boost::config) diff --git a/test/check_cmake_version.cpp b/test/check_cmake_version.cpp new file mode 100644 index 0000000..2fd4648 --- /dev/null +++ b/test/check_cmake_version.cpp @@ -0,0 +1,27 @@ +// Check whether the version in CMakeLists.txt is up to date +// +// Copyright 2018 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +int main( int ac, char const* av[] ) +{ + BOOST_TEST_EQ( ac, 2 ); + + if( ac >= 2 ) + { + char version[ 64 ]; + std::sprintf( version, "%d.%d.%d", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100 ); + + BOOST_TEST_CSTR_EQ( av[1], version ); + } + + return boost::report_errors(); +}