Added unit tests for StackStop
authorRavi Nanjundappa <nravi.n@samsung.com>
Fri, 12 Jun 2015 08:59:57 +0000 (14:29 +0530)
committerErich Keane <erich.keane@intel.com>
Fri, 12 Jun 2015 16:40:02 +0000 (16:40 +0000)
Unit test modified to exercise code paths
* for checking OCStop() without any OCInit()
* to check for repeated OCStop()s after one OCInit()

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

index eb35e6f..aa750a5 100644 (file)
@@ -291,6 +291,12 @@ TEST(StackDiscovery, DISABLED_DoResourceDeviceDiscovery)
 TEST(StackStop, StackStopWithoutInit)
 {
     itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
+    EXPECT_EQ(OC_STACK_ERROR, OCStop());
+}
+
+TEST(StackStop, StackStopRepeated)
+{
+    itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
     EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT));
     EXPECT_EQ(OC_STACK_OK, OCStop());
     EXPECT_EQ(OC_STACK_ERROR, OCStop());