mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 08:39:20 +00:00
bc_tester_utils.h: update macros
This commit is contained in:
parent
f1b42dc299
commit
a7bacc85d9
3 changed files with 13 additions and 26 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 80eeb75f12ecdcf20bc0e9c5fc90bf91842dcfe9
|
||||
Subproject commit ceb0f52e88084ceafbb43087c6742a04f4543f88
|
||||
|
|
@ -2363,9 +2363,9 @@ static void call_with_file_player(void) {
|
|||
{
|
||||
double similar;
|
||||
const int threshold = 90;
|
||||
BC_ASSERT_EQUAL_INT(ms_audio_diff(hellopath,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL), 0);
|
||||
BC_ASSERT_GREATER_INT(100*similar, threshold);
|
||||
BC_ASSERT_LOWER_INT(100*similar, 100);
|
||||
BC_ASSERT_EQUAL_WITH_TYPE(ms_audio_diff(hellopath,recordpath,&similar,audio_cmp_min_overlap,NULL,NULL), 0, int, "%d");
|
||||
BC_ASSERT_GREATER_WITH_TYPE(100*similar, threshold, int, "%d");
|
||||
BC_ASSERT_LOWER_WITH_TYPE(100*similar, 100, int, "%d");
|
||||
if (threshold < 100*similar && 100*similar < 100) {
|
||||
remove(recordpath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue