1//
2// atomic_count_test.cpp
3//
4// Copyright 2005 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/detail/atomic_count.hpp>
12#include <boost/core/lightweight_test.hpp>
13
14int main()
15{
16 boost::detail::atomic_count n( 4 );
17
18 BOOST_TEST( n == 4L );
19
20 ++n;
21
22 BOOST_TEST( n == 5L );
23 BOOST_TEST( --n != 0L );
24
25 boost::detail::atomic_count m( 0 );
26
27 BOOST_TEST( m == 0 );
28
29 ++m;
30
31 BOOST_TEST( m == 1 );
32
33 ++m;
34
35 BOOST_TEST( m == 2 );
36 BOOST_TEST( --m != 0 );
37 BOOST_TEST( --m == 0 );
38
39 return boost::report_errors();
40}
41

source code of boost/libs/smart_ptr/test/atomic_count_test.cpp