From: jaesick.shin Date: Wed, 31 Aug 2016 08:00:36 +0000 (+0900) Subject: Add unittest for NSUnregistertopic Case. X-Git-Tag: 1.2.0+RC3~204^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ec5a7fa999e11a8dc2b3f8fadd58b8375edf43a;p=platform%2Fupstream%2Fiotivity.git Add unittest for NSUnregistertopic Case. check the Unregistertopic case. Change-Id: I0f182ce9b9e8b60b708740a35ea0880f1c537344 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/11207 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi Tested-by: Uze Choi --- diff --git a/service/notification/unittest/NSProviderTest.cpp b/service/notification/unittest/NSProviderTest.cpp index 399c200..24e50f3 100755 --- a/service/notification/unittest/NSProviderTest.cpp +++ b/service/notification/unittest/NSProviderTest.cpp @@ -363,6 +363,41 @@ TEST_F(NotificationProviderTest, ExpectEqualAddedTopicsAndRegisteredTopics) EXPECT_EQ(isSame, true); } +TEST_F(NotificationProviderTest, ExpectEqualUnregisteredTopicsAndRegisteredTopics) +{ + std::string str("TEST1"); + std::string str2("TEST2"); + NSProviderRegisterTopic(str.c_str()); + NSProviderRegisterTopic(str2.c_str()); + NSProviderUnregisterTopic(str2.c_str()); + + std::unique_lock< std::mutex > lock{ mutexForCondition }; + responseCon.wait_for(lock, std::chrono::milliseconds(1000)); + + bool isSame = true; + NSTopicLL * topics = NSProviderGetTopics(); + + if(!topics) + { + printf("topic is NULL\n"); + isSame = false; + } + else + { + NSTopicLL * iter = topics; + std::string compStr(iter->topicName); + + printf("str = %s, compStr = %s\n", str.c_str(), iter->topicName); + + if(str.compare(compStr) == 0) + { + isSame = true; + } + } + + EXPECT_EQ(isSame, true); +} + TEST_F(NotificationProviderTest, CancelObserves) { bool ret = g_consumerSimul.cancelObserves();