Test harness for Timer class.
More...
|
void | SetUp () override |
| Set up the test harness for running a test. More...
|
|
void | simpleTask (std::chrono::milliseconds duration) |
|
virtual | ~Test () |
|
Test harness for Timer class.
◆ SetUp()
void alexaClientSDK::avsCommon::utils::timing::test::TimerTest::SetUp |
( |
| ) |
|
|
overridevirtual |
Set up the test harness for running a test.
Reimplemented from testing::Test.
◆ simpleTask()
void alexaClientSDK::avsCommon::utils::timing::test::TimerTest::simpleTask |
( |
std::chrono::milliseconds |
duration | ) |
|
A simple task to test Timer instances with. This task records its start time in m_timestamps
and then waits for the specified duration before returning.
- Parameters
-
duration | The number of milliseconds to sleep before returning. |
◆ verifyTimestamps()
void alexaClientSDK::avsCommon::utils::timing::test::TimerTest::verifyTimestamps |
( |
std::chrono::time_point< std::chrono::steady_clock > |
startTime, |
|
|
std::chrono::milliseconds |
delay, |
|
|
std::chrono::milliseconds |
period, |
|
|
Timer::PeriodType |
periodType, |
|
|
std::chrono::milliseconds |
duration, |
|
|
size_t |
iterations = 1 |
|
) |
| |
|
protected |
Utility function which verifies the size and values of m_timestamps
after runnning a timer.
- Parameters
-
startTime | The start time for a timer, against which m_timestamps should be verified. |
period | The period of the timer. |
periodType | The type of period used for the timer. |
duration | The runtime duration of the timer task. |
iterations | The expected number of task calls made by the timer. |
◆ waitForInactive()
bool alexaClientSDK::avsCommon::utils::timing::test::TimerTest::waitForInactive |
( |
| ) |
|
|
protected |
Utility function which polls for a timer to go inactive. This function will time out and fail if the timer does not go inactive within SHORT_DELAY.
- Returns
true
if timer is inactive, else false
.
◆ m_conditionVariable
std::condition_variable alexaClientSDK::avsCommon::utils::timing::test::TimerTest::m_conditionVariable |
|
protected |
Condition variable to notify about changes to m_timestamps
.
◆ m_mutex
std::mutex alexaClientSDK::avsCommon::utils::timing::test::TimerTest::m_mutex |
|
protected |
Mutex which protects access to m_timestamps
.
◆ m_timer
std::shared_ptr<Timer> alexaClientSDK::avsCommon::utils::timing::test::TimerTest::m_timer |
|
protected |
The timer to use in the tests.
◆ m_timestamps
std::deque<std::chrono::time_point<std::chrono::steady_clock> > alexaClientSDK::avsCommon::utils::timing::test::TimerTest::m_timestamps |
|
protected |
This deque accumulates timestamps from timer calls to simpleTask().
The documentation for this class was generated from the following file:
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0