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

Classes

class  ExampleFunctor
 
class  ExecutorTest
 
class  SimpleObject
 
struct  SlowDestructor
 Used by futureWaitsForTaskCleanup delay and timestamp the time of lambda parameter destruction. More...
 

Functions

 TEST_F (ExecutorTest, testTimer_submitStdFunctionAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitStdBindAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitLambdaAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionPointerAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctorAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithPrimitiveReturnTypeNoArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithObjectReturnTypeNoArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithNoReturnTypePrimitiveArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithNoReturnTypeObjectArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithPrimitiveReturnTypeObjectArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithObjectReturnTypePrimitiveArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithPrimitiveReturnTypePrimitiveArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitFunctionWithObjectReturnTypeObjectArgsAndVerifyExecution)
 
 TEST_F (ExecutorTest, testTimer_submitToFront)
 
 TEST_F (ExecutorTest, testTimer_executionOrderEqualToSubmitOrder)
 
 TEST_F (ExecutorTest, testTimer_futureWaitsForTaskCleanup)
 This test verifies that the executor waits to fulfill its promise until after the task is cleaned up. More...
 
 TEST_F (ExecutorTest, testTimer_shutdown)
 This test verifies that the shutdown function completes the current task and does not accept new tasks. More...
 
 TEST_F (ExecutorTest, testTimer_pushAfterExecutordownFail)
 Test that calling submit after shutdown will fail the job. More...
 
 TEST_F (ExecutorTest, testTimer_shutdownCancelJob)
 Test that shutdown cancel jobs in the queue. More...
 
 TEST_F (ExecutorTest, test_forwardPromise)
 
 TEST_F (ExecutorTest, test_taskException)
 
void exampleFunction ()
 Simple example function to be referenced in Executor related tests. More...
 
void exampleFunctionParams (int param)
 Simple example function which takes a parameter to be referenced in Executor related tests. More...
 
 TEST (TaskThreadTest, test_waitForNothing)
 Test that wait will return if no job has ever started. More...
 
 TEST (TaskThreadTest, test_startFailsDueToEmptyFunction)
 Test that start will fail if function is empty. More...
 
 TEST (TaskThreadTest, test_simpleJob)
 Test that start will trigger the provided job and thread will exit once the job is done and return false. More...
 
 TEST (TaskThreadTest, test_sequenceJobs)
 
 TEST (TaskThreadTest, test_startNewJob)
 
 TEST (TaskThreadTest, testTimer_startFailDueTooManyThreads)
 Test that start will fail if called multiple times while waiting for a job to start. More...
 
 TEST (TaskThreadTest, DISABLED_test_moniker)
 Test that threads related to this task thread will always have the same moniker. More...
 
 TEST (TaskThreadTest, test_monikerDifferentObjects)
 Test that threads from different TaskThreads will have different monikers. More...
 
 TEST (TaskThreadTest, test_obtainAndreleaseWorker)
 Test that wait will return if no job has ever started. More...
 
 TEST (TaskThreadTest, test_releaseMultipleHonorsMax)
 Test that wait will return if no job has ever started. More...
 
 TEST (TaskThreadTest, test_runWorkSeveralTimes)
 
 TEST (TaskThreadTest, test_runWorkRepeatedlyAndFinish)
 
 TEST (TaskThreadTest, test_runWorkRepeatedlyAndCancelFromWorkerHappensImmediately)
 
 TEST (TaskThreadTest, test_runWorkRepeatedlyAndCancel)
 
 TEST (TaskThreadTest, test_runWorkRepeatedlyWithCancelAndInterruptByDestruction)
 

Variables

static const int VALUE = 1234
 Simple integer value to be reused in tests. More...
 
static const std::chrono::milliseconds SHORT_TIMEOUT_MS = std::chrono::milliseconds(100)
 Timeout to use for waiting on calls within tests. More...
 
static auto TASK = [](int arg) { return arg; }
 A simple task which takes an integer argument and returns the argument when executed. More...
 
const std::chrono::milliseconds MY_WAIT_TIMEOUT {100}
 Timeout used while waiting for synchronization events. More...
 

Function Documentation

◆ exampleFunction()

void alexaClientSDK::avsCommon::utils::threading::test::exampleFunction ( )

Simple example function to be referenced in Executor related tests.

◆ exampleFunctionParams()

void alexaClientSDK::avsCommon::utils::threading::test::exampleFunctionParams ( int  param)

Simple example function which takes a parameter to be referenced in Executor related tests.

◆ TEST() [1/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_obtainAndreleaseWorker   
)

Test that wait will return if no job has ever started.

