Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unit-tests
utilities
time
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
{
19
periodic_timer
pt(
TEST_DELTA_TIME
);
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
{
34
periodic_timer
pt(
TEST_DELTA_TIME
);
35
36
CHECK_FALSE
(pt);
37
pt.
set_expired
();
38
CHECK
(pt);
39
}
utilities::time::periodic_timer
Definition:
periodic_timer.h:19
TEST_DELTA_TIME
const auto TEST_DELTA_TIME
Definition:
unit-tests/utilities/time/common.h:17
TEST_CASE
TEST_CASE("Test periodic time expiration","[periodic_timer]")
Definition:
test-periodic_timer.cpp:17
utilities::time::periodic_timer::set_expired
void set_expired()
Definition:
periodic_timer.h:40
utilities::time
Definition:
common/utilities/time/common.h:10
common.h
i
int i
Definition:
rs-pcl-color.cpp:54
CHECK
#define CHECK(condition)
Definition:
easylogging++.h:4483
CHECK_FALSE
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