From c0871ef714323a86219bb4264017f2848bbcc0c6 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Thu, 6 Feb 2014 18:46:01 +0400 Subject: [PATCH] Removed old unused files --- include/boost/type_index/template_index.hpp | 35 --- include/boost/type_index/template_info.hpp | 317 -------------------- include/boost/type_index/type_index.hpp | 221 -------------- test/template_index_test.cpp | 23 -- test/template_index_tests.ipp | 8 - test/testing_both.cpp | 23 -- test/testing_both_no_rtti.cpp | 27 -- test/testing_minimal_no_rtti.cpp | 26 -- test/type_index_tests.ipp | 211 ------------- 9 files changed, 891 deletions(-) delete mode 100644 include/boost/type_index/template_index.hpp delete mode 100644 include/boost/type_index/template_info.hpp delete mode 100644 include/boost/type_index/type_index.hpp delete mode 100644 test/template_index_test.cpp delete mode 100644 test/template_index_tests.ipp delete mode 100644 test/testing_both.cpp delete mode 100644 test/testing_both_no_rtti.cpp delete mode 100644 test/testing_minimal_no_rtti.cpp delete mode 100644 test/type_index_tests.ipp diff --git a/include/boost/type_index/template_index.hpp b/include/boost/type_index/template_index.hpp deleted file mode 100644 index 764e6c0..0000000 --- a/include/boost/type_index/template_index.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2012-2013. -// -// -// 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) -// - -#ifndef BOOST_TYPE_INDEX_TEMPLATE_INDEX_HPP -#define BOOST_TYPE_INDEX_TEMPLATE_INDEX_HPP - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) -# pragma once -#endif - - -/// \file template_index.hpp -/// \brief Contains implementation of boost::template_index class. -/// -/// boost::template_index is just a typedef of boost::template_info, that combines functionality -/// of boost::type_info and boost::type_index but can work with RTTI disabled. - -#include - -namespace boost { - -/// boost::template_index is just a typedef of boost::template_info, that combines functionality -/// of boost::type_info and boost::type_index but can work with RTTI disabled. -typedef template_info template_index; - -} // namespace boost - -#endif // BOOST_TYPE_INDEX_TEMPLATE_INDEX_HPP - diff --git a/include/boost/type_index/template_info.hpp b/include/boost/type_index/template_info.hpp deleted file mode 100644 index 5c88244..0000000 --- a/include/boost/type_index/template_info.hpp +++ /dev/null @@ -1,317 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2012-2013. -// -// -// 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) -// - -#ifndef BOOST_TYPE_INDEX_TEMPLATE_INFO_HPP -#define BOOST_TYPE_INDEX_TEMPLATE_INFO_HPP - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) -# pragma once -#endif - - -/// \file template_info.hpp -/// \brief Contains implementation of boost::template_info class. -/// -/// boost::template_info class is used instead of boost::type_info and boost::type_index classes -/// in situations when RTTI is disabled. -/// -/// It combines functionality of std::type_info and std::type_index. - -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - - -namespace boost { - -namespace detail { -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - -/// \def BOOST_TYPE_INDEX_FUNCTION_SIGNATURE -/// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is used by boost::template_info class to -/// deduce the name of a template parameter. If your compiler is not recognized -/// by the TypeIndex library and you wish to work with boost::template_info, you may -/// define this macro by yourself. -/// -/// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE must be defined to a compiler specific macro, -/// that outputs the WHOLE function signature, including template parameters. -/// -/// If your compiler is not recognised and BOOST_TYPE_INDEX_FUNCTION_SIGNATURE is not defined, -/// then a compile-time error will arise at any attempt to use boost::template_info or -/// boost::template_index classes. -#define BOOST_TYPE_INDEX_FUNCTION_SIGNATURE BOOST_CURRENT_FUNCTION - -#elif defined(BOOST_TYPE_INDEX_FUNCTION_SIGNATURE) - -template -inline void lazy_function_signature_assert(){} - -#elif defined(__FUNCSIG__) - -template -inline void lazy_function_signature_assert(){} -#define BOOST_TYPE_INDEX_FUNCTION_SIGNATURE __FUNCSIG__ - -#elif defined(__PRETTY_FUNCTION__) \ - || defined(__GNUC__) \ - || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) \ - || (defined(__ICC) && (__ICC >= 600)) \ - || defined(__ghs__) \ - || defined(__DMC__) - -template -inline void lazy_function_signature_assert(){} -#define BOOST_TYPE_INDEX_FUNCTION_SIGNATURE __PRETTY_FUNCTION__ - -#else - -template -inline void lazy_function_signature_assert() { - BOOST_STATIC_ASSERT_MSG( - sizeof(T) && false, - "TypeIndex library could not detect your compiler. " - "Please make the BOOST_TYPE_INDEX_FUNCTION_SIGNATURE macro use " - "correct compiler macro for getting the whole function name. " - "Do not forget to also define BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP and " - "BOOST_TYPE_INDEX_CTTI_END_SKIP." - ); -} - -#endif -#if defined(BOOST_TYPE_INDEX_DOXYGEN_INVOKED) - - /// \def BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP - /// - /// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE, BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP - /// and BOOST_TYPE_INDEX_CTTI_END_SKIP macroses are used for adding a - /// support for compilers, that by default are not recognized by TypeIndex library. - /// - /// See Compiler support for more info - #define BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP 0 - - /// \def BOOST_TYPE_INDEX_CTTI_END_SKIP - /// - /// BOOST_TYPE_INDEX_FUNCTION_SIGNATURE, BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP - /// and BOOST_TYPE_INDEX_CTTI_END_SKIP macroses are used for adding a - /// support for compilers, that by default are not recognized by TypeIndex library. - /// - /// See Compiler support for more info - #define BOOST_TYPE_INDEX_CTTI_END_SKIP 0 - -#elif defined(BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP) && defined(BOOST_TYPE_INDEX_CTTI_END_SKIP) - // skip user specified bytes count - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_begin = BOOST_TYPE_INDEX_CTTI_BEGIN_SKIP); - // skip user specified bytes count - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_end = BOOST_TYPE_INDEX_CTTI_END_SKIP); -#elif defined _MSC_VER - // sizeof("const char *__cdecl boost::detail::ctti<") - 1 - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_begin = 40); - - // sizeof(">::n(void)") - 1 - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_end = 10); - -#elif defined __clang__ - // sizeof("static const char *boost::detail::ctti<") - 1 - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_begin = 39); - - // == sizeof(">::n()") - 1 - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_end = 6); -#elif defined __GNUC__ - // sizeof("static const char* boost::detail::ctti::n() [with T = ") - 1 - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_begin = 57); - - // == sizeof("]") - 1 - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_end = 1); - -#else - // TODO: Code for other platforms - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_begin = 0); // skip nothing - BOOST_STATIC_CONSTANT(std::size_t, ctti_skip_size_at_end = 0); // skip nothing -#endif - - /// Noncopyable type_info that does not require RTTI - /// CTTI == Compile Time Type Info - /// This name must be as short as posible, to avoid code bloat - template - struct ctti { - typedef T template_type; - typedef ctti this_type; - - /// Returns raw name. Must be as short, as possible, to avoid code bloat - static const char* n() BOOST_NOEXCEPT { - lazy_function_signature_assert(); - return BOOST_TYPE_INDEX_FUNCTION_SIGNATURE + detail::ctti_skip_size_at_begin; - } - - /// Returns raw name - static const char* name() BOOST_NOEXCEPT { - return this_type::n(); - } - }; -} // namespace detail - -/// Copyable type_info class that does not require RTTI. -/// When RTTI is disabled this class will be used instead of boost::type_info and boost::type_index. -class template_info { -private: - const char* name_; - - /// @cond - explicit template_info(const char* name) BOOST_NOEXCEPT - : name_(name) - {} - /// @endcond - -public: - /// Default constructor. - template_info() BOOST_NOEXCEPT - : name_(detail::ctti::name()) - {} - - /// Factory method for constructing boost::template_info instance for type T. - /// Strips const, volatile and & modifiers from T. - /// - /// Works exactly like boost::template_id(). - template - static const template_info& construct(){ - typedef BOOST_DEDUCED_TYPENAME boost::remove_reference::type no_ref_t; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cvr_t; - - # if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) - BOOST_STATIC_ASSERT_MSG( !boost::is_arithmetic::type::value - , "Your EDG-based compiler seems to mistakenly distinguish 'int' from 'signed int', in typeid() expressions."); - #endif - - static const template_info ret(detail::ctti::name()); - return ret; - } - - /// Factory method for constructing template_info instance for type T. - /// Does not strip const, volatile and & modifiers from T. - /// - /// Works exactly like boost::template_id_with_cvr(). - template - static const template_info& construct_with_cvr() { - # if (defined(__EDG_VERSION__) && __EDG_VERSION__ < 245) \ - || (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 744) - BOOST_STATIC_ASSERT_MSG( !boost::is_arithmetic::type::value - , "Your EDG-based compiler seems to mistakenly distinguish 'int' from 'signed int', in typeid() expressions."); - #endif - - static const template_info ret(detail::ctti::name()); - return ret; - } - - - /// Returns true if the type precedes the type of rhs in the collation order. - /// The collation order is just an internal order. - bool before(const template_info& rhs) const BOOST_NOEXCEPT { - return std::strcmp(name(), rhs.name()) < 0; - } - - /// Returns raw name - const char* name() const BOOST_NOEXCEPT { - return name_; - } - - /// Returns user-friendly name - std::string name_demangled() const { - std::size_t len = std::strlen(name_ + detail::ctti_skip_size_at_end); - while (name_[len - 1] == ' ') --len; // MSVC sometimes adds whitespaces - return std::string(name_, len); - } - - bool operator == (const template_info& rhs) const BOOST_NOEXCEPT { - return name_ == rhs.name() || !std::strcmp(name_, rhs.name()); - } - - bool operator != (const template_info& rhs) const BOOST_NOEXCEPT { - return name_ != rhs.name() && !!std::strcmp(name_, rhs.name()); - } - - bool operator < (const template_info& rhs) const BOOST_NOEXCEPT { - return name_ != rhs.name() && std::strcmp(name_, rhs.name()) < 0; - } - - bool operator > (const template_info& rhs) const BOOST_NOEXCEPT { - return name_ != rhs.name() && std::strcmp(name_, rhs.name()) > 0; - } - - bool operator <= (const template_info& rhs) const BOOST_NOEXCEPT { - return name_ == rhs.name() || std::strcmp(name_, rhs.name()) <= 0; - } - - bool operator >= (const template_info& rhs) const BOOST_NOEXCEPT { - return name_ == rhs.name() || std::strcmp(name_, rhs.name()) >= 0; - } - - /// Function for getting hash value - std::size_t hash_code() const BOOST_NOEXCEPT { - return boost::hash_range(name_, name_ + std::strlen(name_ + detail::ctti_skip_size_at_end)); - } -}; - -/// Method for constructing template_info instance for type T. -/// Strips const, volatile and & modifiers from T. -template -inline const template_info& template_id() BOOST_NOEXCEPT { - return template_info::construct(); -} - -/// Method for constructing template_info instance for type T. -/// Does not strip const, volatile and & modifiers from T. -/// If T has no const, volatile, & and && modifiers, then returns exactly -/// the same result as in case of calling `template_id()`. -template -inline const template_info& template_id_with_cvr() BOOST_NOEXCEPT { - return template_info::construct_with_cvr(); -} - -/* *************** template_info free functions ******************* */ - -#ifndef BOOST_NO_IOSTREAM -#ifdef BOOST_NO_TEMPLATED_IOSTREAMS -/// Ostream operator that will output demangled name -inline std::ostream& operator<<(std::ostream& ostr, template_info const& ind) { - ostr << ind.name_demangled(); - return ostr; -} -#else -/// Ostream operator that will output demangled name -template -inline std::basic_ostream& operator<<(std::basic_ostream& ostr, template_info const& ind) { - ostr << ind.name_demangled(); - return ostr; -} -#endif // BOOST_NO_TEMPLATED_IOSTREAMS -#endif // BOOST_NO_IOSTREAM - -/// hash_value function overload for template_info -inline std::size_t hash_value(template_info const& v) BOOST_NOEXCEPT { - return v.hash_code(); -} - -} // namespace boost - -#endif // BOOST_TYPE_INDEX_TEMPLATE_INFO_HPP - diff --git a/include/boost/type_index/type_index.hpp b/include/boost/type_index/type_index.hpp deleted file mode 100644 index df3f76c..0000000 --- a/include/boost/type_index/type_index.hpp +++ /dev/null @@ -1,221 +0,0 @@ -// -// Copyright (c) Antony Polukhin, 2012-2013. -// -// 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) -// - -#ifndef BOOST_TYPE_INDEX_TYPE_INDEX_HPP -#define BOOST_TYPE_INDEX_TYPE_INDEX_HPP - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) -# pragma once -#endif - -/// \file boost/type_index/type_index.hpp -/// \brief Contains implementation of boost::type_index class. -/// -/// boost::type_index class is used in situations when RTTI is enabled, it is designed to be a drop-in -/// replacement for C++11 std::type_index class. -/// -/// When RTTI is disabled boost::template_index will be usually (some compilers allow calling typeid(T) -/// even if RTTI is disabled) used instead of this class. - -#include -#include - -// MSVC is capable of calling typeid(T) even when RTTI is off -#if (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - -namespace boost { - -/// This class is designed to be a drop-in replacement for C++11 std::type_index class. -/// -/// Copyable std::type_index class that requires RTTI. -/// When RTTI is disabled boost::template_index will be used instead of -/// this class. -class type_index { -private: - const type_info* pinfo_; - -public: - typedef detail::stl_type_info stl_type_info; - - /// Default constructor. - type_index() BOOST_NOEXCEPT - : pinfo_(static_cast(&typeid(void))) - {} - - /// Constructs type_index from an instance of boost::type_info. - type_index(const type_info& inf) BOOST_NOEXCEPT - : pinfo_(&inf) - {} - - /// Constructs type_index from an instance of std::type_info. - type_index(const stl_type_info& inf) BOOST_NOEXCEPT - : pinfo_(static_cast(&inf)) - {} - - /// Returns true if the type precedes the type of rhs in the collation order. - /// The collation order is just an internal order. - bool before(type_index const& rhs) const BOOST_NOEXCEPT { - return pinfo_->before(*rhs.pinfo_); - } - - /// Returns raw name - const char* name() const BOOST_NOEXCEPT { - return pinfo_->name(); - } - - /// Returns user-friendly name - std::string name_demangled() const { - return pinfo_->name_demangled(); - } - - bool operator == (type_index const& rhs) const BOOST_NOEXCEPT { - return *pinfo_ == *rhs.pinfo_; - } - - bool operator != (type_index const& rhs) const BOOST_NOEXCEPT { - return !(*pinfo_ == *rhs.pinfo_); - } - - bool operator < (type_index const& rhs) const BOOST_NOEXCEPT { - return before(rhs); - } - - bool operator > (type_index const& rhs) const BOOST_NOEXCEPT { - return (rhs < *this); - } - - bool operator <= (type_index const& rhs) const BOOST_NOEXCEPT { - return !(*this > rhs); - } - - bool operator >= (type_index const& rhs) const BOOST_NOEXCEPT { - return !(*this < rhs); - } - - - bool operator == (stl_type_info const& rhs) const BOOST_NOEXCEPT { - return *this == type_index(rhs); - } - - bool operator != (stl_type_info const& rhs) const BOOST_NOEXCEPT { - return *this != type_index(rhs); - } - - bool operator < (stl_type_info const& rhs) const BOOST_NOEXCEPT { - return *this < type_index(rhs); - } - - bool operator > (stl_type_info const& rhs) const BOOST_NOEXCEPT { - return *this > type_index(rhs); - } - - bool operator <= (stl_type_info const& rhs) const BOOST_NOEXCEPT { - return *this <= type_index(rhs); - } - - bool operator >= (stl_type_info const& rhs) const BOOST_NOEXCEPT { - return *this >= type_index(rhs); - } - - - /// Function for getting hash value - std::size_t hash_code() const BOOST_NOEXCEPT { - return pinfo_->hash_code(); - } -}; - -/* *************** type_index free functions ******************* */ - -#ifndef BOOST_TYPE_INDEX_DOXYGEN_INVOKED - -inline bool operator == (detail::stl_type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT { - return rhs == lhs; // Operation is commutative -} - -inline bool operator != (detail::stl_type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT { - return rhs != lhs; // Operation is commutative -} - -inline bool operator < (detail::stl_type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT { - return rhs > lhs; -} - -inline bool operator > (detail::stl_type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT { - return rhs < lhs; -} - -inline bool operator <= (detail::stl_type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT { - return rhs >= lhs; -} - -inline bool operator >= (detail::stl_type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT { - return rhs <= lhs; -} - -#else // BOOST_TYPE_INDEX_DOXYGEN_INVOKED - -inline bool operator == (std::type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT; -inline bool operator != (std::type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT; -inline bool operator < (std::type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT; -inline bool operator > (std::type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT; -inline bool operator <= (std::type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT; -inline bool operator >= (std::type_info const& lhs, type_index const& rhs) BOOST_NOEXCEPT; - -#endif // BOOST_TYPE_INDEX_DOXYGEN_INVOKED - -/* *************** type_index free functions ******************* */ - -#ifndef BOOST_NO_IOSTREAM -#ifdef BOOST_NO_TEMPLATED_IOSTREAMS - -/// Ostream operator that will output demangled name. -inline std::ostream& operator<<(std::ostream& ostr, type_index const& ind) { - ostr << ind.name_demangled(); - return ostr; -} - -#else - -/// Ostream operator that will output demangled name. -template -inline std::basic_ostream& operator<<(std::basic_ostream& ostr, type_index const& ind) { - ostr << ind.name_demangled(); - return ostr; -} - -#endif // BOOST_NO_TEMPLATED_IOSTREAMS -#endif // BOOST_NO_IOSTREAM - -/// hash_value function overload for type_index. -inline std::size_t hash_value(type_index const& v) BOOST_NOEXCEPT { - return v.hash_code(); -} - -} // namespace boost - -#else // (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) - -#include -namespace boost { - -typedef template_index type_index; - -} - -#endif // (!defined(BOOST_NO_RTTI) && !defined(BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)) || defined(BOOST_MSVC) - -#endif // BOOST_TYPE_INDEX_TYPE_INDEX_HPP - diff --git a/test/template_index_test.cpp b/test/template_index_test.cpp deleted file mode 100644 index 41ea92c..0000000 --- a/test/template_index_test.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright Antony Polukhin, 2012-2013. -// -// 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) - -#define BOOST_TEST_MODULE template_index_test_module -#include - -#include - -namespace my_namespace1 { - class my_class{}; -} - - -namespace my_namespace2 { - class my_class{}; -} - -#include "template_index_tests.ipp" - diff --git a/test/template_index_tests.ipp b/test/template_index_tests.ipp deleted file mode 100644 index c13a48a..0000000 --- a/test/template_index_tests.ipp +++ /dev/null @@ -1,8 +0,0 @@ -// -// Copyright Antony Polukhin, 2012-2013. -// -// 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) - - diff --git a/test/testing_both.cpp b/test/testing_both.cpp deleted file mode 100644 index 783f611..0000000 --- a/test/testing_both.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright Antony Polukhin, 2012-2013. -// -// 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) - -#define BOOST_TEST_MODULE testing_both_test_module -#include -#include - -namespace my_namespace1 { - class my_class{}; -} - - -namespace my_namespace2 { - class my_class{}; -} - -#include "type_index_tests.ipp" -#include "template_index_tests.ipp" - diff --git a/test/testing_both_no_rtti.cpp b/test/testing_both_no_rtti.cpp deleted file mode 100644 index 4690316..0000000 --- a/test/testing_both_no_rtti.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright Antony Polukhin, 2012-2013. -// -// 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) - -#define BOOST_TEST_MODULE testing_both_test_module -#include -#include - -#ifndef BOOST_NO_RTTI -#error "This test must be run with disabled RTTI" -#endif - -namespace my_namespace1 { - class my_class{}; -} - - -namespace my_namespace2 { - class my_class{}; -} - -#include "type_index_tests.ipp" -#include "template_index_tests.ipp" - diff --git a/test/testing_minimal_no_rtti.cpp b/test/testing_minimal_no_rtti.cpp deleted file mode 100644 index 8f154b2..0000000 --- a/test/testing_minimal_no_rtti.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright Antony Polukhin, 2012-2013. -// -// 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) - -#define BOOST_TEST_MODULE testing_both_test_module -#include -#include - -#ifndef BOOST_NO_RTTI -#error "This test must be run with disabled RTTI" -#endif - -namespace my_namespace1 { - class my_class{}; -} - - -namespace my_namespace2 { - class my_class{}; -} - -#include "type_index_tests.ipp" - diff --git a/test/type_index_tests.ipp b/test/type_index_tests.ipp deleted file mode 100644 index d46d5c2..0000000 --- a/test/type_index_tests.ipp +++ /dev/null @@ -1,211 +0,0 @@ -// -// Copyright Antony Polukhin, 2012. -// -// 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 - -BOOST_AUTO_TEST_CASE(names_matches_type_id) -{ - using namespace boost; - BOOST_CHECK_EQUAL(type_id().name_demangled(), "int"); - BOOST_CHECK_EQUAL(type_id().name_demangled(), "double"); - - BOOST_CHECK_EQUAL(type_id().name(), type_id().name()); - BOOST_CHECK_NE(type_id().name(), type_id().name()); - BOOST_CHECK_NE(type_id().name(), type_id().name()); - BOOST_CHECK_EQUAL(type_id().name(), type_id().name()); -} - -BOOST_AUTO_TEST_CASE(comparators_type_id) -{ - using namespace boost; - type_index t_int = type_id(); - type_index t_double = type_id(); - - BOOST_CHECK_EQUAL(t_int, t_int); - BOOST_CHECK_LE(t_int, t_int); - BOOST_CHECK_GE(t_int, t_int); - BOOST_CHECK_NE(t_int, t_double); - - BOOST_CHECK_LE(t_double, t_double); - BOOST_CHECK_GE(t_double, t_double); - BOOST_CHECK_NE(t_double, t_int); - - BOOST_CHECK(t_double < t_int || t_int < t_double); - BOOST_CHECK(t_double > t_int || t_int > t_double); -} - -BOOST_AUTO_TEST_CASE(hash_code_type_id) -{ - using namespace boost; - std::size_t t_int1 = type_id().hash_code(); - std::size_t t_double1 = type_id().hash_code(); - - std::size_t t_int2 = type_id().hash_code(); - std::size_t t_double2 = type_id().hash_code(); - - BOOST_CHECK_EQUAL(t_int1, t_int2); - BOOST_CHECK_NE(t_int1, t_double2); - BOOST_CHECK_LE(t_double1, t_double2); -} - -#ifndef BOOST_NO_RTTI - - - -#endif // BOOST_NO_RTTI - -template -static void test_with_modofiers_type_id() { - using namespace boost; - - type_index t1 = type_id_with_cvr(); - type_index t2 = type_id_with_cvr(); - - BOOST_CHECK_NE(t2, t1); - BOOST_CHECK(t1 < t2 || t2 < t1); - BOOST_CHECK(t1 > t2 || t2 > t1); - - BOOST_CHECK_EQUAL(t1, type_id_with_cvr()); - BOOST_CHECK_EQUAL(t2, type_id_with_cvr()); - - BOOST_CHECK_EQUAL(t1.hash_code(), type_id_with_cvr().hash_code()); - BOOST_CHECK_EQUAL(t2.hash_code(), type_id_with_cvr().hash_code()); - - BOOST_CHECK_NE(t1.hash_code(), type_id_with_cvr().hash_code()); - BOOST_CHECK_NE(t2.hash_code(), type_id_with_cvr().hash_code()); -} - -BOOST_AUTO_TEST_CASE(type_id_storing_modifiers) -{ - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); - test_with_modofiers_type_id(); -#endif -} - -template -static void test_storing_nonstoring_modifiers() { - using namespace boost; - - type_index t1 = type_id_with_cvr(); - type_index t2 = type_id(); - - BOOST_CHECK_EQUAL(t2, t1); - BOOST_CHECK_EQUAL(t1, t2); - BOOST_CHECK(t1 <= t2); - BOOST_CHECK(t1 >= t2); - BOOST_CHECK(t2 <= t1); - BOOST_CHECK(t2 >= t1); - - BOOST_CHECK_EQUAL(t2.name_demangled(), t1.name_demangled()); -} - -BOOST_AUTO_TEST_CASE(type_id_storing_modifiers_vs_nonstoring) -{ - test_storing_nonstoring_modifiers(); - test_storing_nonstoring_modifiers(); - test_storing_nonstoring_modifiers(); - - boost::type_index t1 = boost::type_id_with_cvr(); - boost::type_index t2 = boost::type_id(); - BOOST_CHECK_NE(t2, t1); - BOOST_CHECK(t1.name_demangled() == "const int" || t1.name_demangled() == "int const"); -} - -BOOST_AUTO_TEST_CASE(type_index_stream_operator_via_lexical_cast_testing) -{ - using namespace boost; - std::string s_int1 = lexical_cast(type_id()); - BOOST_CHECK_EQUAL(s_int1, "int"); - - std::string s_double1 = lexical_cast(type_id()); - BOOST_CHECK_EQUAL(s_double1, "double"); -} - -BOOST_AUTO_TEST_CASE(type_index_stripping_cvr_test) -{ - using namespace boost; - - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - - - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); -} - - - -BOOST_AUTO_TEST_CASE(type_index_user_defined_class_test) -{ - using namespace boost; - - BOOST_CHECK_EQUAL(type_id(), type_id()); - BOOST_CHECK_EQUAL(type_id(), type_id()); - - - BOOST_CHECK_NE(type_id(), type_id()); - BOOST_CHECK_NE( - type_id().name_demangled().find("my_namespace1::my_class"), - std::string::npos); -} - - - - -