test-periodic_timer.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 // Unit Test Goals:
5 // Test the timer utility classes: stopwatch, timer, periodic_timer.
6 
7 //#cmake:add-file ../../../common/utilities/time/periodic_timer.h
8 
9 #include "common.h"
10 #include "../common/utilities/time/periodic_timer.h"
11 
12 using namespace utilities::time;
13 
14 // Test description:
15 // Verify the timer expired and restart itself
16 
17 TEST_CASE( "Test periodic time expiration", "[periodic_timer]" )
18 {
20  for (auto i = 0; i < 5; ++i)
21  {
22  CHECK_FALSE(pt);
23  std::this_thread::sleep_for(TEST_DELTA_TIME);
24  CHECK(pt);
25  }
26 
27  CHECK_FALSE(pt);
28 }
29 
30 // Test description:
31 // Verify the we can force the time expiration
32 TEST_CASE("Test force time expiration", "[periodic_timer]")
33 {
35 
36  CHECK_FALSE(pt);
37  pt.set_expired();
38  CHECK(pt);
39 }
const auto TEST_DELTA_TIME
TEST_CASE("Test periodic time expiration","[periodic_timer]")
int i
#define CHECK(condition)
CHECK_FALSE(inverse(inverse(p))==p)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11