11 #include <gtest/gtest.h>
13 #include "../../include/ecl/time/frequency.hpp"
14 #include "../../include/ecl/time/sleep.hpp"
15 #include "../../include/ecl/time/timestamp.hpp"
21 #ifdef ECL_HAS_TIMESTAMP
29 ostream << std::fixed;
30 ostream <<
"hz : " << diagnostics.
hz;
33 ostream <<
", last_incoming : " << diagnostics.
last_incoming << std::scientific;
43 TEST(FrequencyMonitorTests,silent) {
48 ecl::MilliSleep sleep_ms;
49 unsigned int period = 100;
55 for (
unsigned int i = 0; i < 50; ++i ) {
57 diagnostics = monitor.analyse();
60 std::cout << diagnostics << std::endl;
61 EXPECT_NEAR(diagnostics.
hz, 10.0, epsilon);
65 std::cout << diagnostics << std::endl;
66 EXPECT_NEAR(diagnostics.
hz, 5.0, epsilon);
76 int main(
int argc,
char **argv) {
78 testing::InitGoogleTest(&argc,argv);
79 return RUN_ALL_TESTS();