AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Enumerations | Functions | Variables
alexaClientSDK::avsCommon::utils::timing::test Namespace Reference

Classes

class  StopTaskTimer
 
class  StopTaskTimerDelegateFactory
 
class  StopwatchTest
 Test harness for Stopwatch class. More...
 
class  TimerDelegateTest
 
class  TimerTest
 Test harness for Timer class. More...
 

Enumerations

enum  TestType { TestType::GMTIME, TestType::LOCALTIME }
 

Functions

 TEST_F (TimerDelegateTest, test_basicTimerDelegateAPI)
 
 TEST_F (TimerDelegateTest, test_stopAndStartTimeDelegate)
 Test to verify the stop and start API. More...
 
 TEST_F (TimerDelegateTest, test_doubleStopTestAVS)
 Test to verify that stopping an already stopped timer is a no-op. More...
 
 TEST_F (TimerDelegateTest, test_verifyTaskWithFixedDuration)
 
 TEST_F (TimerDelegateTest, test_verifyTaskWithVariableDuration)
 
 TEST_F (TimerDelegateTest, test_doubleStartMustWaitForPreviousIterations)
 
 TEST_F (TimerDelegateTest, test_taskWithStop)
 
 TEST (MultiTimerTest, test_taskGetsCalled)
 Test that an enqueued task gets called. More...
 
 TEST (MultiTimerTest, testTimer_cancelledTaskShouldNotRun)
 Test that an enqueued task that is cancelled before its expiration date does not run. More...
 
 TEST (MultiTimerTest, test_executionOrderFollowExpirationTime)
 
 TEST (MultiTimerTest, test_multipleTasksGetCalledInOrder)
 Insert two tasks to the timer with the same delay. Expect that the tasks are run in the order they were inserted. More...
 
 TEST (SafeCTimeAccessTest, test_getGmtimeNullReturnValue)
 Test to verify that getGmtime returns failure if a nullptr is passed for the result variable. More...
 
 TEST (SafeCTimeAccessTest, test_getLocaltimeNullReturnValue)
 Test to verify that getLocaltime returns failure if a nullptr is passed for the result variable. More...
 
static void checkTm (const std::tm &a, const std::tm &b)
 
static void testGmtimeHelper (const std::tm &expected, const time_t &t)
 
static void testLocaltimeHelper (const std::tm &expected, const time_t &t)
 
 TEST (SafeCTimeAccessTest, test_getGmtimeAtTheEpoch)
 Test to verify that getGmtime returns the correct calendar date for the Unix epoch. More...
 
 TEST (SafeCTimeAccessTest, test_getGmtime)
 Test to verify that getGmtime returns the same calendar date as std::gmtime. More...
 
 TEST (SafeCTimeAccessTest, test_getLocaltime)
 Test to verify that getLocaltime returns the same calendar date as std::localtime. More...
 
static void callSafeCTimeFunction (int startingSeed, const TestType &type, std::vector< std::pair< time_t, std::tm >> *results)
 
static void checkSafeCTimeFunction (const TestType &type)
 
 TEST (SafeCTimeAccessTest, DISABLED_test_gmTimeMultithreadedAccess)
 Test to make sure that multithreaded access SafeCTimeAccess::getGmtime is safe. More...
 
 TEST (SafeCTimeAccessTest, DISABLED_test_localtimeMultithreadedAccess)
 Test to make sure that multithreaded access SafeCTimeAccess::getLocaltimetime is safe. More...
 
 TEST_F (StopwatchTest, test_goodSequencing)
 
 TEST_F (StopwatchTest, test_badSequencing)
 
 TEST_F (StopwatchTest, testSlow_elapsed)
 
 TEST_F (TimerTest, testTimer_singleShot)
 This test runs a single-shot timer and verifies that the task is called once, at the expected time. More...
 
 TEST_F (TimerTest, testTimer_multiShot)
 
 TEST_F (TimerTest, testTimer_multiShotWithDelay)
 
 TEST_F (TimerTest, testTimer_forever)
 
 TEST_F (TimerTest, testTimer_slowTaskLessThanPeriod)
 
 TEST_F (TimerTest, testTimer_slowTaskGreaterThanPeriod)
 
 TEST_F (TimerTest, testTimer_slowTaskGreaterThanTwoPeriods)
 
 TEST_F (TimerTest, testTimer_endToStartPeriod)
 
 TEST_F (TimerTest, testTimer_stopSingleShotBeforeTask)
 
 TEST_F (TimerTest, testTimer_stopSingleShotDuringTask)
 
 TEST_F (TimerTest, testTimer_stopSingleShotAfterTask)
 
 TEST_F (TimerTest, testTimer_stopMultiShot)
 
 TEST_F (TimerTest, testTimer_startRunningBeforeTask)
 
 TEST_F (TimerTest, testTimer_startRunningDuringTask)
 
 TEST_F (TimerTest, testTimer_startRunningAfterTask)
 
 TEST_F (TimerTest, test_deleteBeforeTask)
 This test verifies that a timer which is deleted while active, but before running its task, does not run the task. More...
 
 TEST_F (TimerTest, testTimer_deleteDuringTask)
 This test verifies that a timer which is deleted while running a task completes the task. More...
 
 TEST_F (TimerTest, testTimer_startRunningAfterStopDuringTask)
 
 TEST_F (TimerTest, testTimer_multipleStopsDoesntDeadlock)
 
 TEST (TimeTest, test_stringConversion)
 
 TEST (TimeTest, test_iso8601StringConversion)
 
 TEST (TimeTest, test_iso8601StringConversionUTC)
 
 TEST (TimeTest, test_stringConversionError)
 
 TEST (TimeTest, test_stringConversionNullParam)
 
 TEST (TimeTest, test_timeConversion)
 
 TEST (TimeTest, test_timeConversionCurrentTime)
 
 TEST (TimeTest, test_currentTime)
 
 TEST (TimeTest, test_currentTimeNullParam)
 
