static OCResourceHandle deviceResource = {0};
#ifdef WITH_PRESENCE
static OCPresenceState presenceState = OC_PRESENCE_UNINITIALIZED;
-static PresenceResource presenceResource;
+static PresenceResource presenceResource = {0};
static uint8_t PresenceTimeOutSize = 0;
static uint32_t PresenceTimeOut[] = {50, 75, 85, 95, 100};
#endif
#endif // WITH_PRESENCE
pointer = temp;
}
+ memset(&platformResource, 0, sizeof(platformResource));
+ memset(&deviceResource, 0, sizeof(deviceResource));
SRMDeInitSecureResources();
// Ensure that the last resource to be deleted is the presence resource. This allows for all
// presence notification attributed to their deletion to be processed.
deleteResource((OCResource *) presenceResource.handle);
+ memset(&presenceResource, 0, sizeof(presenceResource));
#endif // WITH_PRESENCE
}
EXPECT_EQ(OC_STACK_OK, OCStop());
}
+TEST(StackStart, StackStartSuccessServerThenClient)
+{
+ itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);
+ EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
+ EXPECT_EQ(OC_STACK_OK, OCStop());
+ EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT));
+ EXPECT_EQ(OC_STACK_OK, OCStop());
+}
+
+TEST(StackStart, StackStartSuccessClientThenServer)
+{
+ 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_OK, OCInit("127.0.0.1", 5683, OC_SERVER));
+ EXPECT_EQ(OC_STACK_OK, OCStop());
+}
+
TEST(StackStart, StackStartSuccessiveInits)
{
itst::DeadmanTimer killSwitch(SHORT_TEST_TIMEOUT);