Added unit tests for StackStart
authorRavi Nanjundappa <nravi.n@samsung.com>
Tue, 9 Jun 2015 08:59:16 +0000 (14:29 +0530)
committerErich Keane <erich.keane@intel.com>
Wed, 10 Jun 2015 15:46:05 +0000 (15:46 +0000)
Unit test exercise code path to check for zero length
Manufacturer Name in OCSetPlatformInfo()

Change-Id: Ic0003ba1041d14a0de1e55a09f5ff6181bc19a7f
Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1226
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/test/stacktests.cpp

index 590bda3..280fc32 100644 (file)
@@ -218,6 +218,19 @@ TEST(StackStart, SetPlatformInfoWithNoManufacturerName)
     EXPECT_EQ(OC_STACK_OK, OCStop());
 }
 
+TEST(StackStart, SetPlatformInfoWithZeroLengthManufacturerName)
+{
+    itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
+    EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
+
+    OCPlatformInfo info = {};
+    info.platformID = (char *) "platform_id";
+    info.manufacturerName = (char *) "";
+
+    EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSetPlatformInfo(info));
+    EXPECT_EQ(OC_STACK_OK, OCStop());
+}
+
 TEST(StackStart, SetPlatformInfoWithTooLongManufacName)
 {
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);