belle_sdp_tester.c: user BC_ASSERT_EQUAL macro instead of CU_ASSERT_TRUE for session IDs check

parent a27918a8
......@@ -19,8 +19,6 @@
#include "belle-sip/belle-sip.h"
#include "belle_sip_tester.h"
#include "port.h"
#include <stdio.h>
#include "CUnit/Basic.h"
//v=0
......@@ -419,8 +417,8 @@ static void test_simple_session_description(void) {
CU_ASSERT_STRING_EQUAL(belle_sdp_origin_get_address(l_origin),"192.168.0.18")
CU_ASSERT_STRING_EQUAL(belle_sdp_origin_get_address_type(l_origin),"IP4")
CU_ASSERT_STRING_EQUAL(belle_sdp_origin_get_network_type(l_origin),"IN")
CU_ASSERT_TRUE( (unsigned long)belle_sdp_origin_get_session_id(l_origin) == 2463217870UL);
CU_ASSERT_TRUE( (unsigned long)belle_sdp_origin_get_session_version(l_origin) == 2463217870UL);
BC_ASSERT_EQUAL_WITH_TYPE((unsigned long)belle_sdp_origin_get_session_id(l_origin), 2463217870UL, unsigned long, "%lu");
BC_ASSERT_EQUAL_WITH_TYPE((unsigned long)belle_sdp_origin_get_session_version(l_origin), 2463217870UL, unsigned long, "%lu");
CU_ASSERT_PTR_NOT_NULL(belle_sdp_session_description_get_session_name(l_session_description));
CU_ASSERT_STRING_EQUAL(belle_sdp_session_name_get_value(belle_sdp_session_description_get_session_name(l_session_description)),"Talk");
......
......@@ -124,37 +124,24 @@ char * bc_tester_res(const char *name);
#define BC_ASSERT_LOWER(actual, expected) CU_assertImplementation(((actual) <= (expected)), __LINE__, ("CU_ASSERT_LOWER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
/*Add some custom defines with logs in case of fail*/
#define BC_ASSERT_EQUAL_INT(actual, expected) { \
int cactual = (actual), cexpected = (expected); \
#define BC_ASSERT_EQUAL_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_EQUAL(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was %d != %d\n", __FILE__, __LINE__, cactual, cexpected); \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was " type_format " != " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_GREATER_INT(actual, expected) { \
int cactual = (actual), cexpected = (expected); \
#define BC_ASSERT_GREATER_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_GREATER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was %d < %d\n", __FILE__, __LINE__, cactual, cexpected); \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was " type_format " < " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_LOWER_INT(actual, expected) { \
int cactual = (actual), cexpected = (expected); \
#define BC_ASSERT_LOWER_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_LOWER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was %d > %d\n", __FILE__, __LINE__, cactual, cexpected); \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was " type_format " > " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_GREATER_UINT64_T(actual, expected) { \
uint64_t cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_GREATER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was %lu < %lu\n", __FILE__, __LINE__, (long unsigned)cactual, (long unsigned)cexpected); \
} \
}
#define BC_ASSERT_LOWER_UINT64_T(actual, expected) { \
uint64_t cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_LOWER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was %lu > %lu\n", __FILE__, __LINE__, (long unsigned)cactual, (long unsigned)cexpected); \
} \
}
#ifdef __cplusplus
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment