-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23ea19a
commit 208cf56
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/sdks/core/src/cpp/sdk/cpptest/unit/secondscreenTest.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include "unit.h" | ||
|
||
class SecondScreenTest : public ::testing::Test | ||
{ | ||
protected: | ||
JsonEngine *jsonEngine; | ||
Firebolt::Error error = Firebolt::Error::None; | ||
|
||
void SetUp() override | ||
{ | ||
jsonEngine = new JsonEngine(); | ||
} | ||
|
||
void TearDown() override | ||
{ | ||
delete jsonEngine; | ||
} | ||
}; | ||
|
||
TEST_F(SecondScreenTest, FriendlyName) | ||
{ | ||
nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("SecondScreen.friendlyName")); | ||
|
||
auto actualValue = Firebolt::IFireboltAccessor::Instance().SecondScreenInterface().friendlyName(&error); | ||
|
||
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve friendlyName from Secondscreen.friendlyName() method"; | ||
EXPECT_EQ(actualValue, expectedValue); | ||
} | ||
|
||
TEST_F(SecondScreenTest, Device) | ||
{ | ||
nlohmann::json_abi_v3_11_3::json expectedValue = nlohmann::json::parse(jsonEngine->get_value("SecondScreen.device")); | ||
|
||
auto actualValue = Firebolt::IFireboltAccessor::Instance().SecondScreenInterface().device(std::nullopt, &error); | ||
|
||
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve device from Secondscreen.device() method"; | ||
EXPECT_EQ(actualValue, expectedValue); | ||
} | ||
|
||
TEST_F(SecondScreenTest, Protocols) | ||
{ | ||
std::string jsonString = jsonEngine->get_value("SecondScreen.protocols"); | ||
|
||
// Check if the JSON string is empty | ||
ASSERT_FALSE(jsonString.empty()) << "JSON string for Secondscreen.protocols is empty"; | ||
|
||
nlohmann::json expectedValues; | ||
try { | ||
expectedValues = nlohmann::json::parse(jsonString); | ||
} catch (const nlohmann::json::parse_error& e) { | ||
FAIL() << "Failed to parse JSON string: " << e.what(); | ||
} | ||
|
||
Firebolt::Types::BooleanMap actualValues = Firebolt::IFireboltAccessor::Instance().SecondScreenInterface().protocols(&error); | ||
|
||
EXPECT_EQ(error, Firebolt::Error::None) << "Failed to retrieve protocols from Secondscreen.protocols() method"; | ||
EXPECT_EQ(actualValues, expectedValues); | ||
} |