AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Functions | Variables
SensoryKeywordDetectorTest.cpp File Reference
#include <chrono>
#include <fstream>
#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <gtest/gtest.h>
#include <AVSCommon/SDKInterfaces/KeyWordObserverInterface.h>
#include <AVSCommon/SDKInterfaces/KeyWordDetectorStateObserverInterface.h>
#include <AVSCommon/AVS/AudioInputStream.h>
#include <AVSCommon/Utils/SDS/SharedDataStream.h>
#include "Sensory/SensoryKeywordDetector.h"
Include dependency graph for SensoryKeywordDetectorTest.cpp:

Classes

class  alexaClientSDK::kwd::test::testKeyWordObserver
 A test observer that mocks out the KeyWordObserverInterface#onKeyWordDetected() call. More...
 
struct  alexaClientSDK::kwd::test::testKeyWordObserver::detectionResult
 A struct used for bookkeeping of keyword detections. More...
 
class  alexaClientSDK::kwd::test::testStateObserver
 A test observer that mocks out the KeyWordDetectorStateObserverInterface#onStateChanged() call. More...
 
class  alexaClientSDK::kwd::test::SensoryKeywordTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::kwd
 
 alexaClientSDK::kwd::test
 

Functions

 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_invalidStream)
 Tests that we don't get back a valid detector if an invalid stream is passed in. More...
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_incompatibleEndianness)
 Tests that we don't get back a valid detector if an invalid endianness is passed in. More...
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_getExpectedNumberOfDetectionsInFourAlexasAudioFileForOneObserver)
 Tests that we get back the expected number of keywords for the four_alexa.wav file for one keyword observer. More...
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_getExpectedNumberOfDetectionsInFourAlexasAudioFileForTwoObservers)
 Tests that we get back the expected number of keywords for the four_alexa.wav file for two keyword observers. More...
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_getExpectedNumberOfDetectionsInAlexaStopAlexaJokeAudioFileForOneObserver)
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_getActiveState)
 Tests that the detector state changes to ACTIVE when the detector is initialized properly. More...
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_getStreamClosedState)
 
 alexaClientSDK::kwd::test::TEST_F (SensoryKeywordTest, test_getExpectedNumberOfDetectionsInAlexaStopAlexaJokeAudioFileWithRandomDataAtBeginning)
 
int main (int argc, char **argv)
 

Variables

std::string alexaClientSDK::kwd::test::inputsDirPath
 The path to the inputs folder that should be passed in via command line argument. More...
 
static const std::string alexaClientSDK::kwd::test::MODEL_FILE = "/SensoryModels/spot-alexa-rpi-31000.snsr"
 The name of the Alexa model file for Sensory. More...
 
static const std::string alexaClientSDK::kwd::test::KEYWORD = "alexa"
 The keyword that Sensory emits for the above model file. More...
 
static const std::string alexaClientSDK::kwd::test::FOUR_ALEXAS_AUDIO_FILE = "/four_alexa.wav"
 The name of a test audio file. More...
 
static const std::string alexaClientSDK::kwd::test::ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = "/alexa_stop_alexa_joke.wav"
 The name of a test audio file. More...
 
static const int alexaClientSDK::kwd::test::SAMPLES_PER_MS = 16
 The number of samples per millisecond, assuming a sample rate of 16 kHz. More...
 
static const std::chrono::milliseconds alexaClientSDK::kwd::test::MARGIN = std::chrono::milliseconds(250)
 The margin in milliseconds for testing indices of keyword detections. More...
 
static const AudioInputStream::Index alexaClientSDK::kwd::test::MARGIN_IN_SAMPLES = MARGIN.count() * SAMPLES_PER_MS
 The margin in samples for testing indices of keyword detections. More...
 
static const size_t alexaClientSDK::kwd::test::NUM_ALEXAS_IN_FOUR_ALEXAS_AUDIO_FILE = 4
 The number of "Alexa" keywords in the four_alexa.wav file. More...
 
std::vector< AudioInputStream::Index > alexaClientSDK::kwd::test::BEGIN_INDICES_OF_ALEXAS_IN_FOUR_ALEXAS_AUDIO_FILE = {7520, 39680, 58880, 77120}
 The approximate begin indices of the four "Alexa" keywords in the four_alexa.wav file. More...
 
std::vector< AudioInputStream::Index > alexaClientSDK::kwd::test::END_INDICES_OF_ALEXAS_IN_FOUR_ALEXAS_AUDIO_FILE = {21440, 52800, 72480, 91552}
 The approximate end indices of the four "Alexa" hotwords in the four_alexa.wav file. More...
 
static const size_t alexaClientSDK::kwd::test::NUM_ALEXAS_IN_ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = 2
 The number of "Alexa" keywords in the alexa_stop_alexa_joke.wav file. More...
 
std::vector< AudioInputStream::Index > alexaClientSDK::kwd::test::BEGIN_INDICES_OF_ALEXAS_IN_ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = {8000, 38240}
 The approximate begin indices of the two "Alexa" keywords in the alexa_stop_alexa_joke.wav file. More...
 
std::vector< AudioInputStream::Index > alexaClientSDK::kwd::test::END_INDICES_OF_ALEXAS_IN_ALEXA_STOP_ALEXA_JOKE_AUDIO_FILE = {20960, 51312}
 The approximate end indices of the two "Alexa" keywords in the alexa_stop_alexa_joke.wav file. More...
 
static const avsCommon::utils::AudioFormat::Encoding alexaClientSDK::kwd::test::COMPATIBLE_ENCODING
 The compatible encoding for Sensory. More...
 
static const avsCommon::utils::AudioFormat::Endianness alexaClientSDK::kwd::test::COMPATIBLE_ENDIANNESS
 The compatible endianness for Sensory. More...
 
static const unsigned int alexaClientSDK::kwd::test::COMPATIBLE_SAMPLE_RATE = 16000
 The compatible sample rate for Sensory. More...
 
static const unsigned int alexaClientSDK::kwd::test::COMPATIBLE_SAMPLE_SIZE_IN_BITS = 16
 The compatible bits per sample for Sensory. More...
 
static const unsigned int alexaClientSDK::kwd::test::COMPATIBLE_NUM_CHANNELS = 1
 The compatible number of channels for Sensory. More...
 
static const auto alexaClientSDK::kwd::test::DEFAULT_TIMEOUT = std::chrono::milliseconds(4000)
 Timeout for expected callbacks. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

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