is_same_test.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Test for core::is_same<T1,T2>
  3. //
  4. // Copyright 2014 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/is_same.hpp>
  11. #include <boost/core/lightweight_test_trait.hpp>
  12. struct X
  13. {
  14. };
  15. struct Y
  16. {
  17. };
  18. int main()
  19. {
  20. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<X, X> ));
  21. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<Y, Y> ));
  22. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<void, void> ));
  23. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<int, int> ));
  24. BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<void const volatile, void const volatile> ));
  25. BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, Y> ));
  26. BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, X const> ));
  27. BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, void> ));
  28. BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<X, int> ));
  29. BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<int, void> ));
  30. BOOST_TEST_TRAIT_FALSE(( boost::core::is_same<void, void const volatile> ));
  31. return boost::report_errors();
  32. }