atomic_count_test.cpp added.

[SVN r27746]
This commit is contained in:
Peter Dimov
2005-03-20 15:40:30 +00:00
parent c6bf857f8b
commit adec862262
3 changed files with 42 additions and 0 deletions

View File

@ -26,6 +26,7 @@ DEPENDS all : smart_ptr ;
[ run get_deleter_test.cpp ]
[ run intrusive_ptr_test.cpp ]
[ run intrusive_ptr_test.cpp ]
[ run atomic_count_test.cpp ]
[ compile-fail shared_ptr_assign_fail.cpp ]
;

View File

@ -20,6 +20,7 @@ import testing ;
[ run shared_from_this_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-non-virtual-dtor ]
[ run get_deleter_test.cpp ]
[ run intrusive_ptr_test.cpp ]
[ run atomic_count_test.cpp ]
[ compile-fail shared_ptr_assign_fail.cpp ]
;

View File

@ -0,0 +1,40 @@
//
// astomic_count_test.cpp
//
// Copyright 2005 Peter Dimov
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/detail/atomic_count.hpp>
#include <boost/detail/lightweight_test.hpp>
int main()
{
boost::detail::atomic_count n( 4 );
BOOST_TEST( n == 4L );
++n;
BOOST_TEST( n == 5L );
BOOST_TEST( --n != 0L );
boost::detail::atomic_count m( 0 );
BOOST_TEST( m == 0 );
++m;
BOOST_TEST( m == 1 );
++m;
BOOST_TEST( m == 2 );
BOOST_TEST( --m != 0 );
BOOST_TEST( --m == 0 );
return boost::report_errors();
}