2 // atomic_count_test2.cpp
4 // Copyright 2009 Peter Dimov
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
11 #include <boost/detail/atomic_count.hpp>
12 #include <boost/detail/lightweight_test.hpp>
16 boost::detail::atomic_count n( 4 );
20 BOOST_TEST( ++n == 5 );
21 BOOST_TEST( ++n == 6 );
25 BOOST_TEST( --n == 5 );
26 BOOST_TEST( --n == 4 );
30 boost::detail::atomic_count m( 0 );
34 BOOST_TEST( ++m == 1 );
35 BOOST_TEST( ++m == 2 );
39 BOOST_TEST( --m == 1 );
40 BOOST_TEST( --m == 0 );
44 BOOST_TEST( --m == -1 );
45 BOOST_TEST( --m == -2 );
47 BOOST_TEST( m == -2 );
49 BOOST_TEST( ++m == -1 );
50 BOOST_TEST( ++m == 0 );
54 return boost::report_errors();