#include #include "stats.hpp" #include "rand.hpp" #include #include TEST_CASE("basic stats tests", "[stats]") { Stats stat1; stat1.sample(1.0); for(int i = 0; i < 20; i++) { double x = Random::normal(20.0,5.0); stat1.sample(x); REQUIRE(!std::isnan(stat1.stddev())); REQUIRE(stat1.mean() < stat1.mean() + stat1.stddev() * 4.0); } stat1.dump(); stat1.reset(); REQUIRE(stat1.n == 0.0); auto timer = stat1.time_start(); for(int i = 0; i < 20; i++) { stat1.sample_time(timer); } }