#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 #include #endif bool InitializeAppControl(sdv::app::CAppControl* appControl, const std::string& configFileName) { auto bResult = appControl->AddModuleSearchDir("../../bin"); bResult &= appControl->Startup(""); appControl->SetConfigMode(); bResult &= appControl->AddConfigSearchDir("../../tests/bin/config"); if (!configFileName.empty()) { bResult &= appControl->LoadConfig(configFileName.c_str()) == sdv::core::EConfigProcessResult::successful; } return bResult; } // // Test RX Signals // TEST(VSSComponentTest, RXBoolean) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalBoolean); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeboolean.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Boolean_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const bool expected = true; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeBoolean()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXFloat) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalFloat); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypefloat.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Float_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const float expected = 3.14f; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeFloat()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXDouble) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalDouble); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypedouble.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Double_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const double expected = 123456.123456; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeDouble()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXLongDouble) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalLongDouble); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypelongdouble.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.LongDouble_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const double expected = 654321.123456; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeLongDouble()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXInt8) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalInt8); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeint8.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int8_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const char expected = 'c'; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeInt8()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXInt16) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalInt16); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeint16.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int16_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const int16_t expected = 32766; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeInt16()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXInt32) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalInt32); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeint32.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int32_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const int32_t expected = 2147483646; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeInt32()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXInt64) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalInt64); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeint64.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int64_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const int64_t expected = 9223372036854775806; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeInt64()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalLong); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypelong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Long_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const long expected = 2147483646; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeLong()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXLongLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalLongLong); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypelonglong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.LongLong_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const long long expected = 9223372036854775806LL; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeLongLong()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXShort) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalShort); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeshort.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Short_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const short expected = 127; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeShort()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXString) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalString); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypestring.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const std::string expected = "some text written"; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeString()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXWString) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalWString); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypewstring.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.WString_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const std::wstring expected = L"some text written"; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeWString()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUint8) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUint8); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeuint8.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint8_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const uint8_t expected = 254; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUint8()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUint16) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUint16); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeuint16.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint16_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const uint16_t expected = 65534; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUint16()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUint32) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUint32); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeuint32.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint32_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const uint32_t expected = 4294967294U; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUint32()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUint64) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUint64); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeuint64.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint64_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const uint64_t expected = 18446744073709551614ULL; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUint64()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUnsignedLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUnsignedLong); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeunsignedlong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.UnsignedLong_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const unsigned long expected = 4294967295; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUnsignedLong()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUnsignedlonglong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUnsignedLongLong); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeunsignedlonglong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.UnsignedLongLong_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const unsigned long long expected = 18446744073709551613ULL; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUnsignedLongLong()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXUnsignedShort) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalUnsignedShort); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeunsignedshort.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.UnsignedShort_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const unsigned short expected = 255; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeUnsignedShort()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXChar) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalChar); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypechar.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Char_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const char expected = 'C'; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeChar()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXChar16) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalChar16); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypechar16.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Char16_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const char32_t expected = u'\uFFFF'; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeChar16()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXChar32) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalChar32); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypechar32.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Char32_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const char32_t expected = U'\U0010FFFF'; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeChar32()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXWChar) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalWChar); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypewchar.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.WChar_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const wchar_t expected = L'\xFFEE'; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeWChar()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXNative) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalNative); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypenative.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Native_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const size_t expected = 290; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeNative()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXU8String) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalU8String); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeu8string.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.U8String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const sdv::u8string expected = "some text written"; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeU8String()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXU16String) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalU16String); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeu16string.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.U16String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const sdv::u16string expected = u"some text written"; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeU16String()); signalRx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, RXU32String) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); sdv::core::CDispatchService dispatch; sdv::core::CSignal signalRx; signalRx = dispatch.RegisterRxSignal(testcase4::dsSignalU32String); ASSERT_TRUE(signalRx); bResult &= appControl.LoadConfig("rxtypeu32string.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.U32String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); const sdv::u32string expected = U"some text written"; signalRx.Write(expected); std::this_thread::sleep_for(std::chrono::milliseconds(3)); ASSERT_EQ(expected, basicService->GetSignalTypeU32String()); signalRx.Reset(); appControl.Shutdown(); } //// //// Test TX Signals //// TEST(VSSComponentTest, TXBoolean) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const bool initVal = false; const bool expected = !initVal; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalBoolean_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeboolean.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Boolean_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeBoolean(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXFloat) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const float initVal = 3.14f; const float expected = initVal * 3.14f; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalFloat_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypefloat.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Float_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeFloat(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXDouble) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const double initVal = 123456.123456; const double expected = initVal / 3; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalDouble_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypedouble.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Double_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeDouble(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXLongDouble) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const long double initVal = 654321.123456; const long double expected = initVal / 3; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalLongDouble_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypelongdouble.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.LongDouble_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeLongDouble(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXInt8) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); char initVal = 'c'; char expected = 'x'; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalInt8_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeint8.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int8_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeInt8(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXInt16) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const int16_t initVal = 32766; const int16_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalInt16_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeint16.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int16_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeInt16(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXInt32) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const int32_t initVal = 2147483646; const int32_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalInt32_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeint32.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int32_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeInt32(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXInt64) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const int64_t initVal = 9223372036854775806; const int64_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalInt64_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeint64.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Int64_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeInt64(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const long initVal = 2147483646; const long expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalLong_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypelong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Long_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeLong(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXLongLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const long long initVal = 9223372036854775806LL; const long long expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalLongLong_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypelonglong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.LongLong_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeLongLong(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXShort) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const int16_t initVal = 127; const int16_t expected = initVal - 100; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalShort_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeshort.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Short_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeShort(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXString) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const sdv::string initVal = "some initialization string"; const sdv::string expected = "changed string"; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalString_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypestring.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeString(expected); std::cout << "Init: " << initVal << " -> " << signalTx.Read().get() << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXWString) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const sdv::wstring initVal = L"some initialization string"; const sdv::wstring expected = L"changed string"; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalWString_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypewstring.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.WString_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeWString(expected); std::wcout << L"Init: " << initVal << L" -> " << signalTx.Read().get() << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUint8) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const uint8_t initVal = 255; const uint8_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUint8_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeuint8.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint8_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUint8(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUint16) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const uint16_t initVal = 65534; const uint16_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUint16_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeuint16.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint16_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUint16(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUint32) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const uint32_t initVal = 4294967294U; const uint32_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUint32_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeuint32.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint32_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUint32(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUint64) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const uint64_t initVal = 18446744073709551614ULL; const uint64_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUint64_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeuint64.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Uint64_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUint64(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUnsignedLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const unsigned long initVal = 4294967295; const unsigned long expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUnsignedLong_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeunsignedlong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.UnsignedLong_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUnsignedLong(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUnsignedLongLong) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const unsigned long long initVal = 18446744073709551613ULL; const unsigned long long expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUnsignedLongLong_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeunsignedlonglong.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.UnsignedLongLong_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUnsignedLongLong(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXUnsignedShort) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const unsigned short initVal = 255; const unsigned short expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalUnsignedShort_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeunsignedshort.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.UnsignedShort_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeUnsignedShort(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXChar) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const char initVal = 'C'; const char expected = 'X'; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalChar_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypechar.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Char_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeChar(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXChar16) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const char16_t initVal = u'\uFFFF'; const char16_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalChar16_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypechar16.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Char16_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeChar16(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXChar32) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const char32_t initVal = U'\U0010FFFF'; const char32_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalChar32_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypechar32.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Char32_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeChar32(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXWChar) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const wchar_t initVal = L'\xFFEE'; const wchar_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalWChar_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypewchar.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.WChar_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeWChar(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXNative) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const size_t initVal = 314; const size_t expected = initVal / 2; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalNative_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypenative.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.Native_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeNative(expected); std::cout << "Init: " << std::to_string(initVal) << " -> " << std::to_string(signalTx.Read().get()) << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXU8String) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const sdv::u8string initVal = "some initialize string"; const sdv::u8string expected = "changed string"; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalU8String_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeu8string.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.U8String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeU8String(expected); std::cout << "Init: " << initVal << " -> " << signalTx.Read().get() << std::endl; ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXU16String) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const sdv::u16string initVal = u"some initialize string"; const sdv::u16string expected = u"changed string"; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalU16String_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeu16string.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.U16String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeU16String(expected); ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } TEST(VSSComponentTest, TXU32String) { sdv::app::CAppControl appControl; auto bResult = InitializeAppControl(&appControl, "data_dispatch_service.toml"); ASSERT_EQ(bResult, true); const sdv::u32string initVal = U"some initialize string"; const sdv::u32string expected = U"changed string"; sdv::core::CDispatchService dispatch; sdv::core::CSignal signalTx; signalTx = dispatch.RegisterTxSignal(testcase4::dsSignalU32String_1, initVal); ASSERT_TRUE(signalTx); bResult &= appControl.LoadConfig("txtypeu32string.toml") == sdv::core::EConfigProcessResult::successful; ASSERT_EQ(bResult, true); auto basicService = sdv::core::GetObject("Vehicle.Chassis.Vehicle.U32String_Service").GetInterface(); ASSERT_TRUE(basicService); appControl.SetRunningMode(); basicService->SetSignalTypeU32String(expected); ASSERT_EQ(expected, signalTx.Read().get()); signalTx.Reset(); appControl.Shutdown(); } extern "C" int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); return result; } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif