19 #include "gtest/gtest.h" 25 TEST(RateTimerTest, ComputeRate) {
28 for (
int i = 0; i < 100; ++i) {
29 rate_timer.Pulse(time);
32 EXPECT_NEAR(10., rate_timer.ComputeRate(), 1e-3);
35 struct SimulatedClock {
36 using rep = std::chrono::steady_clock::rep;
37 using period = std::chrono::steady_clock::period;
38 using duration = std::chrono::steady_clock::duration;
39 using time_point = std::chrono::steady_clock::time_point;
42 static time_point now() noexcept {
return time; }
47 TEST(RateTimerTest, ComputeWallTimeRateRatio) {
50 for (
int i = 0; i < 100; ++i) {
51 rate_timer.Pulse(time);
53 SimulatedClock::time +=
54 std::chrono::duration_cast<SimulatedClock::duration>(
55 std::chrono::duration<double>(0.05));
57 EXPECT_NEAR(2., rate_timer.ComputeWallTimeRateRatio(), 1e-3);
UniversalTimeScaleClock::time_point Time
Time FromUniversal(const int64 ticks)
Duration FromSeconds(const double seconds)
TEST(TrajectoryConnectivityStateTest, UnknownTrajectory)