• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  Unit test for boost::lexical_cast for https://svn.boost.org/trac/boost/ticket/11669.
2 //
3 //  See http://www.boost.org for most recent version, including documentation.
4 //
5 //  Copyright Antony Polukhin, 2015-2021.
6 //
7 //  Distributed under the Boost
8 //  Software License, Version 1.0. (See accompanying file
9 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).
10 
11 #include <string>
12 #define BOOST_LCAST_NO_COMPILE_TIME_PRECISION
13 #include <boost/lexical_cast.hpp>
14 
15 #include <boost/test/unit_test.hpp>
16 
main_check()17 void main_check() {
18     BOOST_CHECK(!boost::lexical_cast<std::string>(2.12345).empty());
19     BOOST_CHECK(!boost::lexical_cast<std::string>(2.12345678).empty());
20 }
21 
init_unit_test_suite(int,char * [])22 boost::unit_test::test_suite *init_unit_test_suite(int, char *[])
23 {
24     boost::unit_test::test_suite *suite =
25         BOOST_TEST_SUITE("lexical_cast no-compile-time-precision check");
26     suite->add(BOOST_TEST_CASE(main_check));
27     return suite;
28 }
29