lightweight_test_test4.cpp 857 B

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // Test for BOOST_TEST_TRAIT_SAME
  3. //
  4. // Copyright 2014, 2019 Peter Dimov
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. //
  10. #include <boost/core/lightweight_test_trait.hpp>
  11. struct X
  12. {
  13. typedef int type;
  14. };
  15. template<class T1, class T2> struct Y
  16. {
  17. typedef T1 type;
  18. };
  19. int main()
  20. {
  21. BOOST_TEST_TRAIT_SAME(X, X);
  22. BOOST_TEST_TRAIT_SAME(void, void);
  23. BOOST_TEST_TRAIT_SAME(char[1], char[1]);
  24. BOOST_TEST_TRAIT_SAME(char[], char[]);
  25. BOOST_TEST_TRAIT_SAME(void(), void());
  26. BOOST_TEST_TRAIT_SAME(X::type, X::type);
  27. BOOST_TEST_TRAIT_SAME(X::type, Y<int, float>::type);
  28. BOOST_TEST_TRAIT_SAME(Y<int, float>, Y<int, float>);
  29. BOOST_TEST_TRAIT_SAME(Y<void, float>::type, void);
  30. return boost::report_errors();
  31. }