cumulative_statistics.cpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Includes
10 *****************************************************************************/
11 
12 #include <iostream>
13 #include <gtest/gtest.h>
14 #include "../../include/ecl/statistics/cumulative_statistics.hpp"
15 
16 /*****************************************************************************
17 ** Tests
18 *****************************************************************************/
19 
20 TEST(CumulativeStatistics, cumulative) {
21  std::cout << std::endl;
22  std::cout << "***********************************************************" << std::endl;
23  std::cout << " Cumulative Statistics" << std::endl;
24  std::cout << "***********************************************************" << std::endl;
25  std::cout << std::endl;
27  std::cout << "Size: " << statistics.size() << std::endl;
28  std::cout << " Mean: " << statistics.mean() << std::endl;
29  std::cout << " Variance: " << statistics.variance() << std::endl;
30  EXPECT_FLOAT_EQ(0.0, statistics.size());
31  EXPECT_FLOAT_EQ(0.0, statistics.mean());
32  EXPECT_FLOAT_EQ(0.0, statistics.variance());
33  statistics.push_back(1.0);
34  std::cout << "Size: " << statistics.size() << std::endl;
35  std::cout << " Mean: " << statistics.mean() << std::endl;
36  std::cout << " Variance: " << statistics.variance() << std::endl;
37  EXPECT_FLOAT_EQ(1.0, statistics.size());
38  EXPECT_FLOAT_EQ(1.0, statistics.mean());
39  EXPECT_FLOAT_EQ(0.0, statistics.variance());
40  statistics.push_back(2.0);
41  statistics.push_back(3.0);
42  statistics.push_back(4.0);
43  statistics.push_back(5.0);
44  std::cout << "Size: " << statistics.size() << std::endl;
45  std::cout << " Mean: " << statistics.mean() << std::endl;
46  std::cout << " Variance: " << statistics.variance() << std::endl;
47  EXPECT_FLOAT_EQ(5.0, statistics.size());
48  EXPECT_FLOAT_EQ(3.0, statistics.mean());
49  EXPECT_FLOAT_EQ(2.5, statistics.variance());
50 }
51 
52 /*****************************************************************************
53 ** Main program
54 *****************************************************************************/
55 
56 int main(int argc, char **argv) {
57 
58  testing::InitGoogleTest(&argc,argv);
59  return RUN_ALL_TESTS();
60 }
61 
62 
Dummy parent class for Homogenous points.
int main(int argc, char **argv)
TEST(CumulativeStatistics, cumulative)


ecl_statistics
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:27