Skip to content

Commit

Permalink
Merge pull request #94 from seank-img/static-api
Browse files Browse the repository at this point in the history
Fix valgrind error in Static API test
  • Loading branch information
David Antliff committed Mar 23, 2016
2 parents af82cfe + fe62a97 commit 7021eab
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions api/tests-static/test_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,6 @@ TEST_F(TestStaticClient, AwaStaticClinet_SetFactoryBootstrapInformation_before_i
AwaStaticClient * client = AwaStaticClient_New();
EXPECT_TRUE(client != NULL);

EXPECT_EQ(AwaError_Success, AwaStaticClient_SetBootstrapServerURI(client, "coap://127.0.0.1:15683/"));
EXPECT_EQ(AwaError_Success, AwaStaticClient_SetEndPointName(client, "imagination1"));
EXPECT_EQ(AwaError_Success, AwaStaticClient_SetCoAPListenAddressPort(client, "0.0.0.0", 5683));

EXPECT_EQ(AwaError_Success, AwaStaticClient_Init(client));

AwaStaticClient_Process(client);

AwaFactoryBootstrapInfo bootstrapinfo = { 0 };

sprintf(bootstrapinfo.SecurityInfo.ServerURI, "coap://127.0.0.1");
Expand All @@ -498,13 +490,24 @@ TEST_F(TestStaticClient, AwaStaticClinet_SetFactoryBootstrapInformation_before_i
sprintf(bootstrapinfo.ServerInfo.Binding, "U");

ASSERT_EQ(AwaError_OperationInvalid, AwaStaticClient_SetFactoryBootstrapInformation(client, &bootstrapinfo));

AwaStaticClient_Free(&client);
EXPECT_TRUE(client == NULL);
}

TEST_F(TestStaticClientWithServer, AwaStaticClient_SetFactoryBootstrapInformation_after_process)
TEST_F(TestStaticClient, AwaStaticClient_SetFactoryBootstrapInformation_while_running)
{
AwaStaticClient * client = AwaStaticClient_New();
EXPECT_TRUE(client != NULL);

EXPECT_EQ(AwaError_Success, AwaStaticClient_SetBootstrapServerURI(client, "coap://127.0.0.1:15683/"));
EXPECT_EQ(AwaError_Success, AwaStaticClient_SetEndPointName(client, "imagination1"));
EXPECT_EQ(AwaError_Success, AwaStaticClient_SetCoAPListenAddressPort(client, "0.0.0.0", 5683));

EXPECT_EQ(AwaError_Success, AwaStaticClient_Init(client));

AwaStaticClient_Process(client);

AwaFactoryBootstrapInfo bootstrapinfo = { 0 };

sprintf(bootstrapinfo.SecurityInfo.ServerURI, "coap://127.0.0.1");
Expand All @@ -520,6 +523,9 @@ TEST_F(TestStaticClientWithServer, AwaStaticClient_SetFactoryBootstrapInformati
sprintf(bootstrapinfo.ServerInfo.Binding, "U");

ASSERT_EQ(AwaError_OperationInvalid, AwaStaticClient_SetFactoryBootstrapInformation(client, &bootstrapinfo));

AwaStaticClient_Free(&client);
EXPECT_TRUE(client == NULL);
}

TEST_F(TestStaticClient, AwaStaticClient_Bootstrap_Test)
Expand Down

0 comments on commit 7021eab

Please sign in to comment.