lightweight_test_eq_nullptr.cpp 592 B

12345678910111213141516171819202122232425262728293031
  1. //
  2. // Test BOOST_TEST_EQ( p, nullptr )
  3. //
  4. // Copyright 2017 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/config.hpp>
  11. #include <boost/core/lightweight_test.hpp>
  12. int main()
  13. {
  14. #if !defined( BOOST_NO_CXX11_NULLPTR )
  15. int x = 0;
  16. int* p1 = 0;
  17. int* p2 = &x;
  18. BOOST_TEST_EQ( p1, nullptr );
  19. BOOST_TEST_NE( p2, nullptr );
  20. BOOST_TEST_EQ( nullptr, p1 );
  21. BOOST_TEST_NE( nullptr, p2 );
  22. #endif
  23. return boost::report_errors();
  24. }