LCOV - code coverage report
Current view: top level - unit_tests/tests/util - test_exp_average.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 25 25 100.0 %
Date: 2024-04-25 02:23:43 Functions: 12 12 100.0 %

          Line data    Source code
       1             : #include "pch.h"
       2             : 
       3             : #include "exp_average.h"
       4             : 
       5           4 : TEST(exp_average, length1) {
       6           1 :     ExpAverage ea;
       7           1 :     ea.init(1);
       8           1 :     ASSERT_NEAR(ea.average(3), 3, EPS2D);
       9           1 :     ASSERT_NEAR(ea.average(8), 8, EPS2D);
      10           1 :     ASSERT_NEAR(ea.average(3), 3, EPS2D);
      11           1 :     ASSERT_NEAR(ea.average(8), 8, EPS2D);
      12             : }
      13             : 
      14           4 : TEST(exp_average, length2) {
      15           1 :     ExpAverage ea;
      16           1 :     ea.init(2);
      17           1 :     ASSERT_NEAR(ea.average(3), 2, EPS2D);
      18           1 :     ASSERT_NEAR(ea.average(8), 6, EPS2D);
      19           1 :     ASSERT_NEAR(ea.average(3), 4, EPS2D);
      20           1 :     ASSERT_NEAR(ea.average(8), 6.6666, EPS2D);
      21             : }
      22             : 
      23           4 : TEST(exp_average, length12) {
      24           1 :     ExpAverage ea;
      25           1 :     ea.init(12);
      26           1 :     ASSERT_NEAR(ea.average(3), 0.4615, EPS2D);
      27           1 :     ASSERT_NEAR(ea.average(8), 1.6213, EPS2D);
      28           1 :     ASSERT_NEAR(ea.average(3), 1.8334, EPS2D);
      29           1 :     ASSERT_NEAR(ea.average(8), 2.7821, EPS2D);
      30             : 
      31         301 :     for (int i = 0;i<300;i++) {
      32         300 :         ea.average(3);
      33         300 :         ea.average(8);
      34             :     }
      35           1 :     ASSERT_NEAR(ea.average(3), 5.2916, EPS2D);
      36             : }

Generated by: LCOV version 1.14