Macros | Functions
simple_stats_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "cetlib/simple_stats.h"
#include <cmath>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (simple_stats test)
 

Functions

 BOOST_AUTO_TEST_CASE (default_ctor_test)
 
 BOOST_AUTO_TEST_CASE (value_ctor_test)
 
 BOOST_AUTO_TEST_CASE (sample_test)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (simple_stats test)

Definition at line 1 of file simple_stats_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( default_ctor_test  )

Definition at line 12 of file simple_stats_t.cc.

13 {
15 
16  BOOST_TEST(s.size() == 0u);
17  BOOST_TEST((std::isinf(s.max()) && s.max() < 0.0));
18  BOOST_TEST((std::isinf(s.min()) && s.min() > 0.0));
19  BOOST_TEST(std::isinf(s.small()));
20  BOOST_TEST(s.sum() == 0.0);
21  BOOST_TEST(s.sumsq() == 0.0);
22 
23  BOOST_TEST(std::isnan(s.mean()));
24  BOOST_TEST(std::isnan(s.rms()));
25  BOOST_TEST(std::isnan(s.rms0()));
26 }
std::size_t size() const noexcept
Definition: simple_stats.h:35
double small() const noexcept
Definition: simple_stats.h:50
double mean() const noexcept
Definition: simple_stats.cc:46
double rms0(std::size_t nparams=0u) const noexcept
Definition: simple_stats.cc:80
double min() const noexcept
Definition: simple_stats.h:45
double max() const noexcept
Definition: simple_stats.h:40
double sum() const noexcept
Definition: simple_stats.h:55
double sumsq() const noexcept
Definition: simple_stats.h:60
double rms(std::size_t nparams=1u) const noexcept
Definition: simple_stats.cc:66
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( value_ctor_test  )

Definition at line 28 of file simple_stats_t.cc.

29 {
30  double pi = 3.14;
31  simple_stats s(pi);
32 
33  BOOST_TEST(s.size() == 1u);
34  BOOST_TEST(s.max() == pi);
35  BOOST_TEST(s.min() == pi);
36  BOOST_TEST(s.small() == pi);
37  BOOST_TEST(s.sum() == pi);
38  BOOST_TEST(s.sumsq() == pi * pi);
39 
40  BOOST_TEST(s.mean() == pi);
41  BOOST_TEST(std::isnan(s.rms()));
42  BOOST_TEST(std::isnan(s.rms0(1u)));
43 }
uint size() const
Definition: qcstring.h:201
float pi
Definition: units.py:11
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( sample_test  )

Definition at line 45 of file simple_stats_t.cc.

46 {
47  double pi = 3.14;
48  simple_stats s(pi);
49  s.sample(-pi);
50 
51  BOOST_TEST(s.size() == 2u);
52  BOOST_TEST(s.max() == pi);
53  BOOST_TEST(s.min() == -pi);
54  BOOST_TEST(s.small() == pi);
55  BOOST_TEST(s.sum() == 0.0);
56  BOOST_TEST(s.sumsq() == 2 * pi * pi);
57 
58  BOOST_TEST(s.mean() == 0.0);
59 }
uint size() const
Definition: qcstring.h:201
float pi
Definition: units.py:11
static QCString * s
Definition: config.cpp:1042