From 5de7f5def65f264398dbd1dc802de7481acf8b77 Mon Sep 17 00:00:00 2001 From: klemens-morgenstern Date: Sat, 13 Feb 2016 19:08:59 +0100 Subject: [PATCH] added comparison test --- test/Jamfile.v2 | 1 + test/compare_ctti_stl.cpp | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 test/compare_ctti_stl.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index a9f1e85..a4550d1 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -45,6 +45,7 @@ test-suite type_index [ run testing_crossmodule.cpp test_lib_rtti ] [ run testing_crossmodule.cpp test_lib_nortti : : : off $(norttidefines) : testing_crossmodule_no_rtti ] [ run testing_crossmodule_anonymous.cpp test_lib_anonymous_rtti ] + [ run compare_ctti_stl.cpp ] [ compile-fail type_index_test_ctti_copy_fail.cpp ] [ compile-fail type_index_test_ctti_construct_fail.cpp ] diff --git a/test/compare_ctti_stl.cpp b/test/compare_ctti_stl.cpp new file mode 100644 index 0000000..3388ffd --- /dev/null +++ b/test/compare_ctti_stl.cpp @@ -0,0 +1,67 @@ +// +// Copyright Klemens Morgenstern, 2012-2015. +// +// 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 + + +namespace my_namespace1 { + class my_class{}; +} + + +namespace my_namespace2 { + class my_class{}; +} + +namespace my_namespace3 +{ +template +struct my_template {}; + +} + +#if !defined( BOOST_NO_RTTI ) + +template +void compare() +{ + typedef boost::typeindex::ctti_type_index ctti; + typedef boost::typeindex::stl_type_index stl; + BOOST_TEST_EQ( + ctti::type_id().pretty_name(), + stl::type_id().pretty_name() + ); +} + + +int main() +{ + compare(); + compare(); + compare(); + compare(); + compare(); + + compare >(); + + + return boost::report_errors(); +} + +#else + +int main() +{ + return 0; +} + +#endif +