1 // 2 // sp_zero_compare_test.cpp - == 0, != 0 3 // 4 // Copyright 2012 Peter Dimov 5 // 6 // Distributed under the Boost Software License, Version 1.0. (See 7 // accompanying file LICENSE_1_0.txt or copy at 8 // http://www.boost.org/LICENSE_1_0.txt) 9 // 10 11 #include <boost/scoped_ptr.hpp> 12 #include <boost/scoped_array.hpp> 13 #include <boost/shared_ptr.hpp> 14 #include <boost/shared_array.hpp> 15 #include <boost/intrusive_ptr.hpp> 16 #include <boost/core/lightweight_test.hpp> 17 18 struct W 19 { 20 }; 21 intrusive_ptr_add_ref(W *)22void intrusive_ptr_add_ref( W* ) 23 { 24 } 25 intrusive_ptr_release(W *)26void intrusive_ptr_release( W* ) 27 { 28 } 29 main()30int main() 31 { 32 { 33 boost::scoped_ptr<int> p; 34 35 BOOST_TEST( p == 0 ); 36 BOOST_TEST( 0 == p ); 37 BOOST_TEST( !( p != 0 ) ); 38 BOOST_TEST( !( 0 != p ) ); 39 } 40 41 { 42 boost::scoped_array<int> p; 43 44 BOOST_TEST( p == 0 ); 45 BOOST_TEST( 0 == p ); 46 BOOST_TEST( !( p != 0 ) ); 47 BOOST_TEST( !( 0 != p ) ); 48 } 49 50 { 51 boost::shared_ptr<int> p; 52 53 BOOST_TEST( p == 0 ); 54 BOOST_TEST( 0 == p ); 55 BOOST_TEST( !( p != 0 ) ); 56 BOOST_TEST( !( 0 != p ) ); 57 } 58 59 { 60 boost::shared_array<int> p; 61 62 BOOST_TEST( p == 0 ); 63 BOOST_TEST( 0 == p ); 64 BOOST_TEST( !( p != 0 ) ); 65 BOOST_TEST( !( 0 != p ) ); 66 } 67 68 { 69 boost::intrusive_ptr<W> p; 70 71 BOOST_TEST( p == 0 ); 72 BOOST_TEST( 0 == p ); 73 BOOST_TEST( !( p != 0 ) ); 74 BOOST_TEST( !( 0 != p ) ); 75 } 76 77 return boost::report_errors(); 78 } 79