Skip to content

Commit

Permalink
iox-#415 Add additional unit test case for ServiceDescription
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hoinkis <[email protected]>
  • Loading branch information
mossmaurice committed Sep 1, 2021
1 parent 0af7817 commit 9116bf4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 13 additions & 2 deletions iceoryx_posh/test/moduletests/test_capro_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ TEST_F(ServiceDescription_test, ServiceDescriptionSerializationCreatesServiceDes
/// @attention The purpose of the Serialization is not to be an alternative Constructor. It is intended to send/receive
/// the ServiceDescription over communication protocols which transfers strings like the MessageQueue. The testcase is
/// only intended to check the functionality by injecting the valus directly.
TEST_F(ServiceDescription_test, ServiceDescriptionObjectInitialisationWithOutOfBoundaryScopeSetsTheScopeToInvalid)
TEST_F(ServiceDescription_test,
ServiceDescriptionObjectInitialisationWithOutOfBoundaryScopeLeadsToInvalidServiceDescription)
{
ServiceDescription::ClassHash testHash = {14U, 28U, 42U, 56U};
testService = "Service";
Expand All @@ -189,7 +190,7 @@ TEST_F(ServiceDescription_test, ServiceDescriptionObjectInitialisationWithOutOfB
/// the ServiceDescription over communication protocols which transfers strings like the MessageQueue. The testcase is
/// only intended to check the functionality by injecting the valus directly.
TEST_F(ServiceDescription_test,
ServiceDescriptionObjectInitialisationWithOutOfBoundaryInterfaceSourceSetsTheInterfaceSourceToInterfaceEnd)
ServiceDescriptionObjectInitialisationWithOutOfBoundaryInterfaceSourceLeadsToInvalidServiceDescription)
{
ServiceDescription::ClassHash testHash = {17U, 34U, 51U, 68U};
testService = "Service";
Expand All @@ -212,6 +213,16 @@ TEST_F(ServiceDescription_test,
EXPECT_FALSE(serviceDescription1.isValid());
}

TEST_F(ServiceDescription_test, ServiceDescriptionObjectInitialisationWithEmptyStringLeadsToInvalidServiceDescription)
{
std::string emptyString;
iox::cxx::Serialization invalidSerialObj{emptyString};

ServiceDescription serviceDescription1 = ServiceDescription(invalidSerialObj);

EXPECT_FALSE(serviceDescription1.isValid());
}

TEST_F(ServiceDescription_test, ServiceDescriptionDefaultCtorInitializesStringsToInvalidString)
{
ServiceDescription serviceDescription1 = ServiceDescription();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ TEST_F(ServiceRegistry_test, AddingMultipleServiceDescriptionWithSameServicesAnd
EXPECT_THAT(searchResults.size(), Eq(0));
}

TEST_F(ServiceRegistry_test,
ServiceNotFoundAfterAddingAndRemovingToServiceRegistry)
TEST_F(ServiceRegistry_test, ServiceNotFoundAfterAddingAndRemovingToServiceRegistry)
{
iox::capro::ServiceDescription service1("a", "b", "b");
iox::capro::ServiceDescription service2("b", "c", "c");
Expand Down

0 comments on commit 9116bf4

Please sign in to comment.