static void testIso8601ConversionHelper (const std::string &expectedString, const std::chrono::seconds sec, const std::chrono::microseconds us)
 
 TEST (TimeTest, test_iso8601Conversion)
 

Variables

const time_t LARGE_TIME_VALUE = (0x1 << 30) - 1
 A bound on the upper time to check. More...
 
static std::mutex g_resultsLock
 Mutex to guard access to the results vector. More...
 
static const std::chrono::milliseconds TESTABLE_TIME_INCREMENT {100}
 
static const auto ACCURACY = std::chrono::milliseconds(15)
 Specifies the expected timing accuracy (timestamps must be within +/- ACCURACY of expected values). More...
 
static const auto NO_DELAY = std::chrono::milliseconds(0)
 Used for cases where the task should return immediately, without delay. More...
 
static const auto SHORT_DELAY = ACCURACY * 2
 Used for cases where the task duration or timer period should be shorter than MEDIUM_DELAY and LONG_DELAY. More...
 
static const auto MEDIUM_DELAY = SHORT_DELAY + ACCURACY
 Used for cases where the task duration or timer period should be greater than SHORT_DELAY and less than LONG_DELAY. More...
 
static const auto LONG_DELAY = SHORT_DELAY * 2 + ACCURACY
 
static const auto TIMEOUT = std::chrono::seconds(1)
 
static const size_t ITERATIONS = 5
 Number of task iterations to run for multi-shot tests. More...
 

Enumeration Type Documentation

◆ TestType

The test code for SafeCTimeTest::getGmtime and SafeCTimeTest::getLocaltime is almost identical, this allows switching between them.

Enumerator
GMTIME 
LOCALTIME 

Function Documentation

◆ callSafeCTimeFunction()

static void alexaClientSDK::avsCommon::utils::timing::test::callSafeCTimeFunction ( int  startingSeed,
const TestType type,
std::vector< std::pair< time_t, std::tm >> *  results 
)
static

Function that accesses the safe time functions that is called from many threads. We call the function in a tight loop with no lock and save the results to be checked later.

Parameters
startingSeedThis is used to make sure that different time values are checked.
typeThe flavor of testing to perform. Can be GMTIME or LOCALTIME.
resultsA vector where the results are appended to be checked later.

◆ checkSafeCTimeFunction()

static void alexaClientSDK::avsCommon::utils::timing::test::checkSafeCTimeFunction ( const TestType type)
static

Main function for testing multithreaded access to the safe time functions. This function starts multiple threads that continuously access the time functions in an externally thread-unsafe manner. The results are collected in a single vector, where they are compared against the matching system function.

Parameters
typeThe flavor of testing to perform. Can be GMTIME or LOCALTIME.

◆ checkTm()

static void alexaClientSDK::avsCommon::utils::timing::test::checkTm ( const std::tm &  a,
const std::tm &  b 
)
static

Utility function to check to see if two std::tm objects are equal.

Parameters
aOne of the structures to check.
bThe other structure to check.

◆ TEST() [1/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_stringConversion   
)

