Log to std::cerr in ctti_print_name test and implicitly include ctti. Define BOOST_NO_RTTI for nortti test, so that even old compilers could compile tests

This commit is contained in:
Antony Polukhin
2014-05-12 20:11:51 +04:00
parent a397391b0e
commit e2ceb6cf36
2 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,7 @@ tlib = /boost/test//boost_unit_test_framework/<link>static ;
compat = <define>BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY ;
# Making own `nortti` that is link compatible
nortti = <toolset>gcc:<cxxflags>-fno-rtti <toolset>clang:<cxxflags>-fno-rtti <toolset>msvc:<cxxflags>/GR- ;
nortti = <toolset>gcc:"<cxxflags>-fno-rtti -DBOOST_NO_RTTI" <toolset>clang:"<cxxflags>-fno-rtti -DBOOST_NO_RTTI" <toolset>msvc:<cxxflags>/GR- ;
# Making libraries that CANNOT work between rtti-on/rtti-off modules

View File

@ -8,12 +8,13 @@
#define BOOST_TEST_MODULE type_index_ctti_test_module
#include <boost/test/unit_test.hpp>
#include <iostream>
// This cpp file:
// * tests BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro
// * outputs full ctti name so that TypeIndex library could be adjust to new compiler without requesting regression tester's help
#define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0,0,false,"")
#include <boost/type_index.hpp>
#include <boost/type_index/ctti_type_index.hpp>
namespace user_defined_namespace {
class user_defined_class {};
@ -22,9 +23,9 @@ namespace user_defined_namespace {
BOOST_AUTO_TEST_CASE(ctti_print_full_string_helper_test)
{
using namespace boost::typeindex;
BOOST_TEST_CHECKPOINT("int: " << ctti_type_index::type_id<int>());
BOOST_TEST_CHECKPOINT("double: " << ctti_type_index::type_id<double>());
BOOST_TEST_CHECKPOINT("user_defined_namespace::user_defined_class: " << ctti_type_index::type_id<user_defined_namespace::user_defined_class>());
std::cerr << "int: " << ctti_type_index::type_id<int>() << '\n';
std::cerr << "double: " << ctti_type_index::type_id<double>() << '\n';
std::cerr << "user_defined_namespace::user_defined_class: " << ctti_type_index::type_id<user_defined_namespace::user_defined_class>() << '\n';
BOOST_CHECK(true);
}