◆ TEST() [2/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_runWorkSeveralTimes   
)

◆ TEST() [3/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_waitForNothing   
)

Test that wait will return if no job has ever started.

◆ TEST() [4/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_startFailsDueToEmptyFunction   
)

Test that start will fail if function is empty.

◆ TEST() [5/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_simpleJob   
)

Test that start will trigger the provided job and thread will exit once the job is done and return false.

◆ TEST() [6/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_releaseMultipleHonorsMax   
)

Test that wait will return if no job has ever started.

◆ TEST() [7/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_runWorkRepeatedlyAndFinish   
)

◆ TEST() [8/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_sequenceJobs   
)

Test that start will trigger the provided job and it will execute the job multiple times until the job returns false.

◆ TEST() [9/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_runWorkRepeatedlyAndCancelFromWorkerHappensImmediately   
)

◆ TEST() [10/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_startNewJob   
)

Test that start will replace the existing next function.

  • First function increments the counter, while the second will decrement until it reaches 0.

◆ TEST() [11/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_runWorkRepeatedlyAndCancel   
)

◆ TEST() [12/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_runWorkRepeatedlyWithCancelAndInterruptByDestruction   
)

◆ TEST() [13/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
testTimer_startFailDueTooManyThreads   
)

Test that start will fail if called multiple times while waiting for a job to start.

◆ TEST() [14/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
DISABLED_test_moniker   
)

Test that threads related to this task thread will always have the same moniker.

◆ TEST() [15/15]

alexaClientSDK::avsCommon::utils::threading::test::TEST ( TaskThreadTest  ,
test_monikerDifferentObjects   
)

Test that threads from different TaskThreads will have different monikers.

◆ TEST_F() [1/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitStdFunctionAndVerifyExecution   
)

◆ TEST_F() [2/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitStdBindAndVerifyExecution   
)

◆ TEST_F() [3/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitLambdaAndVerifyExecution   
)

◆ TEST_F() [4/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionPointerAndVerifyExecution   
)

◆ TEST_F() [5/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctorAndVerifyExecution   
)

◆ TEST_F() [6/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithPrimitiveReturnTypeNoArgsAndVerifyExecution   
)

◆ TEST_F() [7/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithObjectReturnTypeNoArgsAndVerifyExecution   
)

◆ TEST_F() [8/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithNoReturnTypePrimitiveArgsAndVerifyExecution   
)

◆ TEST_F() [9/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithNoReturnTypeObjectArgsAndVerifyExecution   
)

◆ TEST_F() [10/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithPrimitiveReturnTypeObjectArgsAndVerifyExecution   
)

◆ TEST_F() [11/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithObjectReturnTypePrimitiveArgsAndVerifyExecution   
)

◆ TEST_F() [12/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithPrimitiveReturnTypePrimitiveArgsAndVerifyExecution   
)

◆ TEST_F() [13/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitFunctionWithObjectReturnTypeObjectArgsAndVerifyExecution   
)

◆ TEST_F() [14/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_submitToFront   
)

◆ TEST_F() [15/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_executionOrderEqualToSubmitOrder   
)

◆ TEST_F() [16/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_futureWaitsForTaskCleanup   
)

This test verifies that the executor waits to fulfill its promise until after the task is cleaned up.

◆ TEST_F() [17/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_shutdown   
)

This test verifies that the shutdown function completes the current task and does not accept new tasks.

◆ TEST_F() [18/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_pushAfterExecutordownFail   
)

Test that calling submit after shutdown will fail the job.

◆ TEST_F() [19/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
testTimer_shutdownCancelJob   
)

Test that shutdown cancel jobs in the queue.

◆ TEST_F() [20/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
test_forwardPromise   
)

◆ TEST_F() [21/21]

alexaClientSDK::avsCommon::utils::threading::test::TEST_F ( ExecutorTest  ,
test_taskException   
)

Variable Documentation

◆ MY_WAIT_TIMEOUT

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::threading::test::MY_WAIT_TIMEOUT {100}

Timeout used while waiting for synchronization events.

◆ SHORT_TIMEOUT_MS

const std::chrono::milliseconds alexaClientSDK::avsCommon::utils::threading::test::SHORT_TIMEOUT_MS = std::chrono::milliseconds(100)
static

Timeout to use for waiting on calls within tests.

◆ TASK

auto alexaClientSDK::avsCommon::utils::threading::test::TASK = [](int arg) { return arg; }
static

A simple task which takes an integer argument and returns the argument when executed.

◆ VALUE

const int alexaClientSDK::avsCommon::utils::threading::test::VALUE = 1234
static

Simple integer value to be reused in tests.

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