test_has_type.cpp 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // (C) Copyright Edward Diener 2011
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #include "test_has_type.hpp"
  6. #include <boost/detail/lightweight_test.hpp>
  7. int main()
  8. {
  9. BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnIntType)<AType>::value);
  10. BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<AType>::value);
  11. BOOST_TEST(NameStruct<AType>::value);
  12. BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(BType)<AType>::value);
  13. BOOST_TEST(TheInteger<AType::BType>::value);
  14. BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(CType)<AType::BType>::value);
  15. BOOST_TEST(BOOST_TTI_HAS_TYPE_GEN(AnotherIntegerType)<AType::BType::CType>::value);
  16. BOOST_TEST(SomethingElse<AnotherType>::value);
  17. BOOST_TEST(!BOOST_TTI_HAS_TYPE_GEN(NoOtherType)<AnotherType>::value);
  18. // Passing non-class enclosing type will return false
  19. BOOST_TEST(!BOOST_TTI_HAS_TYPE_GEN(AnIntTypeReference)<signed long>::value);
  20. BOOST_TEST(!NameStruct<AType &>::value);
  21. return boost::report_errors();
  22. }