13 #include <gtest/gtest.h>
14 #include "../../include/ecl/statistics/cumulative_statistics.hpp"
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());
56 int main(
int argc,
char **argv) {
58 testing::InitGoogleTest(&argc,argv);
59 return RUN_ALL_TESTS();