1// (C) Copyright Eric Niebler 2005.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#include <boost/test/unit_test.hpp>
7#include <boost/accumulators/accumulators.hpp>
8#include <boost/accumulators/statistics/stats.hpp>
9#include <boost/accumulators/statistics/count.hpp>
10
11using namespace boost;
12using namespace unit_test;
13using namespace accumulators;
14
15///////////////////////////////////////////////////////////////////////////////
16// test_stat
17//
18void test_stat()
19{
20 accumulator_set<int, stats<tag::count> > acc;
21
22 acc(1);
23 BOOST_CHECK_EQUAL(1u, count(acc));
24
25 acc(1);
26 BOOST_CHECK_EQUAL(2u, count(acc));
27
28 acc(1);
29 BOOST_CHECK_EQUAL(3u, count(acc));
30
31 acc(1);
32 BOOST_CHECK_EQUAL(4u, count(acc));
33
34 acc(1);
35 BOOST_CHECK_EQUAL(5u, count(acc));
36}
37
38///////////////////////////////////////////////////////////////////////////////
39// init_unit_test_suite
40//
41test_suite* init_unit_test_suite( int argc, char* argv[] )
42{
43 test_suite *test = BOOST_TEST_SUITE("count test");
44
45 test->add(BOOST_TEST_CASE(&test_stat));
46
47 return test;
48}
49

source code of boost/libs/accumulators/test/count.cpp