Skip to content

Commit

Permalink
Fixed newer compiler warnings and recent mama price test leaks
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Quinn <fquinn@cascadium.io>
  • Loading branch information
fquinner committed Jun 13, 2018
1 parent 517d5d9 commit 8e7f91d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 27 deletions.
2 changes: 1 addition & 1 deletion mama/c_cpp/src/gunittest/c/iotest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ TEST_F (MamaIoTestC, getDescriptor)
mamaIo io = NULL;
mamaQueue queue = NULL;
uint32_t descriptor = 1;
uint32_t testDescriptor = NULL;
uint32_t testDescriptor = 0;
mamaIoType ioType = MAMA_IO_READ;

ASSERT_EQ (MAMA_STATUS_OK,
Expand Down
1 change: 0 additions & 1 deletion mama/c_cpp/src/gunittest/c/mamaprice/pricegeneraltests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,6 @@ TEST_F (MamaPriceTestC, testSetFromStringMamaPriceInvalidPrice)

mamaPrice price = NULL;
const char* value = "MY PRICE";
double val;

ASSERT_EQ ( MAMA_STATUS_OK, mamaPrice_create(&price) );

Expand Down
6 changes: 3 additions & 3 deletions mama/c_cpp/src/gunittest/c/middleware/middlewareIoTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void MAMACALLTYPE onIo(mamaIo io, mamaIoType ioType, void* closure)
TEST_F (MiddlewareIoTests, create)
{
ioBridge io = NULL;
uint32_t descriptor = NULL;
uint32_t descriptor = 0;
mamaIoType ioType = MAMA_IO_READ;
mamaIo parent = NULL;
void* closure = NULL;
Expand Down Expand Up @@ -184,7 +184,7 @@ TEST_F (MiddlewareIoTests, getDescriptor)
mamaIo parent = NULL;
void* closure = NULL;
mamaQueue queue = NULL;
uint32_t result = NULL;
uint32_t result = 0;

ASSERT_EQ(MAMA_STATUS_OK,
mamaQueue_create(&queue, mBridge));
Expand Down Expand Up @@ -226,7 +226,7 @@ TEST_F (MiddlewareIoTests, getDescriptorInvalidResult)
TEST_F (MiddlewareIoTests, createDestroy)
{
ioBridge io = NULL;
uint32_t descriptor = NULL;
uint32_t descriptor = 0;
mamaIoType ioType = MAMA_IO_READ;
mamaIo parent = NULL;
void* closure = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ TEST_F (MiddlewareSubscriptionTests, destroyInvalid)

TEST_F (MiddlewareSubscriptionTests, isValid)
{
int res = NULL;
int res = 0;
ASSERT_EQ(MAMA_STATUS_OK,
mamaSubscription_create(parent, queue, &callbacks, source, sourceName, closure));

Expand All @@ -375,7 +375,7 @@ TEST_F (MiddlewareSubscriptionTests, isValid)

TEST_F (MiddlewareSubscriptionTests, isValidInvalid)
{
int res = NULL;
int res = 0;

res = mBridge->bridgeMamaSubscriptionIsValid(NULL);

Expand All @@ -385,7 +385,7 @@ TEST_F (MiddlewareSubscriptionTests, isValidInvalid)

TEST_F (MiddlewareSubscriptionTests, hasWildcards)
{
int res = NULL;
int res = 0;

res = mBridge->bridgeMamaSubscriptionHasWildcards(NULL);

Expand Down
6 changes: 3 additions & 3 deletions mama/c_cpp/src/gunittest/c/payload/payloadgeneraltests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ TEST_F(PayloadGeneralTests, IterHasNextValid)
{
msgPayload testPayload = NULL;
msgPayloadIter testIter = NULL;
mama_bool_t output = NULL;
mama_bool_t output = 0;

result = aBridge->msgPayloadCreate(&testPayload);
EXPECT_EQ (MAMA_STATUS_OK, result);
Expand All @@ -1877,7 +1877,7 @@ TEST_F(PayloadGeneralTests, IterHasNextValid)
TEST_F(PayloadGeneralTests, IterHasNextInValidIter)
{
msgPayload testPayload = NULL;
mama_bool_t output = NULL;
mama_bool_t output = 0;

result = aBridge->msgPayloadCreate(&testPayload);
EXPECT_EQ (MAMA_STATUS_OK, result);
Expand All @@ -1896,7 +1896,7 @@ TEST_F(PayloadGeneralTests, IterHasNextInValidPayload)
{
msgPayload testPayload = NULL;
msgPayloadIter testIter = NULL;
mama_bool_t output = NULL;
mama_bool_t output = 0;

result = aBridge->msgPayloadCreate(&testPayload);
EXPECT_EQ (MAMA_STATUS_OK, result);
Expand Down
2 changes: 1 addition & 1 deletion mama/c_cpp/src/gunittest/c/transporttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ TEST_F (MamaTransportTestC, InvokeQuality)
const char* tportName = getTransport();
mamaTransport tport = NULL;
int invoke = 1;
int testInvoke = NULL;
int testInvoke = 0;

ASSERT_EQ (MAMA_STATUS_OK,
mamaTransport_allocate (&tport));
Expand Down
24 changes: 9 additions & 15 deletions mama/c_cpp/src/gunittest/cpp/MamaPriceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ MamaPriceTest::~MamaPriceTest(void)
void MamaPriceTest::SetUp(void)
{
// Create a new mama price
//ASSERT_EQ(mamaPrice_create(&m_price), MAMA_STATUS_OK);
m_price = new MamaPrice();
m_priceDp = new MamaPrice();

// Set the value of the price
//ASSERT_EQ(mamaPrice_setValue(m_price, 4000000000), MAMA_STATUS_OK);
m_price->setValue(4000000000);
m_priceDp->setValue(1.12345678901234567890);
}
Expand All @@ -74,11 +72,15 @@ void MamaPriceTest::TearDown(void)
// Delete the price
if(m_price != NULL)
{
//ASSERT_EQ(mamaPrice_destroy(m_price), MAMA_STATUS_OK);
delete m_price;
m_price = NULL;
delete m_price;
m_price = NULL;
}
// Delete the extended precision price
if(m_priceDp != NULL)
{
delete m_priceDp;
m_priceDp = NULL;
}
ASSERT_TRUE(m_price == NULL);
}

/* ************************************************************************* */
Expand Down Expand Up @@ -533,12 +535,9 @@ TEST_F(MamaPriceTest, SetPrecisionDiv512)

TEST_F(MamaPriceTest, SetFromString)
{
MamaPrice* m_price;
const char* value = "123.45";
double doubleValue = 0.0;

m_price = new MamaPrice();

m_price->setFromString(value);

doubleValue = m_price->getValue();
Expand All @@ -548,12 +547,9 @@ TEST_F(MamaPriceTest, SetFromString)

TEST_F(MamaPriceTest, SetFromStringLargeValue)
{
MamaPrice* m_price;
const char* value = "123.456789012345";
double doubleValue = 0.0;

m_price = new MamaPrice();

m_price->setFromString(value);

doubleValue = m_price->getValue();
Expand All @@ -563,12 +559,10 @@ TEST_F(MamaPriceTest, SetFromStringLargeValue)

TEST_F(MamaPriceTest, SetFromStringInvalidPrice)
{
MamaPrice* m_price;
const char* value = "MY PRICE";
double doubleValue = 0.0;

m_price = new MamaPrice();

m_price->clear();
m_price->setFromString(value);

doubleValue = m_price->getValue();
Expand Down

0 comments on commit 8e7f91d

Please sign in to comment.