◆ TEST() [2/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( MultiTimerTest  ,
test_taskGetsCalled   
)

Test that an enqueued task gets called.

◆ TEST() [3/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
test_getGmtimeNullReturnValue   
)

Test to verify that getGmtime returns failure if a nullptr is passed for the result variable.

◆ TEST() [4/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( MultiTimerTest  ,
testTimer_cancelledTaskShouldNotRun   
)

Test that an enqueued task that is cancelled before its expiration date does not run.

◆ TEST() [5/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
test_getLocaltimeNullReturnValue   
)

Test to verify that getLocaltime returns failure if a nullptr is passed for the result variable.

◆ TEST() [6/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_iso8601StringConversion   
)

◆ TEST() [7/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( MultiTimerTest  ,
test_executionOrderFollowExpirationTime   
)

Insert two tasks to the timer where the first task has a longer wait period and the second is much shorter. Expect that the second one is run first. The first task should not run since we will exit the test before its expiration time.

◆ TEST() [8/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_iso8601StringConversionUTC   
)

◆ TEST() [9/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( MultiTimerTest  ,
test_multipleTasksGetCalledInOrder   
)

Insert two tasks to the timer with the same delay. Expect that the tasks are run in the order they were inserted.

◆ TEST() [10/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
test_getGmtimeAtTheEpoch   
)

Test to verify that getGmtime returns the correct calendar date for the Unix epoch.

◆ TEST() [11/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_stringConversionError   
)

◆ TEST() [12/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_stringConversionNullParam   
)

◆ TEST() [13/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
test_getGmtime   
)

Test to verify that getGmtime returns the same calendar date as std::gmtime.

◆ TEST() [14/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_timeConversion   
)

◆ TEST() [15/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
test_getLocaltime   
)

Test to verify that getLocaltime returns the same calendar date as std::localtime.

◆ TEST() [16/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_timeConversionCurrentTime   
)

◆ TEST() [17/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_currentTime   
)

◆ TEST() [18/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_currentTimeNullParam   
)

◆ TEST() [19/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( TimeTest  ,
test_iso8601Conversion   
)

◆ TEST() [20/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
DISABLED_test_gmTimeMultithreadedAccess   
)

Test to make sure that multithreaded access SafeCTimeAccess::getGmtime is safe.

◆ TEST() [21/21]

alexaClientSDK::avsCommon::utils::timing::test::TEST ( SafeCTimeAccessTest  ,
DISABLED_test_localtimeMultithreadedAccess   
)

Test to make sure that multithreaded access SafeCTimeAccess::getLocaltimetime is safe.

◆ TEST_F() [1/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( StopwatchTest  ,
test_goodSequencing   
)

Test good sequencing of method calls.

◆ TEST_F() [2/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( StopwatchTest  ,
test_badSequencing   
)

Test bad sequencing of method calls.

◆ TEST_F() [3/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_basicTimerDelegateAPI   
)

Test to verify basic APIs to activate, start, and ensure that the TimerDelegate triggered the expected number of times.

Check after first task call.

Sleep until the timer completes all iterations.

Ensure timer is inactive post completion of all iterations.

◆ TEST_F() [4/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_stopAndStartTimeDelegate   
)

Test to verify the stop and start API.

Confirm that the timer stops immediately since the timer is not active yet (due to the delay).

Ensure timer is active once start is called.

Sleep until all iterations complete.

◆ TEST_F() [5/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( StopwatchTest  ,
testSlow_elapsed   
)

Test report of elapsed time. This test is timing sensitive.

◆ TEST_F() [6/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_doubleStopTestAVS   
)

Test to verify that stopping an already stopped timer is a no-op.

Wait until all iterations complete.

Stop the timer and confirm that the timer becomes inactive.

Verify that subsequent stop calls changes nothing.

◆ TEST_F() [7/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_singleShot   
)

This test runs a single-shot timer and verifies that the task is called once, at the expected time.

◆ TEST_F() [8/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_multiShot   
)

This test runs a multi-shot ABSOLUTE timer and verifies that the task is called the expected number of times, and that each call occurred at the expected time.

◆ TEST_F() [9/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_verifyTaskWithFixedDuration   
)

Test to verify timer operations with a task of fixed duration. Delay : 100ms. Period : 100ms. Task Time : 40ms. Expectation : 4 task iterations should complete after 440 ms. +-------———+---------------———+--------———+ | Iteration Time | Intermediate timepoint | Action | +================+========================+=================+ | 100 | | Start Task#1 | +-------———+---------------———+--------———+ | | 140 | End of Task#1 | +-------———+---------------———+--------———+ | 200 | | Start of Task#2 | +-------———+---------------———+--------———+ | | 240 | End of Task#2 | +-------———+---------------———+--------———+ | 300 | | Start of Task#3 | +-------———+---------------———+--------———+ | | 340 | End of Task#3 | +-------———+---------------———+--------———+ | 400 | | Start of Task#4 | +-------———+---------------———+--------———+ | | 440 | End of Task#4 | +-------———+---------------———+--------———+

Sleep until timer completes.

Confirm the task counter is as expected.

◆ TEST_F() [10/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_multiShotWithDelay   
)

This test runs a multi-shot ABSOLUTE timer with different initial delay and verifies that the task is called the expected number of times, and that each call occurred at the expected time.

◆ TEST_F() [11/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_forever   
)

This test runs a continuous ABSOLUTE timer, verifies that it remains active through several iterations, verifies that it stops when requested, and verifies that the expected number of calls occurred at their expected times.

◆ TEST_F() [12/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_slowTaskLessThanPeriod   
)

This test runs a slow task with an ABSOLUTE timer, but one which completes in less than a period, and verifies that the slow task does not change the number of calls or their period.

◆ TEST_F() [13/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_slowTaskGreaterThanPeriod   
)

This test runs a slow task with an ABSOLUTE timer which does not complete within a period, and verifies that the slow task results in skipped calls, but on a consistent period.

◆ TEST_F() [14/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_verifyTaskWithVariableDuration   
)

Test to verify timer operations with a task of variable duration. Delay: 100ms. Period: 100ms. Task Times: Iteration 1: 220ms. Iteration 2: 120ms. Iteration 3 (and beyond): 80ms. MaxCount: 9. Expectation of 1000 ms only 6 iterations are run and deactivated. +----------——+------------------——+------------------——+ | Iteration Time | Intermediate timepoint | Action | +================+========================+========================+ | 100 | | Start Task#1 | +----------——+------------------——+------------------——+ | 200 | | Skip | +----------——+------------------——+------------------——+ | 300 | | Skip | +----------——+------------------——+------------------——+ | | 320 | End of Task#1 | +----------——+------------------——+------------------——+ | 400 | | Start of Task#2 | +----------——+------------------——+------------------——+ | 500 | | Skip | +----------——+------------------——+------------------——+ | | 520 | End of Task#2 | +----------——+------------------——+------------------——+ | 600 | | Start of Task#3 | +----------——+------------------——+------------------——+ | | 680 | End of Task#3 | +----------——+------------------——+------------------——+ | 700 | 780 | Start and End of Task#4| +----------——+------------------——+------------------——+ | 800 | 880 | Start and End of Task#5| +----------——+------------------——+------------------——+ | 900 | 980 | Start and End of Task#6| +----------——+------------------——+------------------——+

Wait for all iterations to complete and verify the task counter.

◆ TEST_F() [15/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_slowTaskGreaterThanTwoPeriods   
)

This test runs a slow task with an ABSOLUTE timer which does not complete within multiple periods, and verifies that the slow task results in skipped calls, but on a consistent period.

◆ TEST_F() [16/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_endToStartPeriod   
)

This test runs a slow task with a RELATIVE timer which does not complete within a period, and verifies that the slow task does not result in skipped calls, but calls have a consistent between-task delay.

◆ TEST_F() [17/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_doubleStartMustWaitForPreviousIterations   
)

Test to verify that subsequent start API call must wait for the previous iterations to complete (when using Relative PeriodType).

Sleep for more time than the initial delay, verify the task counter.

Start again after 1 iteration. This start will wait for all iterations from previous start call to complete.

Sleep until all iterations complete.

Expected task count is 4 : 2 iterations in prev start call + 2 in later start call.

◆ TEST_F() [18/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_stopSingleShotBeforeTask   
)

This test verifies that a call to stop() before the task is called results in an inactive timer which does not execute the task.

◆ TEST_F() [19/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_stopSingleShotDuringTask   
)

This test verifies that a call to stop() while a task is executing results in an inactive timer after that task finishes executing.

◆ TEST_F() [20/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerDelegateTest  ,
test_taskWithStop   
)

Test to verify that if the task internally stops the timer, the timer will not run the remaining iterations.

Wait for 1 iteration to complete.

Since the task stopped the timer after the first iteration, expected task counter shall be 1.

◆ TEST_F() [21/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_stopSingleShotAfterTask   
)

This test verifies that a call to stop() after a task has finished executing leaves the timer inactive and unchanged.

◆ TEST_F() [22/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_stopMultiShot   
)

This test verifies that a call to stop() on a multi-shot timer results in an inactive timer with the expected number of calls.

◆ TEST_F() [23/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_startRunningBeforeTask   
)

This test verifies that a call to start() fails on a timer which is active but has not called a task yet, but does not interfere with the previously scheduled task.

◆ TEST_F() [24/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_startRunningDuringTask   
)

This test verifies that a call to start() fails on a timer which is currently executing a task, but does not interfere with that task.

◆ TEST_F() [25/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_startRunningAfterTask   
)

This test verifies that a call to start() succeeds on a timer which was previously used to run a task, but which is inactive at the time the new start() is called.

◆ TEST_F() [26/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
test_deleteBeforeTask   
)

This test verifies that a timer which is deleted while active, but before running its task, does not run the task.

◆ TEST_F() [27/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_deleteDuringTask   
)

This test verifies that a timer which is deleted while running a task completes the task.

◆ TEST_F() [28/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_startRunningAfterStopDuringTask   
)

This test verifies that a call to start() succeeds on a timer which was previously stopped while running a task, but which is inactive at the time the new start() is called.

◆ TEST_F() [29/29]

alexaClientSDK::avsCommon::utils::timing::test::TEST_F ( TimerTest  ,
testTimer_multipleStopsDoesntDeadlock   
)

This test verifies that multiple calls to stop does not result in a deadlock.

◆ testGmtimeHelper()

static void alexaClientSDK::avsCommon::utils::timing::test::testGmtimeHelper ( const std::tm &  expected,
const time_t &  t 
)
static

Helper function to run through the test cases for getGmtime testing.

Parameters
expectedThe std::tm structure string that getGmtime should generate.
tThe time_t to convert.

◆ testIso8601ConversionHelper()

static void alexaClientSDK::avsCommon::utils::timing::test::testIso8601ConversionHelper ( const std::string &  expectedString,
const std::chrono::seconds  sec,
const std::chrono::microseconds  us 
)
static

Helper function to run through the test cases for time to string conversions.

Parameters
expectedStringThe string that convertTimeToUtcIso8601Rfc3339 should generate.
secThe seconds since epoch to convert.
usThe microseconds since epoch to convert.

◆ testLocaltimeHelper()

static void alexaClientSDK::avsCommon::utils::timing::test::testLocaltimeHelper ( const std::tm &  expected,
const time_t &  t 
)
static

Helper function to run through the test cases for getLocaltime testing.

Parameters
expectedThe std::tm structure string that getLocaltime should generate.
tThe time_t to convert.

Variable Documentation

◆ ACCURACY

const auto alexaClientSDK::avsCommon::utils::timing::test::ACCURACY = std::chrono::milliseconds(15)
static

Specifies the expected timing accuracy (timestamps must be within +/- ACCURACY of expected values).

◆ g_resultsLock

std::mutex alexaClientSDK::avsCommon::utils::timing::test::g_resultsLock
static

Mutex to guard access to the results vector.

◆ ITERATIONS

const size_t alexaClientSDK::avsCommon::utils::timing::test::ITERATIONS = 5
static

Number of task iterations to run for multi-shot tests.

◆ LARGE_TIME_VALUE

const time_t alexaClientSDK::avsCommon::utils::timing::test::LARGE_TIME_VALUE = (0x1 << 30) - 1

A bound on the upper time to check.

◆ LONG_DELAY

const auto alexaClientSDK::avsCommon::utils::timing::test::LONG_DELAY = SHORT_DELAY * 2 + ACCURACY
static

Used for cases where the task duration or timer period should be greater than MEDIUM_DELAY, and greater than two SHORT_DELAYs.

◆ MEDIUM_DELAY

const auto alexaClientSDK::avsCommon::utils::timing::test::MEDIUM_DELAY = SHORT_DELAY + ACCURACY
static

Used for cases where the task duration or timer period should be greater than SHORT_DELAY and less than LONG_DELAY.

◆ NO_DELAY

const auto alexaClientSDK::avsCommon::utils::timing::test::NO_DELAY = std::chrono::milliseconds(0)
static

Used for cases where the task should return immediately, without delay.

◆ SHORT_DELAY

const auto alexaClientSDK::avsCommon::utils::timing::test::SHORT_DELAY = ACCURACY * 2
static

Used for cases where the task duration or timer period should be shorter than MEDIUM_DELAY and LONG_DELAY.

◆ TESTABLE_TIME_INCREMENT

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::timing::test::TESTABLE_TIME_INCREMENT {100}
static

◆ TIMEOUT

const auto alexaClientSDK::avsCommon::utils::timing::test::TIMEOUT = std::chrono::seconds(1)
static

Used to limit the amount of time tests will wait for an operation to finish. This timeout will only be hit if a test is failing.

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0