Skip to content

Commit

Permalink
test(manage): VoiceGuidance events unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKasar committed Oct 17, 2024
1 parent 9466001 commit 45ef90a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/sdks/manage/src/cpp/sdk/cpptest/unit/voiceGuidanceTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "unit.h"

class VoiceGuidanceTest : public ::testing::Test
{
protected:
Firebolt::Error error = Firebolt::Error::None;
};

struct EnabledSettings : public Firebolt::VoiceGuidance::IVoiceGuidance::IOnEnabledChangedNotification {
void onEnabledChanged(const bool) override;
};

void EnabledSettings::onEnabledChanged(const bool isEnabled) {
std::cout << "onEnabledChanged event fired with isEnabled: " << isEnabled;
}

TEST_F(VoiceGuidanceTest, subscribeOnEnabledChanged) {
EnabledSettings enabledSettings;
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().subscribe(enabledSettings, &error);
EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to EnabledSettings";
}

TEST_F(VoiceGuidanceTest, unsubscribeOnEnabledChanged) {
EnabledSettings enabledSettings;
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().unsubscribe(enabledSettings, &error);
EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to EnabledSettings";
}

struct SpeedSettings : public Firebolt::VoiceGuidance::IVoiceGuidance::IOnSpeedChangedNotification {
void onSpeedChanged(const float) override;
};

void SpeedSettings::onSpeedChanged(const float speed) {
std::cout << "onSpeedChanged event fired with speed: " << speed;
}

TEST_F(VoiceGuidanceTest, subscribeOnSpeedChanged) {
SpeedSettings speedSettings;
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().subscribe(speedSettings, &error);
EXPECT_EQ(error, Firebolt::Error::None) << "Error in subscribing to SpeedSettings";
}

TEST_F(VoiceGuidanceTest, unsubscribeOnSpeedChanged) {
SpeedSettings speedSettings;
Firebolt::IFireboltAccessor::Instance().VoiceGuidanceInterface().unsubscribe(speedSettings, &error);
EXPECT_EQ(error, Firebolt::Error::None) << "Error in unsubscribing to SpeedSettings";
}

0 comments on commit 45ef90a

Please sign in to comment.