preCICE v3.1.1
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
13BOOST_AUTO_TEST_CASE(DistanceAccumulator)
14{
15 PRECICE_TEST(1_rank);
16 pu::statistics::DistanceAccumulator acc;
17 acc(0.01);
18 BOOST_TEST(!acc.empty());
19 BOOST_TEST(acc.count() == 1);
20 BOOST_TEST(acc.min() == 0.01);
21 BOOST_TEST(acc.max() == 0.01);
22 BOOST_TEST(acc.mean() == 0.01);
23 BOOST_TEST(acc.variance() == 0);
24
25 acc(1);
26 acc(-1);
27 acc(23);
28 acc(11);
29 BOOST_TEST(acc.min() == -1);
30 BOOST_TEST(acc.min() != 0);
31 BOOST_TEST(acc.max() == 23);
32}
33
34BOOST_AUTO_TEST_CASE(DistanceAccumulatorOnEmptyMesh)
35{
36 pu::statistics::DistanceAccumulator acc;
37 BOOST_TEST(acc.empty());
38 BOOST_TEST(acc.count() == 0);
39 BOOST_TEST(std::isnan(acc.min()));
40 BOOST_TEST(std::isnan(acc.mean()));
41 BOOST_TEST(std::isnan(acc.max()));
42 BOOST_TEST(std::isnan(acc.variance()));
43}
44
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(DistanceAccumulator)
#define PRECICE_TEST(...)
Definition Testing.hpp:27
T isnan(T... args)
contains precice-related utilities.
Main namespace of the precice library.