preCICE v3.2.0
Loading...
Searching...
No Matches
StatisticsTest.cpp
Go to the documentation of this file.
1#include <cmath>
2#include "math/constants.hpp"
4#include "testing/Testing.hpp"
6#include "utils/String.hpp"
7
8using namespace precice;
9namespace pu = precice::utils;
10
11BOOST_AUTO_TEST_SUITE(UtilsTests)
12
14BOOST_AUTO_TEST_CASE(DistanceAccumulator)
15{
18 acc(0.01);
19 BOOST_TEST(!acc.empty());
20 BOOST_TEST(acc.count() == 1);
21 BOOST_TEST(acc.min() == 0.01);
22 BOOST_TEST(acc.max() == 0.01);
23 BOOST_TEST(acc.mean() == 0.01);
24 BOOST_TEST(acc.variance() == 0);
25
26 acc(1);
27 acc(-1);
28 acc(23);
29 acc(11);
30 BOOST_TEST(acc.min() == -1);
31 BOOST_TEST(acc.min() != 0);
32 BOOST_TEST(acc.max() == 23);
33}
34
36BOOST_AUTO_TEST_CASE(DistanceAccumulatorOnEmptyMesh)
37{
40 BOOST_TEST(acc.empty());
41 BOOST_TEST(acc.count() == 0);
42 BOOST_TEST(std::isnan(acc.min()));
43 BOOST_TEST(std::isnan(acc.mean()));
44 BOOST_TEST(std::isnan(acc.max()));
45 BOOST_TEST(std::isnan(acc.variance()));
46}
47
BOOST_AUTO_TEST_CASE(testIQNIMVJPPWithSubsteps)
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
#define PRECICE_TEST()
Definition Testing.hpp:39
#define PRECICE_TEST_SETUP(...)
Creates and attaches a TestSetup to a Boost test case.
Definition Testing.hpp:29
double min() const
Returns the minimum of all accumulated values.
double mean() const
Returns the mean of all accumulated values.
double max() const
Returns the maximum of all accumulated values.
double variance() const
Returns the sample variance based on all accumulated values.
bool empty() const
Returns count == 0.
std::size_t count() const
Returns how many values have been accumulated.
T isnan(T... args)
contains precice-related utilities.
Main namespace of the precice library.