tests: eina - replaced deprecated fail_* functions

The fail* APIs have been deprecated since check version 0.9.9 a decade ago. Solved warnings about having too many arguments for the supplied format string.
This commit is contained in:
Dmitri Chudinov 2023-08-07 22:01:59 +05:00
parent 08e73fe2eb
commit 073b70bf42
50 changed files with 3421 additions and 3419 deletions

View File

@ -51,80 +51,80 @@ EFL_START_TEST(eina_unicode_utf8)
/* Valid utf-8 cases */
/* First possible sequence of a certain length */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\x00", &ind) != 0x00) ||
ck_assert((eina_unicode_utf8_get_next("\x00", &ind) != 0x00) ||
(ind != 0));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\x01", &ind) != 0x01) ||
ck_assert((eina_unicode_utf8_get_next("\x01", &ind) != 0x01) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xC2\x80", &ind) != 0x80) ||
ck_assert((eina_unicode_utf8_get_next("\xC2\x80", &ind) != 0x80) ||
(ind != 2));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xE0\xA0\x80", &ind) != 0x800) ||
ck_assert((eina_unicode_utf8_get_next("\xE0\xA0\x80", &ind) != 0x800) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF0\x90\x80\x80", &ind) != 0x10000) ||
ck_assert((eina_unicode_utf8_get_next("\xF0\x90\x80\x80", &ind) != 0x10000) ||
(ind != 4));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF8\x88\x80\x80\x80", &ind) != 0x200000) || (ind != 5));
ck_assert((eina_unicode_utf8_get_next("\xF8\x88\x80\x80\x80", &ind) != 0x200000) || (ind != 5));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFC\x84\x80\x80\x80\x80", &ind) != 0x4000000) || (ind != 6));
ck_assert((eina_unicode_utf8_get_next("\xFC\x84\x80\x80\x80\x80", &ind) != 0x4000000) || (ind != 6));
/* Last possible sequence of a certain length */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\x7F", &ind) != 0x7F) ||
ck_assert((eina_unicode_utf8_get_next("\x7F", &ind) != 0x7F) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xDF\xBF", &ind) != 0x7FF) ||
ck_assert((eina_unicode_utf8_get_next("\xDF\xBF", &ind) != 0x7FF) ||
(ind != 2));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xEF\xBF\xBF", &ind) != 0xFFFF) ||
ck_assert((eina_unicode_utf8_get_next("\xEF\xBF\xBF", &ind) != 0xFFFF) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF7\xBF\xBF\xBF", &ind) != 0x1FFFFF) ||
ck_assert((eina_unicode_utf8_get_next("\xF7\xBF\xBF\xBF", &ind) != 0x1FFFFF) ||
(ind != 4));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFB\xBF\xBF\xBF\xBF", &ind) != 0x3FFFFFF) || (ind != 5));
ck_assert((eina_unicode_utf8_get_next("\xFB\xBF\xBF\xBF\xBF", &ind) != 0x3FFFFFF) || (ind != 5));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFD\xBF\xBF\xBF\xBF\xBF", &ind) != 0x7FFFFFFF) || (ind != 6));
ck_assert((eina_unicode_utf8_get_next("\xFD\xBF\xBF\xBF\xBF\xBF", &ind) != 0x7FFFFFFF) || (ind != 6));
/* Other boundary conditions */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xED\x9F\xBF", &ind) != 0xD7FF) ||
ck_assert((eina_unicode_utf8_get_next("\xED\x9F\xBF", &ind) != 0xD7FF) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xEE\x80\x80", &ind) != 0xE000) ||
ck_assert((eina_unicode_utf8_get_next("\xEE\x80\x80", &ind) != 0xE000) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xEF\xBF\xBD", &ind) != 0xFFFD) ||
ck_assert((eina_unicode_utf8_get_next("\xEF\xBF\xBD", &ind) != 0xFFFD) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF4\x8F\xBF\xBF", &ind) != 0x10FFFF) ||
ck_assert((eina_unicode_utf8_get_next("\xF4\x8F\xBF\xBF", &ind) != 0x10FFFF) ||
(ind != 4));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF4\x90\x80\x80", &ind) != 0x110000) ||
ck_assert((eina_unicode_utf8_get_next("\xF4\x90\x80\x80", &ind) != 0x110000) ||
(ind != 4));
/* Error cases */
/* Standalone continuation bytes */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\x80", &ind) != 0xDC80) ||
ck_assert((eina_unicode_utf8_get_next("\x80", &ind) != 0xDC80) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xBF", &ind) != 0xDCBF) ||
ck_assert((eina_unicode_utf8_get_next("\xBF", &ind) != 0xDCBF) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\x80\xBF", &ind) != 0xDC80) ||
ck_assert((eina_unicode_utf8_get_next("\x80\xBF", &ind) != 0xDC80) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xBF\x80", &ind) != 0xDCBF) ||
ck_assert((eina_unicode_utf8_get_next("\xBF\x80", &ind) != 0xDCBF) ||
(ind != 1));
/* All possible continuation bytes */
for (ch = 0x80 ; ch <= 0xBF ; ch++)
{
char buf[] = {ch, 0};
ind = 0;
fail_if((eina_unicode_utf8_get_next(buf, &ind) != (0xDC00 | ch)) ||
ck_assert((eina_unicode_utf8_get_next(buf, &ind) != (0xDC00 | ch)) ||
(ind != 1));
}
@ -142,9 +142,9 @@ EFL_START_TEST(eina_unicode_utf8)
ind = 0; \
for (i = 0, ch = start ; ch <= end ; ch++) \
{ \
fail_if((eina_unicode_utf8_get_next(buf, &ind) != (0xDC00 | ch)) || \
ck_assert((eina_unicode_utf8_get_next(buf, &ind) != (0xDC00 | ch)) || \
(ind != ++i)); \
fail_if((eina_unicode_utf8_get_next(buf, &ind) != 0x20) || \
ck_assert((eina_unicode_utf8_get_next(buf, &ind) != 0x20) || \
(ind != ++i)); \
} \
} \
@ -178,13 +178,13 @@ EFL_START_TEST(eina_unicode_utf8)
} \
buf[j] = 0; \
ind = 0; \
fail_if( \
ck_assert( \
(eina_unicode_utf8_get_next(buf, &ind) != (0xDC00 | first))); \
while ((val = eina_unicode_utf8_get_next(buf, &ind))) \
{ \
fail_if(val != (0xDC00 | conti)); \
ck_assert(val != (0xDC00 | conti)); \
} \
fail_if(ind != i); \
ck_assert(ind != i); \
} \
} \
while (0)
@ -203,44 +203,44 @@ EFL_START_TEST(eina_unicode_utf8)
/* Impossible bytes */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFE", &ind) != 0xDCFE) ||
ck_assert((eina_unicode_utf8_get_next("\xFE", &ind) != 0xDCFE) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFF", &ind) != 0xDCFF) ||
ck_assert((eina_unicode_utf8_get_next("\xFF", &ind) != 0xDCFF) ||
(ind != 1));
/* Overlong sequences */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xC0\xAF", &ind) != 0xDCC0) ||
ck_assert((eina_unicode_utf8_get_next("\xC0\xAF", &ind) != 0xDCC0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xE0\x80\xAF", &ind) != 0xDCE0) ||
ck_assert((eina_unicode_utf8_get_next("\xE0\x80\xAF", &ind) != 0xDCE0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF0\x80\x80\xAF", &ind) != 0xDCF0) ||
ck_assert((eina_unicode_utf8_get_next("\xF0\x80\x80\xAF", &ind) != 0xDCF0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF8\x80\x80\x80\xAF", &ind) != 0xDCF8) ||
ck_assert((eina_unicode_utf8_get_next("\xF8\x80\x80\x80\xAF", &ind) != 0xDCF8) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFC\x80\x80\x80\x80\xAF", &ind) != 0xDCFC) ||
ck_assert((eina_unicode_utf8_get_next("\xFC\x80\x80\x80\x80\xAF", &ind) != 0xDCFC) ||
(ind != 1));
/* Maximum overlong sequences */
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xC1\xBF", &ind) != 0xDCC1) ||
ck_assert((eina_unicode_utf8_get_next("\xC1\xBF", &ind) != 0xDCC1) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xE0\x9F\xBF", &ind) != 0xDCE0) ||
ck_assert((eina_unicode_utf8_get_next("\xE0\x9F\xBF", &ind) != 0xDCE0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF0\x8F\xBF\xBF", &ind) != 0xDCF0) ||
ck_assert((eina_unicode_utf8_get_next("\xF0\x8F\xBF\xBF", &ind) != 0xDCF0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xF8\x87\xBF\xBF\xBF", &ind) != 0xDCF8) ||
ck_assert((eina_unicode_utf8_get_next("\xF8\x87\xBF\xBF\xBF", &ind) != 0xDCF8) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_get_next("\xFC\x83\xBF\xBF\xBF\xBF", &ind) != 0xDCFC) ||
ck_assert((eina_unicode_utf8_get_next("\xFC\x83\xBF\xBF\xBF\xBF", &ind) != 0xDCFC) ||
(ind != 1));
/* Add some more error cases here */
}
@ -248,8 +248,8 @@ EFL_END_TEST
EFL_START_TEST(eina_alignof)
{
fail_if(eina_mempool_alignof(6) != 8);
fail_if((eina_mempool_alignof(10) & 0x7) != 0);
ck_assert(eina_mempool_alignof(6) != 8);
ck_assert((eina_mempool_alignof(10) & 0x7) != 0);
}
EFL_END_TEST

View File

@ -30,7 +30,7 @@ static Eina_Bool
eina_accessor_check(EINA_UNUSED const Eina_Array *array,
int *data, int *fdata)
{
fail_if(*fdata > *data);
ck_assert(*fdata > *data);
*fdata = *data;
return EINA_TRUE;
@ -44,29 +44,29 @@ EFL_START_TEST(eina_accessor_array_simple)
int i;
ea = eina_array_new(11);
fail_if(!ea);
ck_assert(!ea);
for (i = 0; i < 200; ++i)
{
tmp = malloc(sizeof(int));
fail_if(!tmp);
ck_assert(!tmp);
*tmp = i;
eina_array_push(ea, tmp);
}
it = eina_array_accessor_new(ea);
fail_if(!it);
ck_assert(!it);
fail_if(eina_accessor_data_get(it, 100, (void **)&tmp) != EINA_TRUE);
fail_if(!tmp);
fail_if(*tmp != 100);
ck_assert(eina_accessor_data_get(it, 100, (void **)&tmp) != EINA_TRUE);
ck_assert(!tmp);
ck_assert(*tmp != 100);
i = 50;
eina_accessor_over(it, EINA_EACH_CB(eina_accessor_check), 50, 100, &i);
fail_if(i != 99);
ck_assert(i != 99);
fail_if(eina_accessor_container_get(it) != ea);
ck_assert(eina_accessor_container_get(it) != ea);
eina_accessor_free(it);
@ -88,7 +88,7 @@ _eina_test_inlist_build(int i)
Eina_Test_Inlist *tmp;
tmp = malloc(sizeof(Eina_Test_Inlist));
fail_if(!tmp);
ck_assert(!tmp);
tmp->i = i;
return tmp;
@ -101,9 +101,9 @@ eina_accessor_inlist_data_check(EINA_UNUSED const Eina_Inlist *in_list,
{
switch (*fdata)
{
case 0: fail_if(data->i != 3227); break;
case 0: ck_assert(data->i != 3227); break;
case 1: fail_if(data->i != 1664); break;
case 1: ck_assert(data->i != 1664); break;
}
(*fdata)++;
@ -121,19 +121,19 @@ EFL_START_TEST(eina_accessor_inlist_simple)
tmp = _eina_test_inlist_build(42);
lst = eina_inlist_append(lst, EINA_INLIST_GET(tmp));
fail_if(!lst);
ck_assert(!lst);
tmp = _eina_test_inlist_build(1664);
lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), lst);
fail_if(!lst);
fail_if(((Eina_Test_Inlist *)lst)->i != 42);
ck_assert(!lst);
ck_assert(((Eina_Test_Inlist *)lst)->i != 42);
prev = tmp;
tmp = _eina_test_inlist_build(3227);
lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(
tmp), EINA_INLIST_GET(prev));
fail_if(!lst);
fail_if(((Eina_Test_Inlist *)lst)->i != 42);
ck_assert(!lst);
ck_assert(((Eina_Test_Inlist *)lst)->i != 42);
tmp = _eina_test_inlist_build(27);
lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(tmp), NULL);
@ -145,22 +145,22 @@ EFL_START_TEST(eina_accessor_inlist_simple)
lst = eina_inlist_append(lst, EINA_INLIST_GET(tmp));
it = eina_inlist_accessor_new(lst);
fail_if(!it);
fail_if(eina_accessor_container_get(it) != lst);
ck_assert(!it);
ck_assert(eina_accessor_container_get(it) != lst);
eina_accessor_over(it, EINA_EACH_CB(eina_accessor_inlist_data_check), 2, 4, &i);
fail_if(eina_accessor_data_get(it, 5, (void **)&tmp) != EINA_TRUE);
fail_if(eina_accessor_data_get(it, 3, (void **)&tmp) != EINA_TRUE);
fail_if(tmp->i != 1664);
fail_if(eina_accessor_data_get(it, 3, (void **)&tmp) != EINA_TRUE);
fail_if(tmp->i != 1664);
fail_if(eina_accessor_data_get(it, 1, (void **)&tmp) != EINA_TRUE);
fail_if(tmp->i != 42);
ck_assert(eina_accessor_data_get(it, 5, (void **)&tmp) != EINA_TRUE);
ck_assert(eina_accessor_data_get(it, 3, (void **)&tmp) != EINA_TRUE);
ck_assert(tmp->i != 1664);
ck_assert(eina_accessor_data_get(it, 3, (void **)&tmp) != EINA_TRUE);
ck_assert(tmp->i != 1664);
ck_assert(eina_accessor_data_get(it, 1, (void **)&tmp) != EINA_TRUE);
ck_assert(tmp->i != 42);
eina_accessor_free(it);
fail_if(i != 2);
ck_assert(i != 2);
}
EFL_END_TEST
@ -171,9 +171,9 @@ eina_iterator_list_data_check(EINA_UNUSED const Eina_List *list,
{
switch (*fdata)
{
case 0: fail_if(*data != 9); break;
case 0: ck_assert(*data != 9); break;
case 1: fail_if(*data != 6); break;
case 1: ck_assert(*data != 6); break;
}
(*fdata)++;
@ -190,41 +190,41 @@ EFL_START_TEST(eina_accessor_list_simple)
int i = 0;
list = eina_list_append(list, &data[0]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[1]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[2]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[3]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[4]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[5]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[6]);
fail_if(list == NULL);
ck_assert(list == NULL);
it = eina_list_accessor_new(list);
fail_if(!it);
ck_assert(!it);
eina_accessor_over(it, EINA_EACH_CB(eina_iterator_list_data_check), 2, 4, &i);
fail_if(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
fail_if(*j != 1);
fail_if(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
fail_if(*j != 6);
fail_if(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
fail_if(*j != 6);
fail_if(eina_accessor_data_get(it, 1, (void **)&j) != EINA_TRUE);
fail_if(*j != 7);
fail_if(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
fail_if(*j != 1);
ck_assert(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
ck_assert(*j != 1);
ck_assert(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
ck_assert(*j != 6);
ck_assert(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
ck_assert(*j != 6);
ck_assert(eina_accessor_data_get(it, 1, (void **)&j) != EINA_TRUE);
ck_assert(*j != 7);
ck_assert(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
ck_assert(*j != 1);
eina_accessor_free(it);
}
@ -243,16 +243,16 @@ EFL_START_TEST(eina_accessor_carray_simple_ptr)
ck_assert_int_eq(data[c], j);
}
fail_if(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
fail_if(j != 1337);
fail_if(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
fail_if(j != 1);
fail_if(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
fail_if(j != 1);
fail_if(eina_accessor_data_get(it, 1, (void **)&j) != EINA_TRUE);
fail_if(j != 9);
fail_if(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
fail_if(j != 1337);
ck_assert(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
ck_assert(j != 1337);
ck_assert(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
ck_assert(j != 1);
ck_assert(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
ck_assert(j != 1);
ck_assert(eina_accessor_data_get(it, 1, (void **)&j) != EINA_TRUE);
ck_assert(j != 9);
ck_assert(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
ck_assert(j != 1337);
eina_accessor_free(it);
}
@ -271,16 +271,16 @@ EFL_START_TEST(eina_accessor_carray_simple)
ck_assert_int_eq(data[c], *j);
}
fail_if(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
fail_if(*j != 1337);
fail_if(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
fail_if(*j != 1);
fail_if(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
fail_if(*j != 1);
fail_if(eina_accessor_data_get(it, 1, (void **)&j) != EINA_TRUE);
fail_if(*j != 9);
fail_if(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
fail_if(*j != 1337);
ck_assert(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
ck_assert(*j != 1337);
ck_assert(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
ck_assert(*j != 1);
ck_assert(eina_accessor_data_get(it, 3, (void **)&j) != EINA_TRUE);
ck_assert(*j != 1);
ck_assert(eina_accessor_data_get(it, 1, (void **)&j) != EINA_TRUE);
ck_assert(*j != 9);
ck_assert(eina_accessor_data_get(it, 5, (void **)&j) != EINA_TRUE);
ck_assert(*j != 1337);
eina_accessor_free(it);
}

View File

@ -34,31 +34,31 @@ EFL_START_TEST(eina_array_simple)
unsigned int i;
ea = eina_array_new(11);
fail_if(!ea);
ck_assert(!ea);
for (i = 0; i < 201; ++i)
{
tmp = malloc(sizeof(char) * 10);
fail_if(!tmp);
ck_assert(!tmp);
eina_convert_itoa(i, tmp);
eina_array_push(ea, tmp);
}
fail_if(eina_array_data_get(ea, 10) == NULL);
fail_if(atoi(eina_array_data_get(ea, 10)) != 10);
ck_assert(eina_array_data_get(ea, 10) == NULL);
ck_assert(atoi(eina_array_data_get(ea, 10)) != 10);
tmp = eina_array_pop(ea);
fail_if(tmp == NULL);
fail_if(atoi(tmp) != 200);
ck_assert(tmp == NULL);
ck_assert(atoi(tmp) != 200);
free(tmp);
EINA_ARRAY_ITER_NEXT(ea, i, tmp, it)
{
fail_if((unsigned int)atoi(tmp) != i);
ck_assert((unsigned int)atoi(tmp) != i);
free(tmp);
}
fail_if(i != 200);
ck_assert(i != 200);
eina_array_clean(ea);
eina_array_flush(ea);
@ -79,22 +79,22 @@ EFL_START_TEST(eina_array_static)
for (i = 0; i < 200; ++i)
{
tmp = malloc(sizeof(char) * 10);
fail_if(!tmp);
ck_assert(!tmp);
eina_convert_itoa(i, tmp);
eina_array_push(&sea, tmp);
}
fail_if(eina_array_data_get(&sea, 10) == NULL);
fail_if(atoi(eina_array_data_get(&sea, 10)) != 10);
ck_assert(eina_array_data_get(&sea, 10) == NULL);
ck_assert(atoi(eina_array_data_get(&sea, 10)) != 10);
EINA_ARRAY_ITER_NEXT(&sea, i, tmp, it)
{
fail_if((unsigned int)atoi(tmp) != i);
ck_assert((unsigned int)atoi(tmp) != i);
free(tmp);
}
fail_if(i != 200);
ck_assert(i != 200);
eina_array_clean(&sea);
eina_array_flush(&sea);
@ -107,8 +107,8 @@ keep_int(void *data, void *gdata)
{
int *tmp = data;
fail_if(gdata);
fail_if(!tmp);
ck_assert(gdata);
ck_assert(!tmp);
if (*tmp == 0)
return EINA_FALSE;
@ -124,12 +124,12 @@ EFL_START_TEST(eina_array_remove_stuff)
unsigned int i;
ea = eina_array_new(64);
fail_if(!ea);
ck_assert(!ea);
for (i = 0; i < 1000; ++i)
{
tmp = malloc(sizeof(int));
fail_if(!tmp);
ck_assert(!tmp);
*tmp = i;
eina_array_push(ea, tmp);
@ -139,35 +139,35 @@ EFL_START_TEST(eina_array_remove_stuff)
for (i = 0; i < 10; ++i)
{
tmp = eina_array_data_get(ea, i);
fail_if(!tmp);
ck_assert(!tmp);
*tmp = 0;
}
fail_if(eina_array_remove(ea, keep_int, NULL) != EINA_TRUE);
ck_assert(eina_array_remove(ea, keep_int, NULL) != EINA_TRUE);
fail_if(eina_array_count(ea) != 990);
ck_assert(eina_array_count(ea) != 990);
EINA_ARRAY_ITER_NEXT(ea, i, tmp, it)
fail_if(*tmp == 0);
ck_assert(*tmp == 0);
// Remove the last items
for (i = 980; i < 990; ++i)
{
tmp = eina_array_data_get(ea, i);
fail_if(!tmp);
ck_assert(!tmp);
*tmp = 0;
}
eina_array_remove(ea, keep_int, NULL);
// Remove all items
fail_if(eina_array_count(ea) != 980);
ck_assert(eina_array_count(ea) != 980);
EINA_ARRAY_ITER_NEXT(ea, i, tmp, it)
{
fail_if(*tmp == 0);
ck_assert(*tmp == 0);
*tmp = 0;
}
eina_array_remove(ea, keep_int, NULL);
fail_if(eina_array_count(ea) != 0);
ck_assert(eina_array_count(ea) != 0);
eina_array_free(ea);
@ -180,22 +180,22 @@ EFL_START_TEST(eina_array_find_test)
uintptr_t i;
unsigned int out = 0;
fail_if(eina_array_find(NULL, (void *)1, NULL) != EINA_FALSE);
ck_assert(eina_array_find(NULL, (void *)1, NULL) != EINA_FALSE);
eina_array_step_set(&sea, sizeof(sea), 5);
for (i = 1 ; i < 10 ; i++)
eina_array_push(&sea, (void *)i);
fail_if(eina_array_find(&sea, (void *)15, NULL) != EINA_FALSE);
ck_assert(eina_array_find(&sea, (void *)15, NULL) != EINA_FALSE);
fail_if(eina_array_find(&sea, (void *)5, NULL) != EINA_TRUE);
fail_if(eina_array_find(&sea, (void *)6, &out) != EINA_TRUE);
fail_if(out != 5);
ck_assert(eina_array_find(&sea, (void *)5, NULL) != EINA_TRUE);
ck_assert(eina_array_find(&sea, (void *)6, &out) != EINA_TRUE);
ck_assert(out != 5);
eina_array_data_set(&sea, 7, (void *)99);
fail_if(eina_array_find(&sea, (void *)99, &out) != EINA_TRUE);
fail_if(out != 7);
ck_assert(eina_array_find(&sea, (void *)99, &out) != EINA_TRUE);
ck_assert(out != 7);
eina_array_flush(&sea);

View File

@ -66,22 +66,22 @@ EFL_START_TEST(eina_barrier_test_simple)
_ck_assert_int(i, >=, 1);
r = eina_barrier_new(&barrier, 6);
fail_unless(r);
ck_assert(r);
r = eina_thread_create(&wk1, EINA_THREAD_NORMAL, -1, wk_func, NULL);
fail_unless(r);
ck_assert(r);
r = eina_thread_create(&wk2, EINA_THREAD_NORMAL, -1, wk_func, NULL);
fail_unless(r);
ck_assert(r);
r = eina_thread_create(&wk3, EINA_THREAD_NORMAL, -1, wk1_func, NULL);
fail_unless(r);
ck_assert(r);
r = eina_thread_create(&wk4, EINA_THREAD_NORMAL, -1, wk2_func, NULL);
fail_unless(r);
ck_assert(r);
r = eina_thread_create(&wk5, EINA_THREAD_NORMAL, -1, wk3_func, NULL);
fail_unless(r);
ck_assert(r);
eina_barrier_wait(&barrier);

View File

@ -48,22 +48,22 @@ EFL_START_TEST(eina_benchmark_simple)
unsigned int i;
eb = eina_benchmark_new("benchmark", "test");
fail_if(!eb);
ck_assert(!eb);
eina_benchmark_register(eb, "specimens_check",
EINA_BENCHMARK(_eina_benchmark_specimens),
1000, 1100, 100);
ea = eina_benchmark_run(eb);
fail_if(!ea);
ck_assert(!ea);
EINA_ARRAY_ITER_NEXT(ea, i, tmp, it)
{
fail_if(!tmp);
fail_if(unlink(tmp));
ck_assert(!tmp);
ck_assert(unlink(tmp));
}
fail_if(global_test != 499500);
ck_assert(global_test != 499500);
eina_benchmark_free(eb);
}

View File

@ -42,7 +42,7 @@ EFL_START_TEST(eina_bezier_test_values)
&cx1, &cy1,
&cx2, &cy2,
&ex, &ey);
fail_if(!EINA_DBL_EQ(sx, 1) ||
ck_assert(!EINA_DBL_EQ(sx, 1) ||
!EINA_DBL_EQ(sy, 2) ||
!EINA_DBL_EQ(cx1, 3) ||
!EINA_DBL_EQ(cy1, 4) ||
@ -65,7 +65,7 @@ EFL_START_TEST(eina_bezier_test_angle)
7, 1);
angle = eina_bezier_angle_at(&b, 0.5);
fail_if(EINA_DBL_NONZERO(angle));
ck_assert(EINA_DBL_NONZERO(angle));
eina_bezier_values_set(&b,
1, 2,
@ -73,7 +73,7 @@ EFL_START_TEST(eina_bezier_test_angle)
1, 6,
1, 8);
angle = eina_bezier_angle_at(&b, 0.5);
fail_if(!EINA_DBL_EQ(floor(angle), 90));
ck_assert(!EINA_DBL_EQ(floor(angle), 90));
}
EFL_END_TEST
@ -89,7 +89,7 @@ EFL_START_TEST(eina_bezier_test_length)
5, 1,
7, 1);
length = eina_bezier_length_get(&b);
fail_if(!EINA_DBL_EQ(floor(length), 6));
ck_assert(!EINA_DBL_EQ(floor(length), 6));
eina_bezier_values_set(&b,
1, 1,
@ -97,7 +97,7 @@ EFL_START_TEST(eina_bezier_test_length)
1, 1,
1, 1);
length = eina_bezier_length_get(&b);
fail_if(!EINA_DBL_EQ(length, 0));
ck_assert(!EINA_DBL_EQ(length, 0));
}
EFL_END_TEST
@ -114,10 +114,10 @@ EFL_START_TEST(eina_bezier_test_t_at)
7, 1);
length = eina_bezier_length_get(&b);
t = eina_bezier_t_at(&b, 0);
fail_if(!EINA_DBL_EQ(floor(t), 0));
ck_assert(!EINA_DBL_EQ(floor(t), 0));
t = eina_bezier_t_at(&b, length);
fail_if(!EINA_DBL_EQ(t, 1));
ck_assert(!EINA_DBL_EQ(t, 1));
}
EFL_END_TEST
@ -133,12 +133,12 @@ EFL_START_TEST(eina_bezier_test_point_at)
5, 6,
7, 8);
eina_bezier_point_at(&b, 0, &x , &y);
fail_if(!EINA_DBL_EQ(x, 1) ||
ck_assert(!EINA_DBL_EQ(x, 1) ||
!EINA_DBL_EQ(y, 2));
eina_bezier_point_at(&b, 1, &x , &y);
fail_if(!EINA_DBL_EQ(x, 7) ||
ck_assert(!EINA_DBL_EQ(x, 7) ||
!EINA_DBL_EQ(y, 8));
}
@ -159,7 +159,7 @@ EFL_START_TEST(eina_bezier_test_split_at_length)
len1 = eina_bezier_length_get(&l);
len2 = eina_bezier_length_get(&r);
fail_if(!EINA_DBL_EQ(len, (len1 + len2)));
ck_assert(!EINA_DBL_EQ(len, (len1 + len2)));
}
EFL_END_TEST
@ -177,7 +177,7 @@ EFL_START_TEST(eina_bezier_test_bounds_get)
eina_bezier_bounds_get(&b, &x, &y, &w, &h);
fail_if(!EINA_DBL_EQ(x, 0) || !EINA_DBL_EQ(y, 0) || !EINA_DBL_EQ(w, 100) || !EINA_DBL_EQ(h, 100));
ck_assert(!EINA_DBL_EQ(x, 0) || !EINA_DBL_EQ(y, 0) || !EINA_DBL_EQ(w, 100) || !EINA_DBL_EQ(h, 100));
}
EFL_END_TEST
@ -196,7 +196,7 @@ EFL_START_TEST(eina_bezier_test_on_interval)
eina_bezier_on_interval(&b, 0.25, 0.5, &res);
eina_bezier_point_at(&res, 0, &px2, &py2);
fail_if(!EINA_DBL_EQ(px1, px2) || !EINA_DBL_EQ(py1, py2));
ck_assert(!EINA_DBL_EQ(px1, px2) || !EINA_DBL_EQ(py1, py2));
}
EFL_END_TEST

View File

@ -35,46 +35,46 @@ EFL_START_TEST(binbuf_simple)
Eina_Rw_Slice rw_slice;
buf = eina_binbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_binbuf_append_length(buf, cbuf, size);
fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
fail_if(size != eina_binbuf_length_get(buf));
ck_assert(memcmp(eina_binbuf_string_get(buf), cbuf, size));
ck_assert(size != eina_binbuf_length_get(buf));
ro_slice = eina_binbuf_slice_get(buf);
fail_if(ro_slice.len != size);
fail_if(ro_slice.mem != eina_binbuf_string_get(buf));
ck_assert(ro_slice.len != size);
ck_assert(ro_slice.mem != eina_binbuf_string_get(buf));
rw_slice = eina_binbuf_rw_slice_get(buf);
fail_if(rw_slice.len != size);
fail_if(rw_slice.mem != eina_binbuf_string_get(buf));
ck_assert(rw_slice.len != size);
ck_assert(rw_slice.mem != eina_binbuf_string_get(buf));
test_buf = eina_binbuf_new();
fail_if(!test_buf);
fail_if(!eina_binbuf_append_buffer(test_buf, buf));
fail_if(memcmp(eina_binbuf_string_get(test_buf), cbuf, size));
fail_if(size != eina_binbuf_length_get(test_buf));
ck_assert(!test_buf);
ck_assert(!eina_binbuf_append_buffer(test_buf, buf));
ck_assert(memcmp(eina_binbuf_string_get(test_buf), cbuf, size));
ck_assert(size != eina_binbuf_length_get(test_buf));
ro_slice.mem = cbuf;
ro_slice.len = size;
eina_binbuf_append_slice(buf, ro_slice);
fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
fail_if(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
fail_if(2 * size != eina_binbuf_length_get(buf));
ck_assert(memcmp(eina_binbuf_string_get(buf), cbuf, size));
ck_assert(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
ck_assert(2 * size != eina_binbuf_length_get(buf));
txt = eina_binbuf_string_steal(buf);
fail_if(memcmp(txt, cbuf, size));
fail_if(memcmp(txt + size, cbuf, size));
ck_assert(memcmp(txt, cbuf, size));
ck_assert(memcmp(txt + size, cbuf, size));
free(txt);
fail_if(eina_binbuf_length_get(buf) != 0);
ck_assert(eina_binbuf_length_get(buf) != 0);
eina_binbuf_append_length(buf, cbuf, size);
fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
fail_if(size != eina_binbuf_length_get(buf));
ck_assert(memcmp(eina_binbuf_string_get(buf), cbuf, size));
ck_assert(size != eina_binbuf_length_get(buf));
eina_binbuf_reset(buf);
fail_if(eina_binbuf_length_get(buf) != 0);
ck_assert(eina_binbuf_length_get(buf) != 0);
eina_binbuf_free(test_buf);
eina_binbuf_free(buf);
@ -90,22 +90,22 @@ EFL_START_TEST(binbuf_remove)
size_t size = sizeof(cbuf) - 1; /* We don't care about the real NULL */
buf = eina_binbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_binbuf_append_length(buf, cbuf, size);
fail_if(size != eina_binbuf_length_get(buf));
ck_assert(size != eina_binbuf_length_get(buf));
eina_binbuf_remove(buf, 0, 4);
fail_if(size - 4 != eina_binbuf_length_get(buf));
ck_assert(size - 4 != eina_binbuf_length_get(buf));
eina_binbuf_remove(buf, 8, 1000);
fail_if(8 != eina_binbuf_length_get(buf));
ck_assert(8 != eina_binbuf_length_get(buf));
eina_binbuf_remove(buf, 7, eina_binbuf_length_get(buf));
fail_if(7 != eina_binbuf_length_get(buf));
ck_assert(7 != eina_binbuf_length_get(buf));
eina_binbuf_remove(buf, 2, 4);
fail_if(5 != eina_binbuf_length_get(buf));
ck_assert(5 != eina_binbuf_length_get(buf));
eina_binbuf_remove(buf, 4, 1);
fail_if(5 != eina_binbuf_length_get(buf));
ck_assert(5 != eina_binbuf_length_get(buf));
eina_binbuf_remove(buf, 0, eina_binbuf_length_get(buf));
fail_if(0 != eina_binbuf_length_get(buf));
ck_assert(0 != eina_binbuf_length_get(buf));
eina_binbuf_free(buf);
}
@ -125,14 +125,14 @@ EFL_START_TEST(binbuf_manage_simple)
memcpy(alloc_buf, cbuf, size);
buf = eina_binbuf_manage_new_length(alloc_buf, size);
fail_if(!buf);
ck_assert(!buf);
fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
fail_if(size != eina_binbuf_length_get(buf));
ck_assert(memcmp(eina_binbuf_string_get(buf), cbuf, size));
ck_assert(size != eina_binbuf_length_get(buf));
eina_binbuf_append_length(buf, cbuf, size);
fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
fail_if(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
fail_if(2 * size != eina_binbuf_length_get(buf));
ck_assert(memcmp(eina_binbuf_string_get(buf), cbuf, size));
ck_assert(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
ck_assert(2 * size != eina_binbuf_length_get(buf));
eina_binbuf_free(buf);
@ -147,19 +147,19 @@ EFL_START_TEST(binbuf_manage_read_only_simple)
size_t size = sizeof(cbuf) - 1; /* We don't care about the real NULL */
buf = eina_binbuf_manage_read_only_new_length(cbuf, size);
fail_if(!buf);
ck_assert(!buf);
eina_binbuf_free(buf);
buf = eina_binbuf_manage_read_only_new_length(cbuf, size);
fail_if(!buf);
ck_assert(!buf);
fail_if(eina_binbuf_string_get(buf) != cbuf);
fail_if(size != eina_binbuf_length_get(buf));
ck_assert(eina_binbuf_string_get(buf) != cbuf);
ck_assert(size != eina_binbuf_length_get(buf));
eina_binbuf_append_length(buf, cbuf, size);
fail_if(memcmp(eina_binbuf_string_get(buf), cbuf, size));
fail_if(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
fail_if(2 * size != eina_binbuf_length_get(buf));
ck_assert(memcmp(eina_binbuf_string_get(buf), cbuf, size));
ck_assert(memcmp(eina_binbuf_string_get(buf) + size, cbuf, size));
ck_assert(2 * size != eina_binbuf_length_get(buf));
eina_binbuf_free(buf);
@ -173,40 +173,40 @@ EFL_START_TEST(binbuf_insert)
Eina_Binbuf *buf;
buf = eina_binbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_binbuf_insert(buf, "abc", 10);
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strcmp(eina_binbuf_string_get(buf), "abc"));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strcmp(eina_binbuf_string_get(buf), "abc"));
eina_binbuf_insert(buf, "123", 0);
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strcmp(eina_binbuf_string_get(buf), "123abc"));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strcmp(eina_binbuf_string_get(buf), "123abc"));
eina_binbuf_insert(buf, "xyz", eina_binbuf_length_get(buf));
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strcmp(eina_binbuf_string_get(buf), "123abcxyz"));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strcmp(eina_binbuf_string_get(buf), "123abcxyz"));
eina_binbuf_insert(buf, "xyz", 1);
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strcmp(eina_binbuf_string_get(buf), "1xyz23abcxyz"));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strcmp(eina_binbuf_string_get(buf), "1xyz23abcxyz"));
eina_binbuf_insert_n(buf, "ABCDEF", 2, 1);
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strcmp(eina_binbuf_string_get(buf), "1ABxyz23abcxyz"));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strcmp(eina_binbuf_string_get(buf), "1ABxyz23abcxyz"));
eina_binbuf_insert_n(buf, "EINA", 2, 3);
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strcmp(eina_binbuf_string_get(buf), "1ABEIxyz23abcxyz"));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strcmp(eina_binbuf_string_get(buf), "1ABEIxyz23abcxyz"));
eina_binbuf_insert_escaped(buf, "678", 3);
fail_if(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
fail_if(strncmp(eina_binbuf_string_get(buf) + 3, "678", 3));
ck_assert(strlen(eina_binbuf_string_get(buf)) != eina_binbuf_length_get(buf));
ck_assert(strncmp(eina_binbuf_string_get(buf) + 3, "678", 3));
eina_binbuf_insert_escaped(buf, "089 '\\", 9);
fail_if(strlen(eina_binbuf_string_get(
ck_assert(strlen(eina_binbuf_string_get(
buf)) != eina_binbuf_length_get(buf));
fail_if(strncmp(eina_binbuf_string_get(buf) + 9,
ck_assert(strncmp(eina_binbuf_string_get(buf) + 9,
"089\\ \\'\\\\",
strlen("089\\ \\'\\\\")));
eina_binbuf_reset(buf);
@ -234,52 +234,52 @@ EFL_START_TEST(binbuf_realloc)
pattern[i] = '\0';
buf = eina_binbuf_new();
fail_if(!buf);
ck_assert(!buf);
sz = 0;
eina_binbuf_append_length(buf, pattern, 1);
fail_if(eina_binbuf_length_get(buf) != sz + 1);
fail_if(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 1));
ck_assert(eina_binbuf_length_get(buf) != sz + 1);
ck_assert(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 1));
sz += 1;
eina_binbuf_append_length(buf, pattern, 32);
fail_if(eina_binbuf_length_get(buf) != sz + 32);
fail_if(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 32));
ck_assert(eina_binbuf_length_get(buf) != sz + 32);
ck_assert(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 32));
sz += 32;
eina_binbuf_append_length(buf, pattern, 64);
fail_if(eina_binbuf_length_get(buf) != sz + 64);
fail_if(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 64));
ck_assert(eina_binbuf_length_get(buf) != sz + 64);
ck_assert(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 64));
sz += 64;
eina_binbuf_append_length(buf, pattern, 128);
fail_if(eina_binbuf_length_get(buf) != sz + 128);
fail_if(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 128));
ck_assert(eina_binbuf_length_get(buf) != sz + 128);
ck_assert(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 128));
sz += 128;
eina_binbuf_append_length(buf, pattern, 4096);
fail_if(eina_binbuf_length_get(buf) != sz + 4096);
fail_if(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 4096));
ck_assert(eina_binbuf_length_get(buf) != sz + 4096);
ck_assert(memcmp(eina_binbuf_string_get(buf) + sz, pattern, 4096));
sz += 4096;
eina_binbuf_append_length(buf, pattern, sizeof(pattern) - 1);
fail_if(eina_binbuf_length_get(buf) != sz + sizeof(pattern) - 1);
fail_if(memcmp(eina_binbuf_string_get(buf) + sz, pattern, sizeof(pattern) -
ck_assert(eina_binbuf_length_get(buf) != sz + sizeof(pattern) - 1);
ck_assert(memcmp(eina_binbuf_string_get(buf) + sz, pattern, sizeof(pattern) -
1));
sz += sizeof(pattern) - 1;
eina_binbuf_remove(buf, 1024, 1024 + 1234);
fail_if(eina_binbuf_length_get(buf) != sz - 1234);
ck_assert(eina_binbuf_length_get(buf) != sz - 1234);
sz -= 1234;
eina_binbuf_remove(buf, 0, 0 + 8192);
fail_if(eina_binbuf_length_get(buf) != sz - 8192);
ck_assert(eina_binbuf_length_get(buf) != sz - 8192);
sz -= 8192;
eina_binbuf_remove(buf, 0, 0 + 32);
fail_if(eina_binbuf_length_get(buf) != sz - 32);
ck_assert(eina_binbuf_length_get(buf) != sz - 32);
sz -= 32;
@ -299,7 +299,7 @@ EFL_START_TEST(binbuf_expand)
Eina_Bool r;
buf = eina_binbuf_new();
fail_if(!buf);
ck_assert(!buf);
rw_slice = eina_binbuf_rw_slice_get(buf);
ck_assert_int_eq(rw_slice.len, 0);

View File

@ -42,14 +42,14 @@ EFL_START_TEST(eina_binshare_simple)
t0 = eina_binshare_add_length(TEST0, TEST0_SIZE);
t1 = eina_binshare_add_length(TEST1, TEST1_SIZE);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(memcmp(t0, TEST0, TEST0_SIZE) != 0);
fail_if(memcmp(t1, TEST1, TEST1_SIZE) != 0);
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(memcmp(t0, TEST0, TEST0_SIZE) != 0);
ck_assert(memcmp(t1, TEST1, TEST1_SIZE) != 0);
t0 = eina_binshare_ref(t0);
fail_if(t0 == NULL);
fail_if(memcmp(t0, TEST0, TEST0_SIZE) != 0);
ck_assert(t0 == NULL);
ck_assert(memcmp(t0, TEST0, TEST0_SIZE) != 0);
eina_binshare_del(t0);
eina_binshare_del(t0);
@ -78,10 +78,10 @@ EFL_START_TEST(eina_binshare_small)
t0 = eina_binshare_add_length(buf, i);
t1 = eina_binshare_add_length(buf, i);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(t0 != t1);
fail_if(memcmp(t0, buf, i) != 0);
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(t0 != t1);
ck_assert(memcmp(t0, buf, i) != 0);
eina_binshare_del(t0);
eina_binshare_del(t1);
@ -98,12 +98,12 @@ EFL_START_TEST(eina_binshare_test_share)
t0 = eina_binshare_add_length(TEST0, TEST0_SIZE);
t1 = eina_binshare_add_length(TEST0, TEST0_SIZE);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(memcmp(t0, TEST0, TEST0_SIZE) != 0);
fail_if(memcmp(t1, TEST0, TEST0_SIZE) != 0);
fail_if(t0 != t1);
fail_if(TEST0_SIZE != eina_binshare_length(t0));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(memcmp(t0, TEST0, TEST0_SIZE) != 0);
ck_assert(memcmp(t1, TEST0, TEST0_SIZE) != 0);
ck_assert(t0 != t1);
ck_assert(TEST0_SIZE != eina_binshare_length(t0));
eina_binshare_del(t0);
eina_binshare_del(t1);

View File

@ -72,7 +72,7 @@ static void add_string_head(const char *string_to_add)
entry_to_add->string = string_to_add;
eina_clist_add_head(&string_list, &entry_to_add->entry);
fail_if(eina_clist_head(&string_list) != &entry_to_add->entry);
ck_assert(eina_clist_head(&string_list) != &entry_to_add->entry);
}
static void iterating_two_phase_with_add_head(unsigned int n, const char *str, int n_ent)
@ -87,8 +87,8 @@ static void iterating_two_phase_with_add_head(unsigned int n, const char *str, i
entries[0]->string = str;
eina_clist_add_tail(&string_list, &entries[0]->entry);
n++;
fail_if(eina_clist_next(&string_list, tail) != &entries[0]->entry);
fail_if(eina_clist_tail(&string_list) != &entries[0]->entry);
ck_assert(eina_clist_next(&string_list, tail) != &entries[0]->entry);
ck_assert(eina_clist_tail(&string_list) != &entries[0]->entry);
for (i=1; i<n_ent; i++)
{
entries[i] = malloc(sizeof(struct test_string));
@ -96,9 +96,9 @@ static void iterating_two_phase_with_add_head(unsigned int n, const char *str, i
entries[i]->string = str;
eina_clist_add_tail(&string_list, &entries[i]->entry);
n++;
fail_if(eina_clist_count(&string_list) != n);
fail_if(eina_clist_tail(&string_list) != &entries[i]->entry);
fail_if(eina_clist_next(&string_list, &entries[i-1]->entry) != &entries[i]->entry);
ck_assert(eina_clist_count(&string_list) != n);
ck_assert(eina_clist_tail(&string_list) != &entries[i]->entry);
ck_assert(eina_clist_next(&string_list, &entries[i-1]->entry) != &entries[i]->entry);
};
}
@ -106,7 +106,7 @@ EFL_START_TEST(eina_clist_basic)
{
unsigned int n = 0;
fail_if(!eina_clist_empty(&string_list));
ck_assert(!eina_clist_empty(&string_list));
add_string("this");
n++;
@ -127,7 +127,7 @@ EFL_START_TEST(eina_clist_basic)
add_string("world");
n++;
fail_if(eina_clist_count(&string_list) != n);
ck_assert(eina_clist_count(&string_list) != n);
print_strings();
@ -148,7 +148,7 @@ EFL_START_TEST(eina_clist_basic)
add_string_after("eight\n");
n++;
fail_if(eina_clist_count(&string_list) != n);
ck_assert(eina_clist_count(&string_list) != n);
add_string_head("one2\n");
n++;
@ -167,13 +167,13 @@ EFL_START_TEST(eina_clist_basic)
add_string_head("eight2\n");
n++;
fail_if(eina_clist_count(&string_list) != n);
ck_assert(eina_clist_count(&string_list) != n);
iterating_two_phase_with_add_head(n, "theString", 16);
free_list();
fail_if(eina_clist_count(&string_list) != 0);
ck_assert(eina_clist_count(&string_list) != 0);
}
EFL_END_TEST

View File

@ -36,33 +36,33 @@ EFL_START_TEST(eina_convert_simple)
char tmp[128];
char ref[128];
fail_if(eina_convert_itoa(0, tmp) != 1);
fail_if(strcmp(tmp, "0") != 0);
ck_assert(eina_convert_itoa(0, tmp) != 1);
ck_assert(strcmp(tmp, "0") != 0);
fail_if(eina_convert_itoa(-1, tmp) != 2);
fail_if(strcmp(tmp, "-1") != 0);
ck_assert(eina_convert_itoa(-1, tmp) != 2);
ck_assert(strcmp(tmp, "-1") != 0);
fail_if(eina_convert_itoa(100, tmp) != 3);
fail_if(strcmp(tmp, "100") != 0);
ck_assert(eina_convert_itoa(100, tmp) != 3);
ck_assert(strcmp(tmp, "100") != 0);
fail_if(eina_convert_itoa(-100, tmp) != 4);
fail_if(strcmp(tmp, "-100") != 0);
ck_assert(eina_convert_itoa(-100, tmp) != 4);
ck_assert(strcmp(tmp, "-100") != 0);
fail_if(eina_convert_itoa(10000000, tmp) != 8);
fail_if(strcmp(tmp, "10000000") != 0);
ck_assert(eina_convert_itoa(10000000, tmp) != 8);
ck_assert(strcmp(tmp, "10000000") != 0);
snprintf(ref, sizeof (ref), "%d", INT_MIN);
fail_if(eina_convert_itoa(INT_MIN, tmp) != (int) strlen(ref));
fail_if(strcmp(tmp, ref) != 0);
ck_assert(eina_convert_itoa(INT_MIN, tmp) != (int) strlen(ref));
ck_assert(strcmp(tmp, ref) != 0);
fail_if(eina_convert_xtoa(0, tmp) != 1);
fail_if(strcmp(tmp, "0") != 0);
ck_assert(eina_convert_xtoa(0, tmp) != 1);
ck_assert(strcmp(tmp, "0") != 0);
fail_if(eina_convert_xtoa(0xA1, tmp) != 2);
fail_if(strcmp(tmp, "a1") != 0);
ck_assert(eina_convert_xtoa(0xA1, tmp) != 2);
ck_assert(strcmp(tmp, "a1") != 0);
fail_if(eina_convert_xtoa(0xFF00EF0E, tmp) != 8);
fail_if(strcmp(tmp, "ff00ef0e") != 0);
ck_assert(eina_convert_xtoa(0xFF00EF0E, tmp) != 8);
ck_assert(strcmp(tmp, "ff00ef0e") != 0);
}
EFL_END_TEST
@ -80,10 +80,10 @@ _eina_convert_check(double test, int length)
long e = 0;
double r;
fail_if(eina_convert_dtoa(test, tmp) != length);
fail_if(eina_convert_atod(tmp, 128, &m, &e) != EINA_TRUE);
ck_assert(eina_convert_dtoa(test, tmp) != length);
ck_assert(eina_convert_atod(tmp, 128, &m, &e) != EINA_TRUE);
r = ldexp((double)m, e);
fail_if(fabs(r - test) > DBL_MIN);
ck_assert(fabs(r - test) > DBL_MIN);
}
EFL_START_TEST(eina_convert_double)
@ -98,9 +98,9 @@ _eina_convert_check(double test, int length)
_eina_convert_check(EET_TEST_DOUBLE3, 21);
_eina_convert_check(EET_TEST_DOUBLE4, 21);
fail_if(eina_convert_atod("ah ah ah", 8, &m, &e) != EINA_FALSE);
fail_if(eina_convert_atod("0xjo", 8, &m, &e) != EINA_FALSE);
fail_if(eina_convert_atod("0xp", 8, &m, &e) != EINA_FALSE);
ck_assert(eina_convert_atod("ah ah ah", 8, &m, &e) != EINA_FALSE);
ck_assert(eina_convert_atod("0xjo", 8, &m, &e) != EINA_FALSE);
ck_assert(eina_convert_atod("0xp", 8, &m, &e) != EINA_FALSE);
}
EFL_END_TEST
@ -118,36 +118,36 @@ _eina_convert_fp_check(double d, Eina_F32p32 fp, int length)
l1 = eina_convert_dtoa(d, tmp1);
l2 = eina_convert_fptoa(fp, tmp2);
/* fprintf(stderr, "[%s](%i) vs [%s](%i)\n", tmp1, l1, tmp2, l2); */
fail_if(l1 != l2);
fail_if(length != l1);
fail_if(strcmp(tmp1, tmp2) != 0);
ck_assert(l1 != l2);
ck_assert(length != l1);
ck_assert(strcmp(tmp1, tmp2) != 0);
fail_if(!eina_convert_atofp(tmp2, l2, &fpc));
ck_assert(!eina_convert_atofp(tmp2, l2, &fpc));
/* fprintf(stderr, "%016x vs %016x\n", fpc, fp); */
fail_if(fpc != fp);
ck_assert(fpc != fp);
fail_if(!eina_convert_atofp(tmp1, l1, &fpc));
ck_assert(!eina_convert_atofp(tmp1, l1, &fpc));
fpd = eina_f32p32_double_to(fpc);
/* fprintf(stderr, "%0.16f vs %0.16f\n", fpd, d); */
fail_if(fabs(fpd - d) > DBL_MIN);
ck_assert(fabs(fpd - d) > DBL_MIN);
d = -d;
fp = -fp;
l1 = eina_convert_dtoa(d, tmp1);
l2 = eina_convert_fptoa(fp, tmp2);
fail_if(l1 != l2);
fail_if(length + 1 != l1);
fail_if(strcmp(tmp1, tmp2) != 0);
ck_assert(l1 != l2);
ck_assert(length + 1 != l1);
ck_assert(strcmp(tmp1, tmp2) != 0);
fail_if(!eina_convert_atofp(tmp2, l2, &fpc));
ck_assert(!eina_convert_atofp(tmp2, l2, &fpc));
/* fprintf(stderr, "%016x vs %016x\n", fpc, fp); */
fail_if(fpc != fp);
ck_assert(fpc != fp);
fail_if(!eina_convert_atofp(tmp1, l1, &fpc));
ck_assert(!eina_convert_atofp(tmp1, l1, &fpc));
fpd = eina_f32p32_double_to(fpc);
/* fprintf(stderr, "%0.16f vs %0.16f\n", fpd, d); */
fail_if(fabs(fpd - d) > DBL_MIN);
ck_assert(fabs(fpd - d) > DBL_MIN);
}
EFL_START_TEST(eina_convert_fp)
@ -178,13 +178,13 @@ _eina_convert_strtod_c_check(const char *str)
switch(fpclassify(d2))
{
case FP_NAN:
fail_if(fpclassify(d1) != FP_NAN);
ck_assert(fpclassify(d1) != FP_NAN);
break;
case FP_INFINITE:
fail_if(fpclassify(d1) != FP_INFINITE);
ck_assert(fpclassify(d1) != FP_INFINITE);
break;
default:
fail_if((fpclassify(d1) != FP_ZERO) &&
ck_assert((fpclassify(d1) != FP_ZERO) &&
(fpclassify(d1) != FP_SUBNORMAL) &&
(fpclassify(d1) != FP_NORMAL));
if (!EINA_DBL_EQ(d1,d2) || (e1 != e2))
@ -197,7 +197,7 @@ _eina_convert_strtod_c_check(const char *str)
if (e1 != e2) printf("different end position\n");
}
fail_if(!EINA_DBL_EQ(d1,d2) || (e1 != e2));
ck_assert(!EINA_DBL_EQ(d1,d2) || (e1 != e2));
break;
}

View File

@ -72,7 +72,7 @@ EFL_START_TEST(eina_counter_simple)
int i;
cnt = eina_counter_new("eina_test");
fail_if(!cnt);
ck_assert(!cnt);
eina_counter_start(cnt);
@ -95,7 +95,7 @@ EFL_START_TEST(eina_counter_simple)
eina_counter_stop(cnt, i);
dump = eina_counter_dump(cnt);
fail_if(!dump);
ck_assert(!dump);
/* TODO: parse dump and check if it's right */
fprintf(stderr, "%s", dump);
@ -112,7 +112,7 @@ EFL_START_TEST(eina_counter_break)
Eina_Counter *cnt;
cnt = eina_counter_new("eina_test");
fail_if(!cnt);
ck_assert(!cnt);
eina_counter_stop(cnt, 10);
@ -136,8 +136,8 @@ EFL_START_TEST(eina_counter_break)
TEST_MAGIC_SAFETY("eina_counter_new",
"safety check failed: name == NULL");
cnt = eina_counter_new(NULL);
fail_if(cnt);
fail_unless(ctx.did);
ck_assert(cnt);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -145,7 +145,7 @@ EFL_START_TEST(eina_counter_break)
TEST_MAGIC_SAFETY("eina_counter_free",
"safety check failed: counter == NULL");
eina_counter_free(NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -153,7 +153,7 @@ EFL_START_TEST(eina_counter_break)
TEST_MAGIC_SAFETY("eina_counter_start",
"safety check failed: counter == NULL");
eina_counter_start(NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -161,7 +161,7 @@ EFL_START_TEST(eina_counter_break)
TEST_MAGIC_SAFETY("eina_counter_stop",
"safety check failed: counter == NULL");
eina_counter_stop(NULL, 0);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
@ -170,8 +170,8 @@ EFL_START_TEST(eina_counter_break)
TEST_MAGIC_SAFETY("eina_counter_dump",
"safety check failed: counter == NULL");
dump = eina_counter_dump(NULL);
fail_if(dump);
fail_unless(ctx.did);
ck_assert(dump);
ck_assert(ctx.did);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
}

View File

@ -50,17 +50,17 @@ EFL_START_TEST(eina_cow_bad)
Eina_Cow_Test default_value = { 7, 42, NULL };
cow = eina_cow_add("COW Test", sizeof (Eina_Cow_Test), 16, &default_value, EINA_TRUE);
fail_if(cow == NULL);
ck_assert(cow == NULL);
cur = eina_cow_alloc(cow);
fail_if(cur == NULL);
ck_assert(cur == NULL);
write = eina_cow_write(cow, (const Eina_Cow_Data**) &cur);
fail_if(write == NULL || write == &default_value);
ck_assert(write == NULL || write == &default_value);
write->i = 7;
eina_cow_done(cow, (const Eina_Cow_Data**) &cur, write, EINA_FALSE);
fail_if(cur->i != 7 || default_value.i != 42);
ck_assert(cur->i != 7 || default_value.i != 42);
#ifdef EINA_COW_MAGIC
Eina_Bool over_commit = EINA_FALSE;
@ -69,15 +69,15 @@ EFL_START_TEST(eina_cow_bad)
eina_log_print_cb_set(_eina_test_log, &over_commit);
/* Testing over commit */
eina_cow_done(cow, (const Eina_Cow_Data**) &cur, write, EINA_FALSE);
fail_if(!over_commit);
ck_assert(!over_commit);
write = eina_cow_write(cow, (const Eina_Cow_Data**) &cur);
fail_if(write == NULL || write == &default_value);
ck_assert(write == NULL || write == &default_value);
eina_log_print_cb_set(_eina_test_log, &over_writing);
/* Testing over writing */
write = eina_cow_write(cow, (const Eina_Cow_Data**) &cur);
fail_if(write != NULL || !over_writing);
ck_assert(write != NULL || !over_writing);
#else
(void) _eina_test_log;
#endif
@ -97,35 +97,35 @@ EFL_START_TEST(eina_cow)
Eina_Cow_Test default_value = { 42, 0, NULL };
cow = eina_cow_add("COW Test", sizeof (Eina_Cow_Test), 16, &default_value, EINA_TRUE);
fail_if(cow == NULL);
ck_assert(cow == NULL);
prev = eina_cow_alloc(cow);
cur = eina_cow_alloc(cow);
fail_if(prev == NULL || cur == NULL);
ck_assert(prev == NULL || cur == NULL);
write = eina_cow_write(cow, (const Eina_Cow_Data**) &cur);
fail_if(write == NULL || write == &default_value);
ck_assert(write == NULL || write == &default_value);
write->i = 7;
eina_cow_done(cow, (const Eina_Cow_Data**) &cur, write, EINA_TRUE);
fail_if(cur->i != 7 || prev->i != 0);
ck_assert(cur->i != 7 || prev->i != 0);
eina_cow_memcpy(cow,
(const Eina_Cow_Data**) &prev,
(const Eina_Cow_Data*) cur);
fail_if(cur->i != 7 || prev->i != 7);
fail_if(default_value.i != 0);
ck_assert(cur->i != 7 || prev->i != 7);
ck_assert(default_value.i != 0);
write = eina_cow_write(cow, (const Eina_Cow_Data**) &cur);
fail_if(write == NULL || write == &default_value);
ck_assert(write == NULL || write == &default_value);
write->i = 42; write->c = 5;
eina_cow_done(cow, (const Eina_Cow_Data**) &cur, write, EINA_TRUE);
fail_if(cur->i != 42 || cur->c != 5 ||
ck_assert(cur->i != 42 || cur->c != 5 ||
prev->i != 7 || prev->c != 42 ||
default_value.c != 42 || default_value.i != 0);
fail_if(eina_cow_gc(cow) == EINA_FALSE);
ck_assert(eina_cow_gc(cow) == EINA_FALSE);
write = eina_cow_write(cow, (const Eina_Cow_Data**) &cur);
write->i = 7; write->c = 42;
@ -134,9 +134,9 @@ EFL_START_TEST(eina_cow)
write = eina_cow_write(cow, (const Eina_Cow_Data**) &prev);
eina_cow_done(cow, (const Eina_Cow_Data**) &prev, write, EINA_TRUE);
fail_if(eina_cow_gc(cow) == EINA_FALSE);
fail_if(eina_cow_gc(cow) == EINA_FALSE);
fail_if(cur != prev);
ck_assert(eina_cow_gc(cow) == EINA_FALSE);
ck_assert(eina_cow_gc(cow) == EINA_FALSE);
ck_assert(cur != prev);
eina_cow_free(cow, (const Eina_Cow_Data**) &cur);
eina_cow_free(cow, (const Eina_Cow_Data**) &prev);

View File

@ -36,12 +36,12 @@ EFL_START_TEST(eina_crc_simple)
for (i = 0; i < sizeof(data) / sizeof(data[0]); ++i)
{
ret = eina_crc(data[i], strlen(data[i]), seed, EINA_TRUE);
fail_if(ret != result[i]);
ck_assert(ret != result[i]);
}
ret = eina_crc(s1, strlen(s1), 0xffffffff, EINA_TRUE);
ret = eina_crc(s2, strlen(s2), ret, EINA_FALSE);
fail_if(ret != result[0]);
ck_assert(ret != result[0]);
}
EFL_END_TEST

View File

@ -76,11 +76,11 @@ EFL_START_TEST(eina_error_errno)
setenv("EINA_ERROR_LEVEL", "1", 0);
test = eina_error_msg_register(TEST_TEXT);
fail_if(!eina_error_msg_get(test));
fail_if(strcmp(eina_error_msg_get(test), TEST_TEXT) != 0);
ck_assert(!eina_error_msg_get(test));
ck_assert(strcmp(eina_error_msg_get(test), TEST_TEXT) != 0);
eina_error_set(test);
fail_if(eina_error_get() != test);
ck_assert(eina_error_get() != test);
eina_error_set(EBADF);
ck_assert_int_eq(eina_error_get(), EBADF);
@ -102,11 +102,11 @@ EFL_START_TEST(eina_error_test_find)
ck_assert_int_ne(test, 0);
str = eina_error_msg_get(test);
fail_unless(str != NULL);
ck_assert(str != NULL);
ck_assert_str_eq(str, TEST_TEXT TEST_TEXT);
eina_error_set(test);
fail_if(eina_error_get() != test);
ck_assert(eina_error_get() != test);
r = eina_error_find(TEST_TEXT TEST_TEXT);
ck_assert_int_eq(r, test);
@ -123,13 +123,13 @@ EFL_START_TEST(eina_error_test_modify)
ck_assert_int_ne(test, 0);
str = eina_error_msg_get(test);
fail_unless(str != NULL);
ck_assert(str != NULL);
ck_assert_str_eq(str, "Some Test Error");
eina_error_set(test);
fail_if(eina_error_get() != test);
ck_assert(eina_error_get() != test);
fail_unless(eina_error_msg_modify(test, "ABCDE"));
ck_assert(eina_error_msg_modify(test, "ABCDE"));
r = eina_error_find("ABCDE");
ck_assert_int_eq(r, test);
@ -138,10 +138,10 @@ EFL_START_TEST(eina_error_test_modify)
ck_assert_int_ne(test, 0);
str = eina_error_msg_get(test);
fail_unless(str != NULL);
fail_unless(str == smsg);
ck_assert(str != NULL);
ck_assert(str == smsg);
fail_unless(eina_error_msg_modify(test, "Change that!"));
ck_assert(eina_error_msg_modify(test, "Change that!"));
r = eina_error_find("Change that!");
ck_assert_int_eq(r, test);
@ -190,12 +190,12 @@ EFL_START_TEST(eina_error_test_failures)
TEST_MAGIC_SAFETY("eina_error_msg_register",
"safety check failed: msg == NULL");
ck_assert_int_eq(eina_error_msg_register(NULL), 0);
fail_unless(ctx.did);
ck_assert(ctx.did);
TEST_MAGIC_SAFETY("eina_error_msg_static_register",
"safety check failed: msg == NULL");
ck_assert_int_eq(eina_error_msg_static_register(NULL), 0);
fail_unless(ctx.did);
ck_assert(ctx.did);
TEST_MAGIC_SAFETY("eina_error_msg_modify",
"safety check failed: EINA_ERROR_REGISTERED_CHECK(error) is false");
@ -209,7 +209,7 @@ EFL_START_TEST(eina_error_test_failures)
"safety check failed: msg == NULL");
ck_assert_int_eq(eina_error_msg_modify(ENOMEM, NULL),
EINA_FALSE);
fail_unless(ctx.did);
ck_assert(ctx.did);
local_error = eina_error_msg_static_register("Local error for test");
ck_assert_int_ne(local_error, 0);
@ -218,7 +218,7 @@ EFL_START_TEST(eina_error_test_failures)
"safety check failed: msg == NULL");
ck_assert_int_eq(eina_error_msg_modify(local_error, NULL),
EINA_FALSE);
fail_unless(ctx.did);
ck_assert(ctx.did);
ck_assert_str_eq(eina_error_msg_get(ENOMEM),
#if defined(_WIN32) || defined(__sun)
@ -230,12 +230,12 @@ EFL_START_TEST(eina_error_test_failures)
TEST_MAGIC_SAFETY("eina_error_find",
"safety check failed: msg == NULL");
ck_assert_int_eq(eina_error_find(NULL), 0);
fail_unless(ctx.did);
ck_assert(ctx.did);
ck_assert_int_eq(eina_error_find("Non-existent Error..."), 0);
fail_if(eina_error_msg_get(0));
fail_if(eina_error_msg_get(4096));
ck_assert(eina_error_msg_get(0));
ck_assert(eina_error_msg_get(4096));
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);

View File

@ -107,8 +107,8 @@ EFL_START_TEST(eina_file_split_simple)
TEST_MAGIC_SAFETY("eina_file_split", "safety check failed: path == NULL");
ea = eina_file_split(NULL);
fail_if(ea);
fail_unless(ctx.did);
ck_assert(ea);
ck_assert(ctx.did);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
#undef TEST_MAGIC_SAFETY
@ -120,13 +120,13 @@ EFL_START_TEST(eina_file_split_simple)
ea = eina_file_split(strdup("/this/is/a/small/test"));
#endif
fail_if(!ea);
fail_if(eina_array_count(ea) != 5);
fail_if(strcmp(eina_array_data_get(ea, 0), "this"));
fail_if(strcmp(eina_array_data_get(ea, 1), "is"));
fail_if(strcmp(eina_array_data_get(ea, 2), "a"));
fail_if(strcmp(eina_array_data_get(ea, 3), "small"));
fail_if(strcmp(eina_array_data_get(ea, 4), "test"));
ck_assert(!ea);
ck_assert(eina_array_count(ea) != 5);
ck_assert(strcmp(eina_array_data_get(ea, 0), "this"));
ck_assert(strcmp(eina_array_data_get(ea, 1), "is"));
ck_assert(strcmp(eina_array_data_get(ea, 2), "a"));
ck_assert(strcmp(eina_array_data_get(ea, 3), "small"));
ck_assert(strcmp(eina_array_data_get(ea, 4), "test"));
eina_array_free(ea);
@ -138,14 +138,14 @@ EFL_START_TEST(eina_file_split_simple)
ea = eina_file_split(strdup("this//is///a /more/complex///case///"));
#endif
fail_if(!ea);
fail_if(eina_array_count(ea) != 6);
fail_if(strcmp(eina_array_data_get(ea, 0), "this"));
fail_if(strcmp(eina_array_data_get(ea, 1), "is"));
fail_if(strcmp(eina_array_data_get(ea, 2), "a "));
fail_if(strcmp(eina_array_data_get(ea, 3), "more"));
fail_if(strcmp(eina_array_data_get(ea, 4), "complex"));
fail_if(strcmp(eina_array_data_get(ea, 5), "case"));
ck_assert(!ea);
ck_assert(eina_array_count(ea) != 6);
ck_assert(strcmp(eina_array_data_get(ea, 0), "this"));
ck_assert(strcmp(eina_array_data_get(ea, 1), "is"));
ck_assert(strcmp(eina_array_data_get(ea, 2), "a "));
ck_assert(strcmp(eina_array_data_get(ea, 3), "more"));
ck_assert(strcmp(eina_array_data_get(ea, 4), "complex"));
ck_assert(strcmp(eina_array_data_get(ea, 5), "case"));
eina_array_free(ea);
@ -202,20 +202,20 @@ EFL_START_TEST(eina_file_direct_ls_simple)
};
const int good_dirs_count = sizeof(good_dirs) / sizeof(const char *);
Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
fail_if(test_dirname == NULL);
ck_assert(test_dirname == NULL);
for (int i = 0; i != good_dirs_count; ++i)
{
Eina_Tmpstr *dirname = get_full_path(test_dirname, good_dirs[i]);
// clean old test directories
rmdir(dirname);
fail_if(mkdir(dirname, default_dir_rights) != 0);
ck_assert(mkdir(dirname, default_dir_rights) != 0);
Eina_File_Direct_Info *dir_info;
Eina_Iterator *it = eina_file_direct_ls(test_dirname);
Eina_Bool found_dir = EINA_FALSE;
fail_if(!eina_iterator_container_get(it));
ck_assert(!eina_iterator_container_get(it));
EINA_ITERATOR_FOREACH(it, dir_info)
{
if (!strcmp(dir_info->path, dirname))
@ -226,12 +226,12 @@ EFL_START_TEST(eina_file_direct_ls_simple)
eina_iterator_free(it);
fail_if(!found_dir);
fail_if(rmdir(dirname) != 0);
ck_assert(!found_dir);
ck_assert(rmdir(dirname) != 0);
eina_tmpstr_del(dirname);
}
fail_if(rmdir(test_dirname) != 0);
ck_assert(rmdir(test_dirname) != 0);
eina_tmpstr_del(test_dirname);
}
EFL_END_TEST
@ -261,20 +261,20 @@ EFL_START_TEST(eina_file_ls_simple)
};
const int good_dirs_count = sizeof(good_dirs) / sizeof(const char *);
Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
fail_if(test_dirname == NULL);
ck_assert(test_dirname == NULL);
for (int i = 0; i != good_dirs_count; ++i)
{
Eina_Tmpstr *dirname = get_full_path(test_dirname, good_dirs[i]);
// clean old test directories
rmdir(dirname);
fail_if(mkdir(dirname, default_dir_rights) != 0);
ck_assert(mkdir(dirname, default_dir_rights) != 0);
char *filename;
Eina_Iterator *it = eina_file_ls(test_dirname);
Eina_Bool found_dir = EINA_FALSE;
fail_if(!eina_iterator_container_get(it));
ck_assert(!eina_iterator_container_get(it));
EINA_ITERATOR_FOREACH(it, filename)
{
if (!strcmp(filename, dirname))
@ -285,12 +285,12 @@ EFL_START_TEST(eina_file_ls_simple)
eina_iterator_free(it);
fail_if(!found_dir);
fail_if(rmdir(dirname) != 0);
ck_assert(!found_dir);
ck_assert(rmdir(dirname) != 0);
eina_tmpstr_del(dirname);
}
fail_if(rmdir(test_dirname) != 0);
ck_assert(rmdir(test_dirname) != 0);
eina_tmpstr_del(test_dirname);
}
EFL_END_TEST
@ -320,7 +320,7 @@ EFL_START_TEST(eina_file_map_new_test)
size_t size;
Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
fail_if(test_dirname == NULL);
ck_assert(test_dirname == NULL);
test_dirname_size = strlen((char *)test_dirname);
// memory allocation
@ -347,7 +347,7 @@ EFL_START_TEST(eina_file_map_new_test)
// set last element of big_buffer in '\0' - end of string
big_buffer[big_buffer_size - file_min_offset] = '\0';
// check big_buffer valid length
fail_if((int)strlen(big_buffer) != (big_buffer_size - file_min_offset));
ck_assert((int)strlen(big_buffer) != (big_buffer_size - file_min_offset));
// generating file 1 full name
strcpy(test_file_path, (char *)test_dirname);
@ -357,59 +357,59 @@ EFL_START_TEST(eina_file_map_new_test)
strcat(test_file2_path, test_file2_name_part);
fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
fail_if(fd <= 0);
fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string));
ck_assert(fd <= 0);
ck_assert(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string));
close(fd);
fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
fail_if(fd <= 0);
fail_if(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset);
ck_assert(fd <= 0);
ck_assert(write(fd, big_buffer, big_buffer_size - file_min_offset) != big_buffer_size - file_min_offset);
close(fd);
e_file = eina_file_open(test_file_path, EINA_FALSE);
fail_if(!e_file);
ck_assert(!e_file);
file_length = eina_file_size_get(e_file);
correct_file_open_check = file_length - test_string_length;
// check size of eina_map_test_string == size of file
fail_if(correct_file_open_check != 0);
ck_assert(correct_file_open_check != 0);
fail_if(eina_file_refresh(e_file));
ck_assert(eina_file_refresh(e_file));
e_file2 = eina_file_open(test_file2_path, EINA_FALSE);
fail_if(!e_file2);
ck_assert(!e_file2);
file2_length = eina_file_size_get(e_file2);
correct_file_open_check = file2_length - (big_buffer_size - file_min_offset);
// check size of big_buffer == size of file
fail_if(correct_file_open_check != 0);
ck_assert(correct_file_open_check != 0);
// test : offset > file -> length => return NULL
map_offset = test_string_length + file_min_offset;
map_length = file_min_offset;
file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
fail_if(file_map);
ck_assert(file_map);
// test : offset + length > file -> length => return NULL
map_offset = file_min_offset;
map_length = test_string_length;
file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
fail_if(file_map);
fail_if(eina_file_map_faulted(e_file, file_map));
ck_assert(file_map);
ck_assert(eina_file_map_faulted(e_file, file_map));
// test : offset = 0 AND length = file->length - use eina_file_map_all
map_offset = 0;
map_length = test_string_length;
file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
fail_if(!file_map);
ck_assert(!file_map);
correct_map_check= strcmp((char*) file_map, eina_map_test_string);
fail_if(correct_map_check != 0);
ck_assert(correct_map_check != 0);
// test : offset = memory_page_size AND length = file->length - memory_page_size => correct partly map
map_offset = memory_page_size;
map_length = big_buffer_size - memory_page_size - file_min_offset;
file2_map = eina_file_map_new(e_file2, EINA_FILE_WILLNEED, map_offset, map_length);
fail_if(!file2_map);
ck_assert(!file2_map);
correct_map_check = strcmp((char*)file2_map, big_buffer + memory_page_size);
fail_if(correct_map_check != 0);
ck_assert(correct_map_check != 0);
// test no crash with eina_file_map_populate()
eina_file_map_populate(e_file, EINA_FILE_POPULATE, file_map, 0, 0);
@ -426,7 +426,7 @@ EFL_START_TEST(eina_file_map_new_test)
unlink(test_file_path);
unlink(test_file2_path);
fail_if(rmdir(test_dirname) != 0);
ck_assert(rmdir(test_dirname) != 0);
free(test_file_path);
free(test_file2_path);
@ -453,33 +453,33 @@ EFL_START_TEST(eina_test_file_virtualize)
unsigned int i = 0;
f = eina_file_virtualize("gloubi", virtual_file_data, strlen(virtual_file_data), EINA_FALSE);
fail_if(!f);
ck_assert(!f);
fail_if(!eina_file_virtual(f));
ck_assert(!eina_file_virtual(f));
tmp = eina_file_dup(f);
fail_if(!tmp);
ck_assert(!tmp);
eina_file_close(tmp);
fail_if(strcmp("gloubi", eina_file_filename_get(f)));
ck_assert(strcmp("gloubi", eina_file_filename_get(f)));
map = eina_file_map_new(f, EINA_FILE_WILLNEED, 7, 7);
fail_if(map != (virtual_file_data + 7));
ck_assert(map != (virtual_file_data + 7));
eina_file_map_free(f, map);
it = eina_file_map_lines(f);
EINA_ITERATOR_FOREACH(it, ln)
{
i++;
fail_if(ln->index != i);
ck_assert(ln->index != i);
if (i == 4 || i == 5)
fail_if(ln->length != 0);
ck_assert(ln->length != 0);
}
fail_if(eina_iterator_container_get(it) != f);
ck_assert(eina_iterator_container_get(it) != f);
eina_iterator_free(it);
fail_if(i != 7);
ck_assert(i != 7);
eina_file_close(f);
@ -494,7 +494,7 @@ _eina_test_file_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
size_t len;
const char test_file[] = "cmd.exe";
fail_if(!GetSystemDirectoryA(filename, MAX_PATH));
ck_assert(!GetSystemDirectoryA(filename, MAX_PATH));
len = strlen(filename);
@ -503,7 +503,7 @@ _eina_test_file_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
* The system path length + path separator + length of the test_file + null terminator
* Must fit in MAX_PATH.
*/
fail_if(MAX_PATH < len + 1 + sizeof(test_file));
ck_assert(MAX_PATH < len + 1 + sizeof(test_file));
// append trailing directory separator if there isn't one
if (filename[len - 1] != '\\' && filename[len - 1] != '/')
@ -522,7 +522,7 @@ _eina_test_file_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
for (i = 0; i < 100; ++i)
{
f = eina_file_open(filename, EINA_FALSE);
fail_if(!f);
ck_assert(!f);
eina_file_close(f);
}
@ -535,10 +535,10 @@ EFL_START_TEST(eina_test_file_thread)
unsigned int i;
for (i = 0; i < 4; i++)
fail_if(!(eina_thread_create(&th[i], EINA_THREAD_NORMAL, -1, _eina_test_file_thread, NULL)));
ck_assert(!(eina_thread_create(&th[i], EINA_THREAD_NORMAL, -1, _eina_test_file_thread, NULL)));
for (i = 0; i < 4; i++)
fail_if(eina_thread_join(th[i]) != NULL);
ck_assert(eina_thread_join(th[i]) != NULL);
}
EFL_END_TEST
@ -597,17 +597,17 @@ EFL_START_TEST(eina_test_file_xattr)
test_file_path = get_full_path(XATTR_TEST_DIR, filename);
fd = open(test_file_path, O_RDONLY | O_BINARY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
fail_if(fd == 0);
ck_assert(fd == 0);
close(fd);
for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i)
{
ret = eina_xattr_set(test_file_path, attribute[i], data[i], strlen(data[i]), EINA_XATTR_INSERT);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
}
ef = eina_file_open(test_file_path, EINA_FALSE);
fail_if(!ef);
ck_assert(!ef);
it = eina_file_xattr_get(ef);
EINA_ITERATOR_FOREACH(it, ret_str)
@ -619,7 +619,7 @@ EFL_START_TEST(eina_test_file_xattr)
break;
}
}
fail_if(count != sizeof (attribute) / sizeof (attribute[0]));
ck_assert(count != sizeof (attribute) / sizeof (attribute[0]));
eina_iterator_free(it);
count = 0;
@ -634,7 +634,7 @@ EFL_START_TEST(eina_test_file_xattr)
break;
}
}
fail_if(count != sizeof (data) / sizeof (data[0]));
ck_assert(count != sizeof (data) / sizeof (data[0]));
eina_iterator_free(it);
unlink(test_file_path);
@ -657,43 +657,43 @@ EFL_START_TEST(eina_test_file_copy)
void *content1, *content2;
fd1 = eina_file_mkstemp(test_file1_name, &test_file1_path);
fail_if(fd1 <= 0);
ck_assert(fd1 <= 0);
fd2 = eina_file_mkstemp(test_file2_name, &test_file2_path);
fail_if(fd2 <= 0);
ck_assert(fd2 <= 0);
fail_if(write(fd1, data, strlen(data)) != (ssize_t) strlen(data));
ck_assert(write(fd1, data, strlen(data)) != (ssize_t) strlen(data));
close(fd1);
close(fd2);
//Copy file data
ret = eina_file_copy(test_file1_path, test_file2_path, EINA_FILE_COPY_DATA, NULL, NULL);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
e_file1 = eina_file_open(test_file1_path, EINA_FALSE);
fail_if(!e_file1);
ck_assert(!e_file1);
file1_len = eina_file_size_get(e_file1);
e_file2 = eina_file_open(test_file2_path, EINA_FALSE);
fail_if(!e_file2);
ck_assert(!e_file2);
file2_len = eina_file_size_get(e_file2);
//Check if both the files are same
fail_if(e_file1 == e_file2);
ck_assert(e_file1 == e_file2);
fail_if(file1_len != strlen(data));
fail_if(file1_len != file2_len);
ck_assert(file1_len != strlen(data));
ck_assert(file1_len != file2_len);
//Check the contents of both the file
content1 = eina_file_map_all(e_file1, EINA_FILE_POPULATE);
fail_if(content1 == NULL);
ck_assert(content1 == NULL);
content2 = eina_file_map_all(e_file2, EINA_FILE_POPULATE);
fail_if(content2 == NULL);
ck_assert(content2 == NULL);
rval = memcmp(content1, content2, strlen(data));
fail_if(rval != 0);
ck_assert(rval != 0);
eina_file_map_free(e_file1, content1);
eina_file_map_free(e_file2, content2);
@ -718,19 +718,19 @@ EFL_START_TEST(eina_test_file_statat)
int fd, ret;
Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
fail_if(test_dirname == NULL);
ck_assert(test_dirname == NULL);
test_file1_path = get_full_path(test_dirname, "example1.txt");
test_file2_path = get_full_path(test_dirname, "example2.txt");
fd = open(test_file1_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
fail_if(fd == 0);
fail_if(write(fd, template, template_size) != template_size);
ck_assert(fd == 0);
ck_assert(write(fd, template, template_size) != template_size);
close(fd);
fd = open(test_file2_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
fail_if(fd == 0);
fail_if(write(fd, template, template_size) != template_size);
ck_assert(fd == 0);
ck_assert(write(fd, template, template_size) != template_size);
close(fd);
it = eina_file_stat_ls(test_dirname);
@ -739,13 +739,13 @@ EFL_START_TEST(eina_test_file_statat)
{
ret = eina_file_statat(eina_iterator_container_get(it), info, &st);
fprintf(stderr, "ret=%d\n", ret);
fail_if(ret != 0);
fail_if(st.size != (unsigned int)template_size);
ck_assert(ret != 0);
ck_assert(st.size != (unsigned int)template_size);
}
unlink(test_file1_path);
unlink(test_file2_path);
fail_if(rmdir(test_dirname) != 0);
ck_assert(rmdir(test_dirname) != 0);
eina_tmpstr_del(test_file1_path);
eina_tmpstr_del(test_file2_path);
eina_tmpstr_del(test_dirname);
@ -776,10 +776,10 @@ EFL_START_TEST(eina_test_file_mktemp)
/* test NULL */
EXPECT_ERROR_START;
fd = eina_file_mkstemp(NULL, NULL);
fail_if(fd >= 0);
ck_assert(fd >= 0);
EXPECT_ERROR_END;
fd = eina_file_mkstemp(patterns[0], NULL);
fail_if(fd < 0);
ck_assert(fd < 0);
/* here's an attempt at removing the file, without knowing its path */
#ifdef F_GETPATH
@ -797,9 +797,9 @@ EFL_START_TEST(eina_test_file_mktemp)
DWORD l;
h = (HANDLE)_get_osfhandle(fd);
fail_if(h == INVALID_HANDLE_VALUE);
ck_assert(h == INVALID_HANDLE_VALUE);
l = GetFinalPathNameByHandle(h, buf, sizeof(buf), 0);
fail_if(l == 0);
ck_assert(l == 0);
/* GetFinalPathNameByHandle() preprends path with \\?\ */
unlink(buf + 4);
}
@ -813,7 +813,7 @@ EFL_START_TEST(eina_test_file_mktemp)
ck_assert(fd >= 0);
ck_assert(!!tmpfile);
file = eina_file_open(tmpfile, EINA_FALSE);
fail_if(!file);
ck_assert(!file);
eina_file_close(file);
unlink(tmpfile);
eina_tmpstr_del(tmpfile);
@ -821,10 +821,10 @@ EFL_START_TEST(eina_test_file_mktemp)
}
/* temp directory */
fail_if(!eina_file_mkdtemp("eina_file_test_XXXXXX", &tmpdir) || !tmpdir);
ck_assert(!eina_file_mkdtemp("eina_file_test_XXXXXX", &tmpdir) || !tmpdir);
it = eina_file_direct_ls(tmpdir);
fail_if(!it);
ck_assert(!it);
/* should be empty! */
EINA_ITERATOR_FOREACH(it, info)
@ -836,20 +836,20 @@ EFL_START_TEST(eina_test_file_mktemp)
eina_file_path_join(buf, sizeof(buf), tmpdir, "eina_file_test_XXXXXX.txt");
fd = eina_file_mkstemp(buf, &tmpfile);
fail_if((fd < 0) || !tmpfile);
fail_if(close(fd));
ck_assert((fd < 0) || !tmpfile);
ck_assert(close(fd));
it = eina_file_direct_ls(tmpdir);
fail_if(!it);
ck_assert(!it);
/* should be empty! */
EINA_ITERATOR_FOREACH(it, info)
fail_if(strcmp(info->path, tmpfile));
ck_assert(strcmp(info->path, tmpfile));
eina_iterator_free(it);
fail_if(unlink(tmpfile));
fail_if(rmdir(tmpdir));
ck_assert(unlink(tmpfile));
ck_assert(rmdir(tmpdir));
eina_tmpstr_del(tmpdir);
}
EFL_END_TEST
@ -860,14 +860,14 @@ int create_file_not_empty(const char *file_name, Eina_Tmpstr **test_file_path,
int data_size = strlen(data);
int wr_size;
int fd = eina_file_mkstemp(file_name, test_file_path);
fail_if(fd <= 0);
ck_assert(fd <= 0);
wr_size = write(fd, data, data_size);
if(close_file == EINA_TRUE)
{
close(fd);
fd = 0;
}
fail_if(wr_size != data_size);
ck_assert(wr_size != data_size);
return fd;
}
@ -880,16 +880,16 @@ EFL_START_TEST(eina_test_file_unlink)
/*If file was not opened as 'eina'*/
fd = create_file_not_empty(tmpfile, &test_file_path, EINA_TRUE);
fail_if(fd != 0);
fail_if(!eina_file_unlink(test_file_path));
ck_assert(fd != 0);
ck_assert(!eina_file_unlink(test_file_path));
/*If file was opened as 'eina'*/
fd = create_file_not_empty(tmpfile, &test_file_path, EINA_TRUE);
fail_if(fd != 0);
ck_assert(fd != 0);
test_file = eina_file_open(test_file_path, EINA_FALSE);
fail_if(!test_file);
fail_if(!eina_file_unlink(test_file_path));
ck_assert(!test_file);
ck_assert(!eina_file_unlink(test_file_path));
eina_file_close(test_file);

View File

@ -47,7 +47,7 @@ EFL_START_TEST(eina_fp_cos)
dresult = cos(dc);
delta = fabs(dresult - eina_f32p32_double_to(fresult));
fail_if(delta > 0.005);
ck_assert(delta > 0.005);
}
}
@ -73,7 +73,7 @@ EFL_START_TEST(eina_fp_sin)
dresult = sin(dc);
delta = fabs(dresult - eina_f32p32_double_to(fresult));
fail_if(delta > 0.005);
ck_assert(delta > 0.005);
}
@ -117,7 +117,7 @@ EFL_START_TEST(eina_fp_mul)
if (delta > 0.008 || delta_per > 0.01)
{
printf("%f*%f = %f (delta: %f, %f%%)\n", dc1, dc2, dresult, delta, delta_per*100);
fail_if(delta > 0.005 || delta_per > 0.01);
ck_assert(delta > 0.005 || delta_per > 0.01);
}
if (delta > maxdelta)
maxdelta = delta;
@ -166,7 +166,7 @@ EFL_START_TEST(eina_fp_div)
if (delta > 0.005 || delta_per > 0.03)
{
printf("%f/%f = %f (delta %f, %f%%)\n", dc1, dc2, dresult, delta, delta_per*100);
fail_if(delta > 0.005 || delta_per > 0.03);
ck_assert(delta > 0.005 || delta_per > 0.03);
}
if (delta > maxdelta)
maxdelta = delta;

View File

@ -12,17 +12,17 @@ EFL_START_TEST(freeq_simple)
int *p;
fq = eina_freeq_main_get();
fail_if(fq == NULL);
fail_if(eina_freeq_type_get(fq) != EINA_FREEQ_DEFAULT);
ck_assert(fq == NULL);
ck_assert(eina_freeq_type_get(fq) != EINA_FREEQ_DEFAULT);
p = malloc(sizeof(int));
*p = 42;
eina_freeq_ptr_main_add(p, NULL, sizeof(int));
eina_freeq_clear(fq);
fail_if(eina_freeq_ptr_pending(eina_freeq_main_get()));
ck_assert(eina_freeq_ptr_pending(eina_freeq_main_get()));
fq = eina_freeq_new(EINA_FREEQ_DEFAULT);
fail_if(!fq);
ck_assert(!fq);
eina_freeq_free(fq);
@ -42,10 +42,10 @@ EFL_START_TEST(freeq_tune)
void *p;
eina_freeq_count_max_set(eina_freeq_main_get(), 3);
fail_if(eina_freeq_count_max_get(eina_freeq_main_get()) != 3);
ck_assert(eina_freeq_count_max_get(eina_freeq_main_get()) != 3);
eina_freeq_mem_max_set(eina_freeq_main_get(), 20);
fail_if(eina_freeq_mem_max_get(eina_freeq_main_get()) != 20);
ck_assert(eina_freeq_mem_max_get(eina_freeq_main_get()) != 20);
_n++;
p = malloc(9);
@ -57,15 +57,15 @@ EFL_START_TEST(freeq_tune)
p = malloc(9);
eina_freeq_ptr_main_add(p, freefn, 9);
eina_freeq_ptr_main_add(NULL, freefn, 9);
fail_if(_n > 2);
ck_assert(_n > 2);
eina_freeq_count_max_set(eina_freeq_main_get(), 1);
fail_if(_n > 1);
ck_assert(_n > 1);
eina_freeq_clear(eina_freeq_main_get());
fail_if(_n > 0);
ck_assert(_n > 0);
fail_if(eina_freeq_ptr_pending(eina_freeq_main_get()) == EINA_TRUE);
ck_assert(eina_freeq_ptr_pending(eina_freeq_main_get()) == EINA_TRUE);
}
EFL_END_TEST
@ -86,8 +86,8 @@ EFL_START_TEST(freeq_reduce)
while (eina_freeq_ptr_pending(eina_freeq_main_get()))
eina_freeq_reduce(eina_freeq_main_get(), 1);
fail_if(_n > 0);
fail_if(eina_freeq_ptr_pending(eina_freeq_main_get()) == EINA_TRUE);
ck_assert(_n > 0);
ck_assert(eina_freeq_ptr_pending(eina_freeq_main_get()) == EINA_TRUE);
_n++;
p = malloc(9);
@ -101,8 +101,8 @@ EFL_START_TEST(freeq_reduce)
while (eina_freeq_ptr_pending(eina_freeq_main_get()))
eina_freeq_reduce(eina_freeq_main_get(), 5);
fail_if(_n > 0);
fail_if(eina_freeq_ptr_pending(eina_freeq_main_get()) == EINA_TRUE);
ck_assert(_n > 0);
ck_assert(eina_freeq_ptr_pending(eina_freeq_main_get()) == EINA_TRUE);
}
EFL_END_TEST
@ -137,8 +137,8 @@ EFL_START_TEST(freeq_postponed)
fq = eina_freeq_new(EINA_FREEQ_POSTPONED);
fail_if(!fq);
fail_if(eina_freeq_type_get(fq) != EINA_FREEQ_POSTPONED);
ck_assert(!fq);
ck_assert(eina_freeq_type_get(fq) != EINA_FREEQ_POSTPONED);
// by default: no limit
ck_assert_int_eq(eina_freeq_count_max_get(fq), -1);
@ -152,10 +152,10 @@ EFL_START_TEST(freeq_postponed)
}
ck_assert_int_eq(_n, EINA_C_ARRAY_LENGTH(values));
fail_if(!eina_freeq_ptr_pending(fq));
ck_assert(!eina_freeq_ptr_pending(fq));
while (eina_freeq_ptr_pending(fq))
eina_freeq_reduce(fq, 1);
fail_if(eina_freeq_ptr_pending(fq));
ck_assert(eina_freeq_ptr_pending(fq));
ck_assert_int_eq(_n, 0);
for (k = 0; k < EINA_C_ARRAY_LENGTH(values); k++)
@ -169,9 +169,9 @@ EFL_START_TEST(freeq_postponed)
}
ck_assert_int_eq(_n, EINA_C_ARRAY_LENGTH(values));
fail_if(!eina_freeq_ptr_pending(fq));
ck_assert(!eina_freeq_ptr_pending(fq));
eina_freeq_clear(fq);
fail_if(eina_freeq_ptr_pending(fq));
ck_assert(eina_freeq_ptr_pending(fq));
ck_assert_int_eq(_n, 0);
for (k = 0; k < EINA_C_ARRAY_LENGTH(values); k++)

View File

@ -64,7 +64,7 @@ eina_foreach_check(EINA_UNUSED const Eina_Hash *hash,
return EINA_TRUE;
i = atoi(key);
fail_if(i != *j);
ck_assert(i != *j);
return EINA_TRUE;
}
@ -77,46 +77,46 @@ EFL_START_TEST(eina_test_hash_simple)
/* As mempool is already initialized and it use hash, we should have 2 init. */
hash = eina_hash_string_superfast_new(NULL);
fail_if(hash == NULL);
ck_assert(hash == NULL);
fail_if(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
fail_if(eina_hash_direct_add(hash, "4", &array[2]) != EINA_TRUE);
fail_if(eina_hash_direct_add(hash, "5", &array[3]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "", "") != EINA_TRUE);
ck_assert(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, "4", &array[2]) != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, "5", &array[3]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "", "") != EINA_TRUE);
test = eina_hash_find(hash, "4");
fail_if(!test);
fail_if(*test != 4);
ck_assert(!test);
ck_assert(*test != 4);
test = eina_hash_find(hash, "42");
fail_if(!test);
fail_if(*test != 42);
ck_assert(!test);
ck_assert(*test != 42);
eina_hash_foreach(hash, eina_foreach_check, NULL);
test = eina_hash_modify(hash, "5", &array[4]);
fail_if(!test);
fail_if(*test != 5);
ck_assert(!test);
ck_assert(*test != 5);
test = eina_hash_find(hash, "5");
fail_if(!test);
fail_if(*test != 6);
ck_assert(!test);
ck_assert(*test != 6);
fail_if(eina_hash_population(hash) != 5);
ck_assert(eina_hash_population(hash) != 5);
fail_if(eina_hash_find(hash, "120") != NULL);
ck_assert(eina_hash_find(hash, "120") != NULL);
fail_if(eina_hash_del(hash, "5", NULL) != EINA_TRUE);
fail_if(eina_hash_find(hash, "5") != NULL);
ck_assert(eina_hash_del(hash, "5", NULL) != EINA_TRUE);
ck_assert(eina_hash_find(hash, "5") != NULL);
fail_if(eina_hash_del(hash, NULL, &array[2]) != EINA_TRUE);
fail_if(eina_hash_find(hash, "4") != NULL);
ck_assert(eina_hash_del(hash, NULL, &array[2]) != EINA_TRUE);
ck_assert(eina_hash_find(hash, "4") != NULL);
fail_if(eina_hash_del(hash, NULL, &array[2]) != EINA_FALSE);
ck_assert(eina_hash_del(hash, NULL, &array[2]) != EINA_FALSE);
fail_if(eina_hash_del(hash, "1", NULL) != EINA_TRUE);
fail_if(eina_hash_del(hash, "42", NULL) != EINA_TRUE);
ck_assert(eina_hash_del(hash, "1", NULL) != EINA_TRUE);
ck_assert(eina_hash_del(hash, "42", NULL) != EINA_TRUE);
eina_hash_free(hash);
}
@ -133,46 +133,46 @@ EFL_START_TEST(eina_test_hash_crc)
EINA_KEY_HASH(eina_hash_crc),
NULL,
EINA_HASH_BUCKET_SIZE);
fail_if(hash == NULL);
ck_assert(hash == NULL);
fail_if(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
fail_if(eina_hash_direct_add(hash, "4", &array[2]) != EINA_TRUE);
fail_if(eina_hash_direct_add(hash, "5", &array[3]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "", "") != EINA_TRUE);
ck_assert(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, "4", &array[2]) != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, "5", &array[3]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "", "") != EINA_TRUE);
test = eina_hash_find(hash, "4");
fail_if(!test);
fail_if(*test != 4);
ck_assert(!test);
ck_assert(*test != 4);
test = eina_hash_find(hash, "42");
fail_if(!test);
fail_if(*test != 42);
ck_assert(!test);
ck_assert(*test != 42);
eina_hash_foreach(hash, eina_foreach_check, NULL);
test = eina_hash_modify(hash, "5", &array[4]);
fail_if(!test);
fail_if(*test != 5);
ck_assert(!test);
ck_assert(*test != 5);
test = eina_hash_find(hash, "5");
fail_if(!test);
fail_if(*test != 6);
ck_assert(!test);
ck_assert(*test != 6);
fail_if(eina_hash_population(hash) != 5);
ck_assert(eina_hash_population(hash) != 5);
fail_if(eina_hash_find(hash, "120") != NULL);
ck_assert(eina_hash_find(hash, "120") != NULL);
fail_if(eina_hash_del(hash, "5", NULL) != EINA_TRUE);
fail_if(eina_hash_find(hash, "5") != NULL);
ck_assert(eina_hash_del(hash, "5", NULL) != EINA_TRUE);
ck_assert(eina_hash_find(hash, "5") != NULL);
fail_if(eina_hash_del(hash, NULL, &array[2]) != EINA_TRUE);
fail_if(eina_hash_find(hash, "4") != NULL);
ck_assert(eina_hash_del(hash, NULL, &array[2]) != EINA_TRUE);
ck_assert(eina_hash_find(hash, "4") != NULL);
fail_if(eina_hash_del(hash, NULL, &array[2]) != EINA_FALSE);
ck_assert(eina_hash_del(hash, NULL, &array[2]) != EINA_FALSE);
fail_if(eina_hash_del(hash, "1", NULL) != EINA_TRUE);
fail_if(eina_hash_del(hash, "42", NULL) != EINA_TRUE);
ck_assert(eina_hash_del(hash, "1", NULL) != EINA_TRUE);
ck_assert(eina_hash_del(hash, "42", NULL) != EINA_TRUE);
eina_hash_free(hash);
}
@ -186,9 +186,9 @@ EFL_START_TEST(eina_test_hash_extended)
char *array;
hash = eina_hash_string_djb2_new(NULL);
fail_if(hash == NULL);
ck_assert(hash == NULL);
fail_if(eina_hash_direct_add(hash, "42", "42") != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, "42", "42") != EINA_TRUE);
array = malloc(num_loops * 10);
ck_assert_ptr_ne(array, NULL);
@ -197,10 +197,10 @@ EFL_START_TEST(eina_test_hash_extended)
{
char *tmp = array + (i * 10);
eina_convert_itoa(i + 42, tmp);
fail_if(eina_hash_direct_add(hash, tmp, tmp) != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, tmp, tmp) != EINA_TRUE);
}
fail_if(eina_hash_find(hash, "42") == NULL);
ck_assert(eina_hash_find(hash, "42") == NULL);
eina_hash_free(hash);
free(array);
@ -214,14 +214,14 @@ EFL_START_TEST(eina_test_hash_double_item)
int *test;
hash = eina_hash_string_superfast_new(NULL);
fail_if(hash == NULL);
ck_assert(hash == NULL);
fail_if(eina_hash_add(hash, "7", &i[0]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "7", &i[1]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "7", &i[0]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "7", &i[1]) != EINA_TRUE);
fail_if(eina_hash_del(hash, "7", &i[1]) != EINA_TRUE);
ck_assert(eina_hash_del(hash, "7", &i[1]) != EINA_TRUE);
test = eina_hash_find(hash, "7");
fail_if(test != &i[0]);
ck_assert(test != &i[0]);
eina_hash_free(hash);
}
@ -237,29 +237,29 @@ EFL_START_TEST(eina_test_hash_all_int)
int it;
hash = eina_hash_int32_new(NULL);
fail_if(hash == NULL);
ck_assert(hash == NULL);
for (it = 0; it < 4; ++it)
fail_if(eina_hash_add(hash, &i[it], &i[it]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, &i[it], &i[it]) != EINA_TRUE);
fail_if(eina_hash_del(hash, &i[1], &i[1]) != EINA_TRUE);
ck_assert(eina_hash_del(hash, &i[1], &i[1]) != EINA_TRUE);
test = eina_hash_find(hash, &i[2]);
fail_if(test != &i[2]);
ck_assert(test != &i[2]);
test = eina_hash_find(hash, &i[3]);
fail_if(test != &i[3]);
ck_assert(test != &i[3]);
eina_hash_free(hash);
hash = eina_hash_int64_new(NULL);
fail_if(hash == NULL);
ck_assert(hash == NULL);
for (it = 0; it < 4; ++it)
fail_if(eina_hash_add(hash, &j[it], &j[it]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, &j[it], &j[it]) != EINA_TRUE);
fail_if(eina_hash_del(hash, &j[1], &j[1]) != EINA_TRUE);
ck_assert(eina_hash_del(hash, &j[1], &j[1]) != EINA_TRUE);
test2 = eina_hash_find(hash, &j[0]);
fail_if(test2 != &j[0]);
ck_assert(test2 != &j[0]);
eina_hash_free(hash);
}
@ -353,7 +353,7 @@ EFL_START_TEST(eina_test_hash_string_fuzze)
{
char *tmp = array + (i * 10);
eina_convert_itoa(i, tmp);
fail_if(eina_hash_direct_add(hash, tmp, tmp) != EINA_TRUE);
ck_assert(eina_hash_direct_add(hash, tmp, tmp) != EINA_TRUE);
}
for (i = 0; i < num_loops; ++i)
@ -373,7 +373,7 @@ EFL_END_TEST
EFL_START_TEST(eina_test_hash_seed)
{
fail_if(eina_seed == 0);
ck_assert(eina_seed == 0);
}
EFL_END_TEST
@ -388,24 +388,24 @@ EFL_START_TEST(eina_test_hash_add_del_by_hash)
EINA_KEY_HASH(eina_hash_crc),
NULL,
EINA_HASH_BUCKET_SIZE);
fail_if(hash == NULL);
fail_if(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "5", &array[3]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "6", &array[4]) != EINA_TRUE);
ck_assert(hash == NULL);
ck_assert(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "5", &array[3]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "6", &array[4]) != EINA_TRUE);
key_len = _eina_string_key_length("4");
key_hash = eina_hash_crc("4", key_len);
fail_if(eina_hash_add_by_hash(hash, "4", key_len, key_hash, &array[2]) != EINA_TRUE);
fail_if(eina_hash_del_by_hash(hash, "4", key_len, key_hash, &array[2]) != EINA_TRUE);
fail_if(eina_hash_del_by_hash(hash, "4", key_len, key_hash, &array[2]) != EINA_FALSE);
ck_assert(eina_hash_add_by_hash(hash, "4", key_len, key_hash, &array[2]) != EINA_TRUE);
ck_assert(eina_hash_del_by_hash(hash, "4", key_len, key_hash, &array[2]) != EINA_TRUE);
ck_assert(eina_hash_del_by_hash(hash, "4", key_len, key_hash, &array[2]) != EINA_FALSE);
key_len = _eina_string_key_length("42");
key_hash = eina_hash_crc("42", key_len);
fail_if(eina_hash_del_by_hash(hash, "42", key_len, key_hash, &array[1]) != EINA_TRUE);
ck_assert(eina_hash_del_by_hash(hash, "42", key_len, key_hash, &array[1]) != EINA_TRUE);
fail_if(eina_hash_population(hash) != 3);
ck_assert(eina_hash_population(hash) != 3);
eina_hash_free(hash);
}
EFL_END_TEST

View File

@ -41,43 +41,43 @@ EFL_START_TEST(eina_inarray_test_simple)
};
array = eina_inarray_new(sizeof(int), 2);
fail_unless(array != NULL);
ck_assert(array != NULL);
for (i = 0; i < test_members; i++)
{
pos = eina_inarray_push(array, &i);
fail_unless(pos == i);
ck_assert(pos == i);
}
fail_unless(eina_inarray_count(array) == (unsigned)test_members);
ck_assert(eina_inarray_count(array) == (unsigned)test_members);
for (i = 0; i < test_members; i++)
{
member = eina_inarray_nth(array, i);
fail_unless(*member == i);
ck_assert(*member == i);
}
for (s = specs; s->pos >= 0; s++)
{
fail_unless(eina_inarray_insert_at(array, s->pos, &s->value));
ck_assert(eina_inarray_insert_at(array, s->pos, &s->value));
for (i = 0; i < s->pos; i++)
{
member = eina_inarray_nth(array, i);
fail_unless(*member == i);
ck_assert(*member == i);
}
member = eina_inarray_nth(array, s->pos);
fail_unless(*member == s->value);
ck_assert(*member == s->value);
for (i = s->pos + 1; i < test_members + 1; i++)
{
member = eina_inarray_nth(array, i);
fail_unless(*member == i - 1);
ck_assert(*member == i - 1);
}
fail_unless(eina_inarray_remove_at(array, s->pos));
ck_assert(eina_inarray_remove_at(array, s->pos));
for (i = 0; i < test_members; i++)
{
member = eina_inarray_nth(array, i);
fail_unless(*member == i);
ck_assert(*member == i);
}
}
@ -93,30 +93,30 @@ EFL_START_TEST(eina_inarray_test_alloc_at)
int i;
array = eina_inarray_new(sizeof(int), 2);
fail_unless(array != NULL);
ck_assert(array != NULL);
member = eina_inarray_alloc_at(array, 0, 4);
fail_unless(member != NULL);
fail_unless(eina_inarray_count(array) == 4);
ck_assert(member != NULL);
ck_assert(eina_inarray_count(array) == 4);
for (i = 0; i < 4; i++)
member[i] = i + 2;
member = eina_inarray_alloc_at(array, 0, 2);
fail_unless(member != NULL);
fail_unless(eina_inarray_count(array) == 6);
ck_assert(member != NULL);
ck_assert(eina_inarray_count(array) == 6);
for (i = 0; i < 2; i++)
member[i] = i;
member = eina_inarray_alloc_at(array, 6, 2);
fail_unless(member != NULL);
fail_unless(eina_inarray_count(array) == 8);
ck_assert(member != NULL);
ck_assert(eina_inarray_count(array) == 8);
for (i = 0; i < 2; i++)
member[i] = i + 6;
member = array->members;
for (i = 0; i < 8; i++)
fail_unless(member[i] == i);
ck_assert(member[i] == i);
eina_inarray_free(array);
}
@ -169,25 +169,25 @@ EFL_START_TEST(eina_inarray_test_insert_sort)
int i, pos;
array = eina_inarray_new(sizeof(short), 1);
fail_unless(array != NULL);
ck_assert(array != NULL);
/* insert sorted and already sorted sequence */
for (i = 0; i < numbers_count; i++)
{
short val = i;
pos = eina_inarray_insert(array, &val, short_cmp);
fail_unless(pos == (int)val);
ck_assert(pos == (int)val);
}
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_flush(array);
for (i = 0; i < numbers_count; i++)
{
short val = i;
pos = eina_inarray_insert_sorted(array, &val, short_cmp);
fail_unless(pos == (int)val);
ck_assert(pos == (int)val);
}
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_flush(array);
/* insert sorted the reverse sequence */
@ -195,18 +195,18 @@ EFL_START_TEST(eina_inarray_test_insert_sort)
{
short val = numbers_count - i - 1;
pos = eina_inarray_insert(array, &val, short_cmp);
fail_unless(pos == 0);
ck_assert(pos == 0);
}
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_flush(array);
for (i = 0; i < numbers_count; i++)
{
short val = numbers_count - i - 1;
pos = eina_inarray_insert_sorted(array, &val, short_cmp);
fail_unless(pos == 0);
ck_assert(pos == 0);
}
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_flush(array);
/* insert sorted random numbers */
@ -215,7 +215,7 @@ EFL_START_TEST(eina_inarray_test_insert_sort)
short val = rand_numbers[i];
eina_inarray_insert(array, &val, short_cmp);
}
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_flush(array);
for (i = 0; i < numbers_count; i++)
@ -223,7 +223,7 @@ EFL_START_TEST(eina_inarray_test_insert_sort)
short val = rand_numbers[i];
eina_inarray_insert_sorted(array, &val, short_cmp);
}
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_flush(array);
eina_inarray_free(array);
@ -236,7 +236,7 @@ EFL_START_TEST(eina_inarray_test_sort)
int i;
array = eina_inarray_new(sizeof(short), 1);
fail_unless(array != NULL);
ck_assert(array != NULL);
for (i = 0; i < numbers_count; i++)
{
@ -244,7 +244,7 @@ EFL_START_TEST(eina_inarray_test_sort)
eina_inarray_push(array, &val);
}
eina_inarray_sort(array, short_cmp);
fail_unless(check_short_sorted(array));
ck_assert(check_short_sorted(array));
eina_inarray_free(array);
}
EFL_END_TEST
@ -255,7 +255,7 @@ EFL_START_TEST(eina_inarray_test_reverse)
int i;
array = eina_inarray_new(sizeof(short), 1);
fail_unless(array != NULL);
ck_assert(array != NULL);
for (i = 0; i < numbers_count; i++)
{
@ -267,7 +267,7 @@ EFL_START_TEST(eina_inarray_test_reverse)
for (i = 0; i < numbers_count; i++)
{
short *member = eina_inarray_nth(array, i);
fail_unless(*member == (numbers_count - i - 1));
ck_assert(*member == (numbers_count - i - 1));
}
eina_inarray_free(array);
@ -279,7 +279,7 @@ array_foreach(const void *array EINA_UNUSED, void *p, void *user_data EINA_UNUSE
{
short *member = p;
int *i = user_data;
fail_unless(*i == *member);
ck_assert(*i == *member);
(*i)++;
return EINA_TRUE;
}
@ -289,7 +289,7 @@ array_foreach_stop_2nd(const void *array EINA_UNUSED, void *p, void *user_data E
{
short *member = p;
int *i = user_data;
fail_unless(*i == *member);
ck_assert(*i == *member);
if (*i == 1)
return EINA_FALSE;
(*i)++;
@ -305,7 +305,7 @@ EFL_START_TEST(eina_inarray_test_itr)
int i;
array = eina_inarray_new(sizeof(short), 1);
fail_unless(array != NULL);
ck_assert(array != NULL);
for (i = 0; i < numbers_count; i++)
{
@ -315,57 +315,57 @@ EFL_START_TEST(eina_inarray_test_itr)
i = 0;
EINA_INARRAY_FOREACH(array, member)
{
fail_unless(*member == i);
ck_assert(*member == i);
i++;
}
fail_unless(i == numbers_count);
ck_assert(i == numbers_count);
i--;
EINA_INARRAY_REVERSE_FOREACH(array, member)
{
fail_unless(*member == i);
ck_assert(*member == i);
i--;
}
fail_unless(i == -1);
ck_assert(i == -1);
i = 0;
fail_unless(eina_inarray_foreach(array, array_foreach, &i));
fail_unless(i == numbers_count);
ck_assert(eina_inarray_foreach(array, array_foreach, &i));
ck_assert(i == numbers_count);
i = 0;
fail_if(eina_inarray_foreach(array, array_foreach_stop_2nd, &i));
fail_unless(i == 1);
ck_assert(eina_inarray_foreach(array, array_foreach_stop_2nd, &i));
ck_assert(i == 1);
it = eina_inarray_iterator_new(array);
fail_unless(it != NULL);
ck_assert(it != NULL);
i = 0;
EINA_ITERATOR_FOREACH(it, member)
{
fail_unless(*member == i);
ck_assert(*member == i);
i++;
}
fail_unless(i == numbers_count);
ck_assert(i == numbers_count);
eina_iterator_free(it);
it = eina_inarray_iterator_reversed_new(array);
fail_unless(it != NULL);
ck_assert(it != NULL);
i--;
EINA_ITERATOR_FOREACH(it, member)
{
fail_unless(*member == i);
ck_assert(*member == i);
i--;
}
fail_unless(i == -1);
ck_assert(i == -1);
eina_iterator_free(it);
ac = eina_inarray_accessor_new(array);
fail_unless(ac != NULL);
ck_assert(ac != NULL);
for (i = 0; i < numbers_count; i++)
{
fail_unless(eina_accessor_data_get(ac, i, (void **)&member));
fail_unless(*member == i);
ck_assert(eina_accessor_data_get(ac, i, (void **)&member));
ck_assert(*member == i);
}
fail_unless(i == numbers_count);
ck_assert(i == numbers_count);
eina_accessor_free(ac);
eina_inarray_free(array);
@ -409,59 +409,59 @@ EFL_START_TEST(eina_inarray_test_search)
//search in empty array
ret = eina_inarray_search(iarr, &temp, cmp);
fail_if(ret != -1);
ck_assert(ret != -1);
//search in single element array
temp = 91;
eina_inarray_push(iarr, &arr[0]);
ret = eina_inarray_search(iarr, &temp, cmp);
fail_if(ret != 0);
ck_assert(ret != 0);
temp = 92;
ret = eina_inarray_search(iarr, &temp, cmp);
fail_if(ret != -1);
ck_assert(ret != -1);
for (i = 1; i < arr_size; ++i)
{
ret = eina_inarray_push(iarr, &arr[i]);
fail_unless(ret == i);
ck_assert(ret == i);
}
temp = 92;
ret = eina_inarray_search(iarr, &temp, cmp);
fail_if(ret != 4);
ck_assert(ret != 4);
temp = 100;
ret = eina_inarray_search(iarr, &temp, cmp);
fail_if(ret != -1);
ck_assert(ret != -1);
rval = eina_inarray_replace_at(iarr, 3, &temp);
fail_if(rval != EINA_TRUE);
ck_assert(rval != EINA_TRUE);
ret = eina_inarray_search(iarr, &temp, cmp);
fail_if(ret != 3);
ck_assert(ret != 3);
EXPECT_ERROR_START;
rval = eina_inarray_replace_at(iarr, arr_size+1, &temp);
fail_if(rval != EINA_FALSE);
ck_assert(rval != EINA_FALSE);
EXPECT_ERROR_END;
ret = eina_inarray_remove(iarr, &temp);
fail_if(ret != 3);
ck_assert(ret != 3);
temp = 101;
ret = eina_inarray_remove(iarr, &temp);
fail_if(ret != -1);
ck_assert(ret != -1);
eina_inarray_sort(iarr, compare);
temp = 92;
ret = eina_inarray_search(iarr, &temp, cmp);
ret1 = eina_inarray_search_sorted(iarr, &temp, cmp);
fail_if(ret != ret1);
ck_assert(ret != ret1);
temp = 100;
ret = eina_inarray_search(iarr, &temp, cmp);
ret1 = eina_inarray_search_sorted(iarr, &temp, cmp);
fail_if(ret != ret1);
ck_assert(ret != ret1);
temp = 105;
ret = eina_inarray_push(iarr, &temp);
@ -469,7 +469,7 @@ EFL_START_TEST(eina_inarray_test_search)
ret = eina_inarray_push(iarr, &temp);
curr_len = iarr->len;
rval = eina_inarray_foreach_remove(iarr, match_cb, &temp);
fail_if(iarr->len != curr_len-3);
ck_assert(iarr->len != curr_len-3);
eina_inarray_free(iarr);
}

View File

@ -78,7 +78,7 @@ _eina_test_inlist_build(int i)
Eina_Test_Inlist *tmp;
tmp = malloc(sizeof(Eina_Test_Inlist));
fail_if(!tmp);
ck_assert(!tmp);
tmp->i = i;
return tmp;
@ -98,22 +98,22 @@ EFL_START_TEST(eina_inlist_simple)
tmp = _eina_test_inlist_build(42);
lst = eina_inlist_append(lst, EINA_INLIST_GET(tmp));
fail_if(!lst);
ck_assert(!lst);
lst = eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
lst = eina_inlist_prepend(lst, EINA_INLIST_GET(tmp));
tmp = _eina_test_inlist_build(1664);
lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), lst);
fail_if(!lst);
fail_if(EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist)->i != 42);
ck_assert(!lst);
ck_assert(EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist)->i != 42);
prev = tmp;
tmp = _eina_test_inlist_build(3227);
lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(
tmp), EINA_INLIST_GET(prev));
fail_if(!lst);
fail_if(EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist)->i != 42);
ck_assert(!lst);
ck_assert(EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist)->i != 42);
lst = eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
@ -132,15 +132,15 @@ EFL_START_TEST(eina_inlist_simple)
{
switch (i)
{
case 0: fail_if(tmp->i != 27); break;
case 0: ck_assert(tmp->i != 27); break;
case 1: fail_if(tmp->i != 3227); break;
case 1: ck_assert(tmp->i != 3227); break;
case 2: fail_if(tmp->i != 42); break;
case 2: ck_assert(tmp->i != 42); break;
case 3: fail_if(tmp->i != 1664); break;
case 3: ck_assert(tmp->i != 1664); break;
case 4: fail_if(tmp->i != 81); break;
case 4: ck_assert(tmp->i != 81); break;
}
++i;
@ -165,8 +165,8 @@ EFL_START_TEST(eina_inlist_simple)
"safety check failed: list == NULL");
tmp2 = eina_inlist_remove(NULL, EINA_INLIST_GET(tmp));
fail_if(tmp2 != NULL);
fail_unless(ctx.did);
ck_assert(tmp2 != NULL);
ck_assert(ctx.did);
}
#ifdef SHOW_LOG
@ -175,7 +175,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_remove",
"safety check failed: item == NULL");
lst = eina_inlist_remove(lst, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -183,7 +183,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_append",
"safety check failed: new_l == NULL");
lst = eina_inlist_append(lst, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -191,7 +191,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_append_relative",
"safety check failed: new_l == NULL");
lst = eina_inlist_append_relative(lst, NULL, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -199,7 +199,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_prepend",
"safety check failed: new_l == NULL");
lst = eina_inlist_prepend(lst, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -207,7 +207,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_prepend_relative",
"safety check failed: new_l == NULL");
lst = eina_inlist_prepend_relative(lst, NULL, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -215,7 +215,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_find",
"safety check failed: item == NULL");
lst = eina_inlist_find(lst, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -223,7 +223,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_demote",
"safety check failed: list == NULL");
lst = eina_inlist_demote(NULL, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -231,7 +231,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_demote",
"safety check failed: item == NULL");
lst = eina_inlist_demote((void*)1L, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
lst = NULL;
#ifdef SHOW_LOG
@ -240,7 +240,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_promote",
"safety check failed: list == NULL");
lst = eina_inlist_promote(NULL, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -248,7 +248,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_promote",
"safety check failed: item == NULL");
lst = eina_inlist_promote((void*)1L, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
lst = NULL;
#ifdef SHOW_LOG
@ -257,7 +257,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_sorted_insert",
"safety check failed: item == NULL");
lst = eina_inlist_sorted_insert(NULL, NULL, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -265,7 +265,7 @@ EFL_START_TEST(eina_inlist_simple)
TEST_MAGIC_SAFETY("eina_inlist_sorted_insert",
"safety check failed: func == NULL");
lst = eina_inlist_sorted_insert(NULL, (void*)1L, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
lst = NULL;
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
@ -273,23 +273,23 @@ EFL_START_TEST(eina_inlist_simple)
#endif
tmpl = eina_inlist_last(lst);
fail_if(tmpl == lst);
ck_assert(tmpl == lst);
tmpl = eina_inlist_first(tmpl);
fail_if(tmpl != lst);
ck_assert(tmpl != lst);
tmp = EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist);
lst = eina_inlist_demote(lst, lst);
fail_if(EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist) == tmp);
ck_assert(EINA_INLIST_CONTAINER_GET(lst, Eina_Test_Inlist) == tmp);
lst = eina_inlist_promote(lst, EINA_INLIST_GET(tmp));
fail_if(lst != EINA_INLIST_GET(tmp));
ck_assert(lst != EINA_INLIST_GET(tmp));
tmp = EINA_INLIST_CONTAINER_GET(eina_inlist_find(lst, EINA_INLIST_GET(
prev)), Eina_Test_Inlist);
lst = eina_inlist_remove(lst, EINA_INLIST_GET(tmp));
prev = (Eina_Test_Inlist *)eina_inlist_find(lst, EINA_INLIST_GET(tmp));
tmp = prev ? EINA_INLIST_CONTAINER_GET(prev, Eina_Test_Inlist) : NULL;
fail_if(tmp != NULL);
ck_assert(tmp != NULL);
while (lst)
lst = eina_inlist_remove(lst, lst);
@ -451,7 +451,7 @@ EFL_START_TEST(eina_inlist_sorted_state)
unsigned int i;
state = eina_inlist_sorted_state_new();
fail_if(!state);
ck_assert(!state);
for (i = 0; i < EINA_C_ARRAY_LENGTH(values_unsorted); ++i)
{
@ -511,7 +511,7 @@ EFL_START_TEST(eina_inlist_sorted_state2)
unsigned int i;
state = eina_inlist_sorted_state_new();
fail_if(!state);
ck_assert(!state);
for (i = 0; i < EINA_C_ARRAY_LENGTH(values_unsorted); ++i)
{

View File

@ -45,7 +45,7 @@ EFL_START_TEST(eina_iterator_filter_simple)
Eina_Array *ea;
ea = eina_array_new(11);
fail_if(!ea);
ck_assert(!ea);
for(int i = 0; i <= 10; i++)
{
@ -66,7 +66,7 @@ EFL_START_TEST(eina_iterator_filter_simple)
ret = eina_iterator_next(filtered, (void**)&numb);
fail_if(!ret);
ck_assert(!ret);
ck_assert_int_eq(numb->number, i);
}
@ -75,7 +75,7 @@ EFL_START_TEST(eina_iterator_filter_simple)
Eina_Bool ret;
ret = eina_iterator_next(filtered, (void**)&numb);
fail_if(ret);
ck_assert(ret);
}
@ -111,7 +111,7 @@ EFL_START_TEST(eina_iterator_filter_free)
data = calloc(1, sizeof(struct Free_test));
ea = eina_array_new(11);
fail_if(!ea);
ck_assert(!ea);
it = eina_array_iterator_new(ea);
filtered = eina_iterator_filter_new(it, _filter_free, _free, data);
@ -129,7 +129,7 @@ static Eina_Bool
eina_iterator_array_check(EINA_UNUSED const Eina_Array *array,
int *data, int *fdata)
{
fail_if(*fdata > *data);
ck_assert(*fdata > *data);
*fdata = *data;
return EINA_TRUE;
@ -143,26 +143,26 @@ EFL_START_TEST(eina_iterator_array_simple)
int i;
ea = eina_array_new(11);
fail_if(!ea);
ck_assert(!ea);
for (i = 0; i < 200; ++i)
{
tmp = malloc(sizeof(int));
fail_if(!tmp);
ck_assert(!tmp);
*tmp = i;
eina_array_push(ea, tmp);
}
it = eina_array_iterator_new(ea);
fail_if(!it);
ck_assert(!it);
i = -1;
eina_iterator_foreach(it, EINA_EACH_CB(eina_iterator_array_check), &i);
fail_if(i != 199);
ck_assert(i != 199);
fail_if(eina_iterator_container_get(it) != ea);
fail_if(eina_iterator_next(it, (void **)&tmp) != EINA_FALSE);
ck_assert(eina_iterator_container_get(it) != ea);
ck_assert(eina_iterator_next(it, (void **)&tmp) != EINA_FALSE);
eina_iterator_free(it);
@ -176,7 +176,7 @@ eina_iterator_hash_key_check(const Eina_Hash *hash,
const char *key,
EINA_UNUSED void *fdata)
{
fail_if(eina_hash_find(hash, key) == NULL);
ck_assert(eina_hash_find(hash, key) == NULL);
return EINA_TRUE;
}
@ -188,7 +188,7 @@ eina_iterator_hash_data_check(const Eina_Hash *hash,
char tmp[10];
snprintf(tmp, 10, "%i", *data);
fail_if(eina_hash_find(hash, tmp) != data);
ck_assert(eina_hash_find(hash, tmp) != data);
return EINA_TRUE;
}
@ -197,7 +197,7 @@ eina_iterator_hash_tuple_check(EINA_UNUSED const Eina_Hash *hash,
Eina_Hash_Tuple *tuple,
EINA_UNUSED void *fdata)
{
fail_if(atoi((char *)tuple->key) != *((int *)tuple->data));
ck_assert(atoi((char *)tuple->key) != *((int *)tuple->data));
return EINA_TRUE;
}
@ -210,13 +210,13 @@ EFL_START_TEST(eina_iterator_hash_simple)
hash = eina_hash_string_superfast_new(NULL);
fail_if(hash == NULL);
ck_assert(hash == NULL);
fail_if(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "7", &array[2]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "8", &array[3]) != EINA_TRUE);
fail_if(eina_hash_add(hash, "6", &array[4]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "1", &array[0]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "42", &array[1]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "7", &array[2]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "8", &array[3]) != EINA_TRUE);
ck_assert(eina_hash_add(hash, "6", &array[4]) != EINA_TRUE);
it = eina_hash_iterator_key_new(hash);
eina_iterator_foreach(it, EINA_EACH_CB(eina_iterator_hash_key_check), NULL);
@ -248,7 +248,7 @@ _eina_test_inlist_build(int i)
Eina_Test_Inlist *tmp;
tmp = malloc(sizeof(Eina_Test_Inlist));
fail_if(!tmp);
ck_assert(!tmp);
tmp->i = i;
return tmp;
@ -261,15 +261,15 @@ eina_iterator_inlist_data_check(EINA_UNUSED const Eina_Inlist *in_list,
{
switch (*fdata)
{
case 0: fail_if(data->i != 27); break;
case 0: ck_assert(data->i != 27); break;
case 1: fail_if(data->i != 42); break;
case 1: ck_assert(data->i != 42); break;
case 2: fail_if(data->i != 3227); break;
case 2: ck_assert(data->i != 3227); break;
case 3: fail_if(data->i != 1664); break;
case 3: ck_assert(data->i != 1664); break;
case 4: fail_if(data->i != 81); break;
case 4: ck_assert(data->i != 81); break;
}
(*fdata)++;
@ -287,19 +287,19 @@ EFL_START_TEST(eina_iterator_inlist_simple)
tmp = _eina_test_inlist_build(42);
lst = eina_inlist_append(lst, EINA_INLIST_GET(tmp));
fail_if(!lst);
ck_assert(!lst);
tmp = _eina_test_inlist_build(1664);
lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), lst);
fail_if(!lst);
fail_if(((Eina_Test_Inlist *)lst)->i != 42);
ck_assert(!lst);
ck_assert(((Eina_Test_Inlist *)lst)->i != 42);
prev = tmp;
tmp = _eina_test_inlist_build(3227);
lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(
tmp), EINA_INLIST_GET(prev));
fail_if(!lst);
fail_if(((Eina_Test_Inlist *)lst)->i != 42);
ck_assert(!lst);
ck_assert(((Eina_Test_Inlist *)lst)->i != 42);
tmp = _eina_test_inlist_build(27);
lst = eina_inlist_prepend_relative(lst, EINA_INLIST_GET(tmp), NULL);
@ -308,12 +308,12 @@ EFL_START_TEST(eina_iterator_inlist_simple)
lst = eina_inlist_append_relative(lst, EINA_INLIST_GET(tmp), NULL);
it = eina_inlist_iterator_new(lst);
fail_if(!it);
ck_assert(!it);
eina_iterator_foreach(it, EINA_EACH_CB(eina_iterator_inlist_data_check), &i);
eina_iterator_free(it);
fail_if(i != 5);
ck_assert(i != 5);
}
EFL_END_TEST
@ -324,19 +324,19 @@ eina_iterator_list_data_check(EINA_UNUSED const Eina_List *list,
{
switch (*fdata)
{
case 0: fail_if(*data != 81); break;
case 0: ck_assert(*data != 81); break;
case 1: fail_if(*data != 7); break;
case 1: ck_assert(*data != 7); break;
case 2: fail_if(*data != 9); break;
case 2: ck_assert(*data != 9); break;
case 3: fail_if(*data != 6); break;
case 3: ck_assert(*data != 6); break;
case 4: fail_if(*data != 42); break;
case 4: ck_assert(*data != 42); break;
case 5: fail_if(*data != 1); break;
case 5: ck_assert(*data != 1); break;
case 6: fail_if(*data != 1337); break;
case 6: ck_assert(*data != 1337); break;
}
(*fdata)++;
@ -353,28 +353,28 @@ EFL_START_TEST(eina_iterator_list_simple)
list = eina_list_append(list, &data[0]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[1]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[2]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[3]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[4]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[5]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[6]);
fail_if(list == NULL);
ck_assert(list == NULL);
it = eina_list_iterator_new(list);
fail_if(!it);
ck_assert(!it);
eina_iterator_foreach(it, EINA_EACH_CB(eina_iterator_list_data_check), &i);
eina_iterator_free(it);
@ -388,19 +388,19 @@ eina_reverse_iterator_list_data_check(EINA_UNUSED const Eina_List *list,
{
switch (*fdata)
{
case 0: fail_if(*data != 1337); break;
case 0: ck_assert(*data != 1337); break;
case 1: fail_if(*data != 1); break;
case 1: ck_assert(*data != 1); break;
case 2: fail_if(*data != 42); break;
case 2: ck_assert(*data != 42); break;
case 3: fail_if(*data != 6); break;
case 3: ck_assert(*data != 6); break;
case 4: fail_if(*data != 9); break;
case 4: ck_assert(*data != 9); break;
case 5: fail_if(*data != 7); break;
case 5: ck_assert(*data != 7); break;
case 6: fail_if(*data != 81); break;
case 6: ck_assert(*data != 81); break;
}
(*fdata)++;
@ -417,28 +417,28 @@ EFL_START_TEST(eina_reverse_iterator_list_simple)
list = eina_list_append(list, &data[0]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[1]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[2]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[3]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[4]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[5]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[6]);
fail_if(list == NULL);
ck_assert(list == NULL);
it = eina_list_iterator_reversed_new(list);
fail_if(!it);
ck_assert(!it);
eina_iterator_foreach(it, EINA_EACH_CB(eina_reverse_iterator_list_data_check), &i);
eina_iterator_free(it);
@ -455,8 +455,8 @@ struct _Eina_Rbtree_Int
static Eina_Rbtree_Direction
eina_rbtree_int_cmp(const Eina_Rbtree_Int *left, const Eina_Rbtree_Int *right, void *data EINA_UNUSED)
{
fail_if(!left);
fail_if(!right);
ck_assert(!left);
ck_assert(!right);
if (left->value < right->value)
return EINA_RBTREE_LEFT;
@ -470,7 +470,7 @@ _eina_rbtree_int_new(int value)
Eina_Rbtree_Int *it;
it = malloc(sizeof (Eina_Rbtree_Int));
fail_if(!it);
ck_assert(!it);
it->value = value;
@ -484,15 +484,15 @@ eina_iterator_rbtree_data_check_sorted(EINA_UNUSED const Eina_List *list,
{
switch (*fdata)
{
case 0: fail_if(data->value != 10); break;
case 0: ck_assert(data->value != 10); break;
case 1: fail_if(data->value != 27); break;
case 1: ck_assert(data->value != 27); break;
case 2: fail_if(data->value != 42); break;
case 2: ck_assert(data->value != 42); break;
case 3: fail_if(data->value != 69); break;
case 3: ck_assert(data->value != 69); break;
case 4: fail_if(data->value != 1337); break;
case 4: ck_assert(data->value != 1337); break;
}
(*fdata)++;
@ -507,15 +507,15 @@ eina_iterator_rbtree_data_check_prefix(EINA_UNUSED const Eina_List *list,
{
switch (*fdata)
{
case 0: fail_if(data->value != 27); break;
case 0: ck_assert(data->value != 27); break;
case 1: fail_if(data->value != 10); break;
case 1: ck_assert(data->value != 10); break;
case 2: fail_if(data->value != 69); break;
case 2: ck_assert(data->value != 69); break;
case 3: fail_if(data->value != 42); break;
case 3: ck_assert(data->value != 42); break;
case 4: fail_if(data->value != 1337); break;
case 4: ck_assert(data->value != 1337); break;
}
(*fdata)++;
@ -530,15 +530,15 @@ eina_iterator_rbtree_data_check_postfix(EINA_UNUSED const Eina_List *list,
{
switch (*fdata)
{
case 0: fail_if(data->value != 10); break;
case 0: ck_assert(data->value != 10); break;
case 1: fail_if(data->value != 42); break;
case 1: ck_assert(data->value != 42); break;
case 2: fail_if(data->value != 1337); break;
case 2: ck_assert(data->value != 1337); break;
case 3: fail_if(data->value != 69); break;
case 3: ck_assert(data->value != 69); break;
case 4: fail_if(data->value != 27); break;
case 4: ck_assert(data->value != 27); break;
}
(*fdata)++;
@ -556,35 +556,35 @@ EFL_START_TEST(eina_iterator_rbtree_simple)
_eina_rbtree_int_new(10),
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp),
NULL);
fail_if(!root);
ck_assert(!root);
root = eina_rbtree_inline_insert(root,
_eina_rbtree_int_new(1337),
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp),
NULL);
fail_if(!root);
ck_assert(!root);
root = eina_rbtree_inline_insert(root,
_eina_rbtree_int_new(27),
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp),
NULL);
fail_if(!root);
ck_assert(!root);
root = eina_rbtree_inline_insert(root,
_eina_rbtree_int_new(69),
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp),
NULL);
fail_if(!root);
ck_assert(!root);
root = eina_rbtree_inline_insert(root,
_eina_rbtree_int_new(42),
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp),
NULL);
fail_if(!root);
ck_assert(!root);
i = 0;
it = eina_rbtree_iterator_prefix(root);
fail_if(!it);
ck_assert(!it);
eina_iterator_foreach(it,
EINA_EACH_CB(eina_iterator_rbtree_data_check_prefix),
@ -594,7 +594,7 @@ EFL_START_TEST(eina_iterator_rbtree_simple)
/* This will return the item sorted. */
i = 0;
it = eina_rbtree_iterator_infix(root);
fail_if(!it);
ck_assert(!it);
eina_iterator_foreach(it,
EINA_EACH_CB(eina_iterator_rbtree_data_check_sorted),
@ -603,7 +603,7 @@ EFL_START_TEST(eina_iterator_rbtree_simple)
i = 0;
it = eina_rbtree_iterator_postfix(root);
fail_if(!it);
ck_assert(!it);
eina_iterator_foreach(it,
EINA_EACH_CB(eina_iterator_rbtree_data_check_postfix),
@ -622,10 +622,10 @@ EFL_START_TEST(eina_iterator_carray_length)
it = EINA_C_ARRAY_ITERATOR_NEW(array);
EINA_ITERATOR_FOREACH(it, i)
{
fail_if(i != j * j);
ck_assert(i != j * j);
j++;
}
fail_if(j < EINA_C_ARRAY_LENGTH(array));
ck_assert(j < EINA_C_ARRAY_LENGTH(array));
eina_iterator_free(it);
}
EFL_END_TEST
@ -644,10 +644,10 @@ EFL_START_TEST(eina_iterator_multi)
EINA_C_ARRAY_ITERATOR_NEW(array3));
EINA_ITERATOR_FOREACH(it, i)
{
fail_if(i != j * j);
ck_assert(i != j * j);
j++;
}
fail_if(j < EINA_C_ARRAY_LENGTH(array1)
ck_assert(j < EINA_C_ARRAY_LENGTH(array1)
+ EINA_C_ARRAY_LENGTH(array2)
+ EINA_C_ARRAY_LENGTH(array3));
eina_iterator_free(it);

View File

@ -64,22 +64,26 @@ EFL_START_TEST(eina_lalloc_simple)
int i;
elat = calloc(1, sizeof (Eina_Lazy_Allocator_Test));
fail_if(!elat);
ck_assert(!elat);
test = eina_lalloc_new(elat, EINA_LALLOC_ALLOC(
_test_alloc), EINA_LALLOC_FREE(_test_free), 10);
fail_if(!test);
ck_assert(!test);
for (i = 0; i < 10; ++i)
fail_if(eina_lalloc_element_add(test) != EINA_TRUE);
fail_if(eina_lalloc_element_add(test) != EINA_FALSE);
fail_if(eina_lalloc_elements_add(test, 5) != EINA_TRUE);
{
ck_assert(eina_lalloc_element_add(test) != EINA_TRUE);
ck_assert(eina_lalloc_element_add(test) != EINA_FALSE);
ck_assert(eina_lalloc_elements_add(test, 5) != EINA_TRUE);
}
for (i = 0; i < 21; ++i)
fail_if(eina_lalloc_element_add(test) != EINA_TRUE);
{
ck_assert(eina_lalloc_element_add(test) != EINA_TRUE);
ck_assert(eina_lalloc_elements_add(test, 50) != EINA_FALSE);
}
fail_if(eina_lalloc_elements_add(test, 50) != EINA_FALSE);
eina_lalloc_free(test);
eina_lalloc_free(test);
}
EFL_END_TEST

View File

@ -69,85 +69,85 @@ EFL_START_TEST(eina_test_list_simple)
list = eina_list_append(list, &data[0]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend(list, &data[1]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[2]);
fail_if(list == NULL);
ck_assert(list == NULL);
i = eina_list_data_idx(list, &data[1]);
fail_if(i != 0);
ck_assert(i != 0);
i = eina_list_data_idx(list, &data[2]);
fail_if(i != 2);
ck_assert(i != 2);
i = eina_list_data_idx(list, &data[3]);
fail_if(i != -1);
ck_assert(i != -1);
list = eina_list_demote_list(list, eina_list_nth_list(list, 1));
test1 = eina_list_nth(list, 2);
fail_if(test1 == NULL);
fail_if(*test1 != 6);
ck_assert(test1 == NULL);
ck_assert(*test1 != 6);
list = eina_list_remove(list, &data[0]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_remove(list, &data[0]);
fail_if(list == NULL);
ck_assert(list == NULL);
tmp = eina_list_data_find_list(list, &data[2]);
fail_if(tmp == NULL);
ck_assert(tmp == NULL);
list = eina_list_append_relative_list(list, &data[3], tmp);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend_relative_list(list, &data[4], tmp);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_promote_list(list, tmp);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append_relative(list, &data[5], &data[2]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend_relative(list, &data[6], &data[2]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_remove_list(list, tmp);
fail_if(list == NULL);
ck_assert(list == NULL);
fail_if(eina_list_data_find_list(list, &data[2]) != NULL);
fail_if(eina_list_data_find(list, &data[2]) != NULL);
fail_if(eina_list_data_find(list, &data[5]) != &data[5]);
ck_assert(eina_list_data_find_list(list, &data[2]) != NULL);
ck_assert(eina_list_data_find(list, &data[2]) != NULL);
ck_assert(eina_list_data_find(list, &data[5]) != &data[5]);
fail_if(eina_list_count(list) != 5);
fail_if(eina_list_nth(list, 4) != &data[3]);
fail_if(eina_list_nth(list, 10) != NULL);
fail_if(eina_list_nth_list(list, 10) != NULL);
ck_assert(eina_list_count(list) != 5);
ck_assert(eina_list_nth(list, 4) != &data[3]);
ck_assert(eina_list_nth(list, 10) != NULL);
ck_assert(eina_list_nth_list(list, 10) != NULL);
for (tmp = list, i = 0; tmp != NULL; tmp = eina_list_next(tmp), ++i)
{
int *d = eina_list_data_get(tmp);
fail_if(d == NULL);
fail_if(*d != result[i]);
}
{
int *d = eina_list_data_get(tmp);
ck_assert(d == NULL);
ck_assert(*d != result[i]);
}
list = eina_list_reverse(list);
for (tmp = list; tmp != NULL; tmp = eina_list_next(tmp), --i)
{
int *d = eina_list_data_get(tmp);
fail_if(d == NULL);
fail_if(*d != result[i - 1]);
}
{
int *d = eina_list_data_get(tmp);
ck_assert(d == NULL);
ck_assert(*d != result[i - 1]);
}
list = eina_list_append_relative(list, &data[7], &data[7]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_prepend_relative(list, &data[8], &data[8]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_sort(list, 2, eina_int_cmp);
@ -157,9 +157,9 @@ EFL_START_TEST(eina_test_list_simple)
test2 = eina_list_nth(list, 1);
test3 = eina_list_nth(list, 2);
fail_if(test1 == NULL || test2 == NULL || test3 == NULL);
fail_if(*test1 > *test2);
fail_if(*test3 == *test2);
ck_assert(test1 == NULL || test2 == NULL || test3 == NULL);
ck_assert(*test1 > *test2);
ck_assert(*test3 == *test2);
list = eina_list_sort(list, 5, eina_int_cmp);
@ -167,52 +167,52 @@ EFL_START_TEST(eina_test_list_simple)
test2 = eina_list_nth(list, 4);
test3 = eina_list_nth(list, 5);
fail_if(test1 == NULL || test2 == NULL || test3 == NULL);
fail_if(*test1 > *test2);
fail_if(*test3 > *test2);
ck_assert(test1 == NULL || test2 == NULL || test3 == NULL);
ck_assert(*test1 > *test2);
ck_assert(*test3 > *test2);
list = eina_list_append(list, &data[8]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_append(list, &data[7]);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_sort(list, -1, eina_int_cmp);
test1 = eina_list_nth(list, 0);
for (tmp = list; tmp != NULL; tmp = eina_list_next(tmp))
{
int *d = eina_list_data_get(tmp);
fail_if(*test1 > *d);
{
int *d = eina_list_data_get(tmp);
ck_assert(*test1 > *d);
test1 = d;
}
test1 = d;
}
test3 = eina_list_nth(list, 5);
fail_if(test3 == NULL);
ck_assert(test3 == NULL);
list = eina_list_promote_list(list, list);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_promote_list(list, eina_list_last(list));
fail_if(list == NULL);
ck_assert(list == NULL);
test1 = eina_list_nth(list, 0);
test2 = eina_list_nth(list, 1);
list = eina_list_promote_list(eina_list_next(list), list);
fail_if(list == NULL);
fail_if(eina_list_data_get(list) != test1);
fail_if(eina_list_data_get(eina_list_next(list)) != test2);
ck_assert(list == NULL);
ck_assert(eina_list_data_get(list) != test1);
ck_assert(eina_list_data_get(eina_list_next(list)) != test2);
list = eina_list_remove_list(list, list);
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_remove_list(list, eina_list_last(list));
fail_if(list == NULL);
ck_assert(list == NULL);
list = eina_list_free(list);
fail_if(list != NULL);
ck_assert(list != NULL);
}
EFL_END_TEST
@ -227,44 +227,48 @@ EFL_START_TEST(eina_test_list_merge)
int data[] = { 6, 9, 42, 1, 7, 9, 81, 1664, 1337, 3, 21, 10, 0, 5, 2008 };
int i;
l1 = eina_list_append(NULL, &data[0]);
l1 = eina_list_append(l1, &data[1]);
l1 = eina_list_append(l1, &data[2]);
l1 = eina_list_append(l1, &data[3]);
fail_if(l1 == NULL);
ck_assert(l1 == NULL);
l2 = eina_list_append(NULL, &data[4]);
l2 = eina_list_append(l2, &data[5]);
fail_if(l2 == NULL);
ck_assert(l2 == NULL);
l1 = eina_list_merge(l1, l2);
fail_if(l1 == NULL);
fail_if(eina_list_count(l1) != 6);
ck_assert(l1 == NULL);
ck_assert(eina_list_count(l1) != 6);
for (i = 0, l2 = l1; ((l2 != NULL) && (i < 6)); ++i, l2 = l2->next)
fail_if(l2->data != &data[i]);
fail_if(i != 6);
fail_if(l2 != NULL);
eina_list_free(l1);
{
ck_assert(l2->data != &data[i]);
ck_assert(i != 6);
ck_assert(l2 != NULL);
}
eina_list_free(l1);
l1 = eina_list_append(NULL, &data[0]);
l1 = eina_list_append(l1, &data[1]);
fail_if(l1 == NULL);
ck_assert(l1 == NULL);
l2 = eina_list_append(NULL, &data[2]);
l2 = eina_list_append(l2, &data[3]);
l2 = eina_list_append(l2, &data[4]);
l2 = eina_list_append(l2, &data[5]);
fail_if(l2 == NULL);
ck_assert(l2 == NULL);
l1 = eina_list_merge(l1, l2);
fail_if(l1 == NULL);
fail_if(eina_list_count(l1) != 6);
ck_assert(l1 == NULL);
ck_assert(eina_list_count(l1) != 6);
for (i = 0, l2 = l1; ((l2 != NULL) && (i < 6)); ++i, l2 = l2->next)
fail_if(l2->data != &data[i]);
fail_if(i != 6);
fail_if(l2 != NULL);
{
ck_assert(l2->data != &data[i]);
ck_assert(i != 6);
ck_assert(l2 != NULL);
}
l3 = eina_list_append(NULL, &data[6]);
l3 = eina_list_append(l3, &data[7]);
@ -284,18 +288,18 @@ EFL_START_TEST(eina_test_list_merge)
l5 = eina_list_sort(l5, -1, eina_int_cmp);
l1 = eina_list_sorted_merge(l1, l3, eina_int_cmp);
fail_if(l1 == NULL);
fail_if(eina_list_count(l1) != 9);
ck_assert(l1 == NULL);
ck_assert(eina_list_count(l1) != 9);
l1 = eina_list_sorted_merge(l1, l4, eina_int_cmp);
fail_if(l1 == NULL);
fail_if(eina_list_count(l1) != 12);
ck_assert(l1 == NULL);
ck_assert(eina_list_count(l1) != 12);
l1 = eina_list_sorted_merge(l1, l5, eina_int_cmp);
fail_if(l1 == NULL);
fail_if(eina_list_count(l1) != 15);
ck_assert(l1 == NULL);
ck_assert(eina_list_count(l1) != 15);
fail_if(!eina_list_sorted_check(l1));
ck_assert(!eina_list_sorted_check(l1));
}
EFL_END_TEST
@ -316,29 +320,29 @@ EFL_START_TEST(eina_test_list_sorted_insert)
for (i = 0; i < count; i++)
l1 = eina_list_sorted_insert(l1, eina_int_cmp, data + i);
fail_if(l1 == NULL);
fail_if(!eina_list_sorted_check(l1));
ck_assert(l1 == NULL);
ck_assert(!eina_list_sorted_check(l1));
res = eina_list_search_sorted(l1, eina_int_cmp, &data[7]);
fail_if(*res != 1664);
ck_assert(*res != 1664);
res = eina_list_search_sorted(l1, eina_int_cmp, &val);
fail_if(res != NULL);
ck_assert(res != NULL);
l2 = NULL;
EINA_LIST_FOREACH(l1, itr, d)
l2 = eina_list_sorted_insert(l2, eina_int_cmp, d);
fail_if(l2 == NULL);
fail_if(!eina_list_sorted_check(l2));
ck_assert(l2 == NULL);
ck_assert(!eina_list_sorted_check(l2));
eina_list_free(l2);
l2 = NULL;
EINA_LIST_REVERSE_FOREACH(l1, itr, d)
l2 = eina_list_sorted_insert(l2, eina_int_cmp, d);
fail_if(l2 == NULL);
fail_if(!eina_list_sorted_check(l2));
ck_assert(l2 == NULL);
ck_assert(!eina_list_sorted_check(l2));
eina_list_free(l2);
eina_list_free(l1);
@ -347,10 +351,9 @@ EFL_START_TEST(eina_test_list_sorted_insert)
for (i = 0; i < count; i++)
l1 = eina_list_sorted_insert(l1, eina_int_cmp, data2 + i);
fail_if(l1 == NULL);
fail_if(!eina_list_sorted_check(l1));
ck_assert(l1 == NULL);
ck_assert(!eina_list_sorted_check(l1));
eina_list_free(l1);
}
EFL_END_TEST
@ -360,7 +363,6 @@ EFL_START_TEST(eina_test_list_split)
Eina_List *list = NULL;
unsigned int i;
list = eina_list_append(list, "tigh");
list = eina_list_append(list, "adar");
list = eina_list_append(list, "baltar");
@ -370,17 +372,17 @@ EFL_START_TEST(eina_test_list_split)
list = eina_list_append(list, "baltar");
list = eina_list_append(list, "roslin");
fail_if(list == NULL);
fail_if(eina_list_count(list) != 8);
ck_assert(list == NULL);
ck_assert(eina_list_count(list) != 8);
for ( i = 0; i < 200; i++)
{
left = eina_list_split_list(list, eina_list_nth_list(list, i % 2), &right);
if (i % 2 == 0)
fail_if(eina_list_count(left) == 1 && eina_list_count(right) + eina_list_count(left) == i + 7);
ck_assert(eina_list_count(left) == 1 && eina_list_count(right) + eina_list_count(left) == i + 7);
else
fail_if(eina_list_count(left) == 2 && eina_list_count(right) + eina_list_count(left) == i + 7);
ck_assert(eina_list_count(left) == 2 && eina_list_count(right) + eina_list_count(left) == i + 7);
list = eina_list_merge(left, right);
list = eina_list_append(list, "roslin");
@ -400,7 +402,6 @@ EFL_START_TEST(eina_test_list_shuffle)
Eina_List *item = NULL;
Eina_List *copy, *cl;
for(i = 0; i < SHUFFLE_SZ; i++)
{
n[i] = i;
@ -434,38 +435,37 @@ EFL_START_TEST(eina_test_list_clone)
for(i = 0; i < DATA_SIZE; i++)
{
n[i] = i;
list = eina_list_append(list, &n[i]);
}
{
n[i] = i;
list = eina_list_append(list, &n[i]);
}
clist = eina_list_clone(list);
fail_if(clist == NULL);
ck_assert(clist == NULL);
for(i = 0; i < DATA_SIZE; i++)
{
fail_if(eina_list_nth(list, i) != eina_list_nth(clist, i));
}
{
ck_assert(eina_list_nth(list, i) != eina_list_nth(clist, i));
}
rclist = eina_list_reverse_clone(list);
fail_if(rclist == NULL);
ck_assert(rclist == NULL);
for(i = 0; i < DATA_SIZE; i++)
{
d = eina_list_nth(list, i);
rd = eina_list_nth(rclist, (DATA_SIZE - 1 - i));
fail_if(d != rd);
}
{
d = eina_list_nth(list, i);
rd = eina_list_nth(rclist, (DATA_SIZE - 1 - i));
ck_assert(d != rd);
}
list = eina_list_free(list);
fail_if(list != NULL);
ck_assert(list != NULL);
clist = eina_list_free(clist);
fail_if(clist != NULL);
ck_assert(clist != NULL);
rclist = eina_list_free(rclist);
fail_if(rclist != NULL);
ck_assert(rclist != NULL);
}
EFL_END_TEST
@ -477,33 +477,31 @@ EFL_START_TEST(eina_test_list_move)
int data2[] = {6, 7, 8, 9, 10};
int i, *list_data;
for (i = 0; i < 5; i++)
{
list1 = eina_list_append(list1, &data1[i]);
list2 = eina_list_append(list2, &data2[i]);
}
fail_if(eina_list_count(list1) != 5);
fail_if(eina_list_count(list2) != 5);
ck_assert(eina_list_count(list1) != 5);
ck_assert(eina_list_count(list2) != 5);
ret = eina_list_move(&list1, &list2, &data2[4]);
fail_if(ret != EINA_TRUE);
fail_if(eina_list_count(list1) != 6);
fail_if(eina_list_count(list2) != 4);
ck_assert(ret != EINA_TRUE);
ck_assert(eina_list_count(list1) != 6);
ck_assert(eina_list_count(list2) != 4);
list_data = eina_list_nth(list1, 5);
fail_if(*list_data != 10);
ck_assert(*list_data != 10);
ret = eina_list_move_list(&list1, &list2,
eina_list_nth_list(list2, 1));
fail_if(ret != EINA_TRUE);
fail_if(eina_list_count(list1) != 7);
fail_if(eina_list_count(list2) != 3);
ck_assert(ret != EINA_TRUE);
ck_assert(eina_list_count(list1) != 7);
ck_assert(eina_list_count(list2) != 3);
list_data = eina_list_nth(list1, 6);
fail_if(*list_data != 7);
ck_assert(*list_data != 7);
eina_list_free(list1);
eina_list_free(list2);
}
EFL_END_TEST

View File

@ -87,14 +87,14 @@ _eina_test_lock_thread(void *data, Eina_Thread t)
{
unsigned int i;
fail_if(!eina_thread_equal(t, thread));
fail_if(strcmp("test", data));
ck_assert(!eina_thread_equal(t, thread));
ck_assert(strcmp("test", data));
for (i = 0; i < 150; i++)
{
fail_if(eina_spinlock_take(&spin) != EINA_LOCK_SUCCEED);
ck_assert(eina_spinlock_take(&spin) != EINA_LOCK_SUCCEED);
counter++;
fail_if(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
ck_assert(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
}
return data;
@ -106,23 +106,23 @@ EFL_START_TEST(eina_test_spinlock)
counter = 0;
fail_if(!eina_spinlock_new(&spin));
ck_assert(!eina_spinlock_new(&spin));
fail_if(!eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, _eina_test_lock_thread, "test"));
ck_assert(!eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, _eina_test_lock_thread, "test"));
for (i = 0; i < 150; i++)
{
fail_if(eina_spinlock_take(&spin) != EINA_LOCK_SUCCEED);
ck_assert(eina_spinlock_take(&spin) != EINA_LOCK_SUCCEED);
counter++;
fail_if(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
ck_assert(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
}
fail_if(strcmp("test", eina_thread_join(thread)));
ck_assert(strcmp("test", eina_thread_join(thread)));
fail_if(counter != 300);
ck_assert(counter != 300);
fail_if(eina_spinlock_take_try(&spin) != EINA_LOCK_SUCCEED);
fail_if(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
ck_assert(eina_spinlock_take_try(&spin) != EINA_LOCK_SUCCEED);
ck_assert(eina_spinlock_release(&spin) != EINA_LOCK_SUCCEED);
eina_spinlock_free(&spin);
@ -154,13 +154,13 @@ _eina_test_tls_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
int *ptr;
ptr = eina_tls_get(key);
fail_if(ptr != NULL);
ck_assert(ptr != NULL);
fail_if(!eina_tls_set(key, _eina_test_tls_alloc(24)));
ck_assert(!eina_tls_set(key, _eina_test_tls_alloc(24)));
ptr = eina_tls_get(key);
fail_if(ptr == NULL);
fail_if(*ptr != 24);
ck_assert(ptr == NULL);
ck_assert(*ptr != 24);
return NULL;
}
@ -168,18 +168,18 @@ _eina_test_tls_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
EFL_START_TEST(eina_test_tls)
{
fail_if(!eina_tls_cb_new(&key, _eina_test_tls_free));
ck_assert(!eina_tls_cb_new(&key, _eina_test_tls_free));
fail_if(!eina_tls_set(key, _eina_test_tls_alloc(42)));
ck_assert(!eina_tls_set(key, _eina_test_tls_alloc(42)));
fail_if(!eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, _eina_test_tls_thread, NULL));
ck_assert(!eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, _eina_test_tls_thread, NULL));
eina_thread_join(thread);
fail_if(_eina_tls_free_count != 1);
ck_assert(_eina_tls_free_count != 1);
int *ptr = eina_tls_get(key);
fail_if(eina_tls_get(key) == NULL);
fail_if(*ptr != 42);
ck_assert(eina_tls_get(key) == NULL);
ck_assert(*ptr != 42);
eina_tls_free(key);
@ -194,20 +194,20 @@ static Eina_RWLock mutex;
static void *
_eina_test_rwlock_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
{
fail_if(!eina_barrier_wait(&barrier));
fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(!eina_condition_broadcast(&cond));
fail_if(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(!eina_barrier_wait(&barrier));
ck_assert(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(!eina_condition_broadcast(&cond));
ck_assert(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(eina_rwlock_take_write(&mutex) != EINA_LOCK_SUCCEED);
ck_assert(eina_rwlock_take_write(&mutex) != EINA_LOCK_SUCCEED);
counter = 7200;
fail_if(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
ck_assert(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
fail_if(!eina_barrier_wait(&barrier));
ck_assert(!eina_barrier_wait(&barrier));
fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(!eina_condition_broadcast(&cond));
fail_if(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(!eina_condition_broadcast(&cond));
ck_assert(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
return NULL;
}
@ -218,46 +218,46 @@ EFL_START_TEST(eina_test_rwlock)
long delay;
fail_if(!eina_rwlock_new(&mutex));
fail_if(!eina_lock_new(&mtcond));
fail_if(!eina_condition_new(&cond, &mtcond));
fail_if(!eina_barrier_new(&barrier, 2));
ck_assert(!eina_rwlock_new(&mutex));
ck_assert(!eina_lock_new(&mtcond));
ck_assert(!eina_condition_new(&cond, &mtcond));
ck_assert(!eina_barrier_new(&barrier, 2));
counter = 42;
eina_lock_debug(&mtcond);
fail_if(eina_rwlock_take_read(&mutex) != EINA_LOCK_SUCCEED);
fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(eina_rwlock_take_read(&mutex) != EINA_LOCK_SUCCEED);
ck_assert(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(!eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, _eina_test_rwlock_thread, NULL));
ck_assert(!eina_thread_create(&thread, EINA_THREAD_NORMAL, -1, _eina_test_rwlock_thread, NULL));
fail_if(!eina_barrier_wait(&barrier));
fail_if(!eina_condition_wait(&cond));
fail_if(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(!eina_barrier_wait(&barrier));
ck_assert(!eina_condition_wait(&cond));
ck_assert(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(counter != 42);
fail_if(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
ck_assert(counter != 42);
ck_assert(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(!eina_barrier_wait(&barrier));
ck_assert(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(!eina_barrier_wait(&barrier));
fail_if(!eina_condition_wait(&cond));
fail_if(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(!eina_condition_wait(&cond));
ck_assert(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
fail_if(eina_rwlock_take_read(&mutex) != EINA_LOCK_SUCCEED);
fail_if(counter != 7200);
fail_if(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
ck_assert(eina_rwlock_take_read(&mutex) != EINA_LOCK_SUCCEED);
ck_assert(counter != 7200);
ck_assert(eina_rwlock_release(&mutex) != EINA_LOCK_SUCCEED);
fail_if(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(eina_lock_take(&mtcond) != EINA_LOCK_SUCCEED);
clock_gettime(CLOCK_REALTIME, &ts);
eina_condition_timedwait(&cond, 0.050);
clock_gettime(CLOCK_REALTIME, &ts2);
delay = (ts2.tv_sec - ts.tv_sec) * 1000L + (ts2.tv_nsec - ts.tv_nsec) / 1000000L;
fail_if(delay < 50);
fail_if(delay > 200);
fail_if(eina_error_get() != ETIMEDOUT);
fail_if(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
ck_assert(delay < 50);
ck_assert(delay > 200);
ck_assert(eina_error_get() != ETIMEDOUT);
ck_assert(eina_lock_release(&mtcond) != EINA_LOCK_SUCCEED);
eina_thread_join(thread);

View File

@ -127,35 +127,35 @@ EFL_START_TEST(eina_log_macro)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_CRITICAL, "Critical message");
EINA_LOG_CRIT("Critical message");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_ERR <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_ERR, "An error");
EINA_LOG_ERR("An error");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_WARN <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_WARN, "A warning");
EINA_LOG_WARN("A warning");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_INFO <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_INFO, "An info");
EINA_LOG_INFO("An info");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_DBG <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_DBG, "A debug");
EINA_LOG_DBG("A debug");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
#undef TEST_LOG_CTX
@ -179,7 +179,7 @@ EFL_START_TEST(eina_log_domains_macros)
eina_log_print_cb_set(_eina_test_log_domain, &ctx);
int d = eina_log_domain_register("MyDomain", EINA_COLOR_GREEN);
fail_if(d < 0);
ck_assert(d < 0);
/* make specific domain permissive */
eina_log_domain_level_set("MyDomain", EINA_LOG_LEVEL_DBG);
@ -202,35 +202,35 @@ EFL_START_TEST(eina_log_domains_macros)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_CRITICAL, "A critical message");
EINA_LOG_DOM_CRIT(d, "A critical message");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_ERR <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_ERR, "An error");
EINA_LOG_DOM_ERR(d, "An error");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_WARN <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_WARN, "A warning");
EINA_LOG_DOM_WARN(d, "A warning");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_INFO <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_INFO, "An info");
EINA_LOG_DOM_INFO(d, "An info");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (EINA_LOG_LEVEL_DBG <= maxlevel)
{
TEST_LOG_CTX(EINA_LOG_LEVEL_DBG, "A debug");
EINA_LOG_DOM_DBG(d, "A debug");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
#undef TEST_LOG_CTX
@ -250,7 +250,7 @@ EFL_START_TEST(eina_log_domains_registry)
for (i = 0; i < 50; i++)
{
d[i] = eina_log_domain_register("Test", EINA_COLOR_GREEN);
fail_if(d[i] < 0);
ck_assert(d[i] < 0);
}
for (i = 0; i < 50; i++)
@ -261,7 +261,7 @@ EFL_END_TEST
EFL_START_TEST(eina_log_domains_slot_reuse)
{
fail_if(!eina_threads_init());
ck_assert(!eina_threads_init());
// Create 9 domains
int idx[9];
@ -270,7 +270,7 @@ EFL_START_TEST(eina_log_domains_slot_reuse)
for (i = 0; i < 9; i++)
{
idx[i] = eina_log_domain_register("Test1", EINA_COLOR_GREEN);
fail_if(idx[i] < 0);
ck_assert(idx[i] < 0);
}
// Slot 0 by default contains the global logger. The above code created
@ -288,7 +288,7 @@ EFL_START_TEST(eina_log_domains_slot_reuse)
int new = eina_log_domain_register("Test Slot", EINA_COLOR_GREEN);
// Check for slot reuse
fail_if(new != removed);
ck_assert(new != removed);
eina_threads_shutdown();
}
@ -299,10 +299,10 @@ EFL_START_TEST(eina_log_level_indexes)
struct log_ctx ctx;
int maxlevel;
fail_if(!eina_threads_init());
ck_assert(!eina_threads_init());
int d = eina_log_domain_register("Levels", EINA_COLOR_GREEN);
fail_if(d < 0);
ck_assert(d < 0);
eina_log_print_cb_set(_eina_test_log_domain, &ctx);
@ -326,7 +326,7 @@ EFL_START_TEST(eina_log_level_indexes)
eina_log_domain_level_set("Levels", -1);
TEST_LOG_CTX(-1, "Negative index message");
EINA_LOG(d, -1, "Negative index message");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
if (-2 <= maxlevel)
@ -334,7 +334,7 @@ EFL_START_TEST(eina_log_level_indexes)
eina_log_domain_level_set("Levels", -2);
TEST_LOG_CTX(-1, "Negative index message");
EINA_LOG(d, -1, "Negative index message");
fail_if(ctx.did);
ck_assert(ctx.did);
}
#ifdef EINA_LOG_LEVEL_MAXIMUM
if (6 <= maxlevel)
@ -343,7 +343,7 @@ EFL_START_TEST(eina_log_level_indexes)
eina_log_domain_level_set("Levels", 6);
TEST_LOG_CTX(6, "Higher level debug");
EINA_LOG(d, 6, "Higher level debug");
fail_unless(ctx.did);
ck_assert(ctx.did);
}
#endif
if (5 <= maxlevel)
@ -351,7 +351,7 @@ EFL_START_TEST(eina_log_level_indexes)
eina_log_domain_level_set("Levels", 5);
TEST_LOG_CTX(6, "Higher level debug");
EINA_LOG(d, 6, "Higher level debug");
fail_if(ctx.did);
ck_assert(ctx.did);
}
#undef TEST_LOG_CTX
@ -373,7 +373,7 @@ EFL_START_TEST(eina_log_customize)
#define test_set_get(func, val) \
eina_log_ ## func ## _set(val); \
fail_if(eina_log_ ## func ## _get() != val)
ck_assert(eina_log_ ## func ## _get() != val)
test_set_get(level, -1234);
test_set_get(level, 4567);
@ -390,19 +390,19 @@ EFL_START_TEST(eina_log_customize)
test_set_get(abort_on_critical_level, -1234);
test_set_get(abort_on_critical_level, 4567);
fail_if(eina_log_domain_level_get(TEST_DOM) != eina_log_level_get());
ck_assert(eina_log_domain_level_get(TEST_DOM) != eina_log_level_get());
eina_log_domain_level_set(TEST_DOM, -123);
fail_if(eina_log_domain_level_get(TEST_DOM) != -123);
ck_assert(eina_log_domain_level_get(TEST_DOM) != -123);
eina_log_domain_level_set(TEST_DOM, 890);
fail_if(eina_log_domain_level_get(TEST_DOM) != 890);
ck_assert(eina_log_domain_level_get(TEST_DOM) != 890);
d = eina_log_domain_register(TEST_DOM, EINA_COLOR_GREEN);
fail_if(d < 0);
ck_assert(d < 0);
fail_if(eina_log_domain_level_get(TEST_DOM) != 890);
fail_if(eina_log_domain_registered_level_get(d) != 890);
ck_assert(eina_log_domain_level_get(TEST_DOM) != 890);
ck_assert(eina_log_domain_registered_level_get(d) != 890);
eina_log_domain_unregister(d);
@ -420,8 +420,8 @@ EFL_START_TEST(eina_log_customize)
ctx.msg = "safety check failed: _log_domains[domain].deleted is true";
ctx.fnc = "eina_log_domain_registered_level_get";
ctx.did = EINA_FALSE;
fail_if(eina_log_domain_registered_level_get(d) != EINA_LOG_LEVEL_UNKNOWN);
fail_unless(ctx.did);
ck_assert(eina_log_domain_registered_level_get(d) != EINA_LOG_LEVEL_UNKNOWN);
ck_assert(ctx.did);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
#else
@ -441,7 +441,7 @@ EFL_START_TEST(eina_log_level_name)
#define tst(level, str) \
eina_log_level_name_get(level, name); \
fail_if(strcmp(name, str) != 0)
ck_assert(strcmp(name, str) != 0)
tst(0, "CRI");
tst(1, "ERR");

View File

@ -122,7 +122,7 @@ EFL_START_TEST(eina_magic_simple)
TEST_MAGIC_SAFETY("eina_magic_string_set",
"safety check failed: magic_name == NULL");
eina_magic_string_set(EINA_MAGIC_TEST2, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#ifdef SHOW_LOG
fprintf(stderr, "you should have a safety check failure below:\n");
@ -130,19 +130,19 @@ EFL_START_TEST(eina_magic_simple)
TEST_MAGIC_SAFETY("eina_magic_string_set",
"safety check failed: magic_name == NULL");
eina_magic_string_set(EINA_MAGIC_TEST2, NULL);
fail_unless(ctx.did);
ck_assert(ctx.did);
#endif
eina_magic_string_set(EINA_MAGIC_TEST2, EINA_MAGIC_STRING);
fail_if(eina_magic_string_get(EINA_MAGIC_TEST) == NULL);
fail_if(strcmp(eina_magic_string_get(
ck_assert(eina_magic_string_get(EINA_MAGIC_TEST) == NULL);
ck_assert(strcmp(eina_magic_string_get(
EINA_MAGIC_TEST), EINA_MAGIC_STRING) != 0);
eina_log_print_cb_set(_eina_test_magic_print_cb, &ctx);
#ifdef EINA_MAGIC_DEBUG
fail_if(EINA_MAGIC_CHECK(ems, EINA_MAGIC_TEST));
ck_assert(EINA_MAGIC_CHECK(ems, EINA_MAGIC_TEST));
#ifdef SHOW_LOG
fprintf(stderr, "you should see 'Input handle pointer is NULL' below\n");
#endif
@ -151,13 +151,13 @@ EFL_START_TEST(eina_magic_simple)
" Input handle pointer is NULL.\n"
"\n");
EINA_MAGIC_FAIL(ems, EINA_MAGIC_TEST);
fail_unless(ctx.did);
ck_assert(ctx.did);
ems = malloc(sizeof (Eina_Magic_Struct));
fail_if(!ems);
ck_assert(!ems);
EINA_MAGIC_SET(ems, EINA_MAGIC_TEST);
fail_if(!EINA_MAGIC_CHECK(ems, EINA_MAGIC_TEST));
ck_assert(!EINA_MAGIC_CHECK(ems, EINA_MAGIC_TEST));
EINA_MAGIC_SET(ems, EINA_MAGIC_NONE);
#ifdef SHOW_LOG
@ -170,7 +170,7 @@ EFL_START_TEST(eina_magic_simple)
"\n");
ctx.expected_level = EINA_LOG_LEVEL_CRITICAL;
EINA_MAGIC_FAIL(ems, EINA_MAGIC_TEST);
fail_unless(ctx.did);
ck_assert(ctx.did);
EINA_MAGIC_SET(ems, 42424242);
#ifdef SHOW_LOG
@ -184,7 +184,7 @@ EFL_START_TEST(eina_magic_simple)
"\n");
ctx.expected_level = EINA_LOG_LEVEL_CRITICAL;
EINA_MAGIC_FAIL(ems, EINA_MAGIC_TEST);
fail_unless(ctx.did);
ck_assert(ctx.did);
#endif
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);

View File

@ -33,7 +33,7 @@ EFL_END_TEST
EFL_START_TEST(eina_cpu)
{
fail_if(eina_cpu_count() <= 0);
ck_assert(eina_cpu_count() <= 0);
eina_cpu_features_get();
@ -42,7 +42,7 @@ EFL_END_TEST
EFL_START_TEST(eina_hamster)
{
fail_if(eina_hamster_count() <= 0);
ck_assert(eina_hamster_count() <= 0);
}
EFL_END_TEST

View File

@ -39,18 +39,18 @@ EFL_START_TEST(eina_matrix2)
eina_matrix2_values_set(&m,
1, 0,
0, 1);
fail_if(eina_matrix2_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(eina_matrix2_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
eina_matrix2_inverse(&n, &m);
fail_if(eina_matrix2_type_get(&n) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(eina_matrix2_type_get(&n) != EINA_MATRIX_TYPE_IDENTITY);
eina_matrix2_values_get(&m,
&xx, &xy,
&yx, &yy);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yy, 1));
fail_if(!EINA_DBL_EQ(xy, yx) ||
ck_assert(!EINA_DBL_EQ(xy, yx) ||
!EINA_DBL_EQ(xy, 0));
}
@ -69,23 +69,23 @@ EFL_START_TEST(eina_matrix2_operation)
eina_matrix2_values_get(&m1,
&xx, &xy,
&yx, &yy);
fail_if((xx - (-0.4) > DBL_EPSILON) || (xy - 0.6 > DBL_EPSILON) ||
ck_assert((xx - (-0.4) > DBL_EPSILON) || (xy - 0.6 > DBL_EPSILON) ||
(yx - 0.6 > DBL_EPSILON) || (yy - (-0.4) > DBL_EPSILON));
eina_matrix2_identity(&m1);
eina_matrix2_values_get(&m1,
&xx, &xy,
&yx, &yy);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yy, 1));
fail_if(!EINA_DBL_EQ(xy, yx) ||
ck_assert(!EINA_DBL_EQ(xy, yx) ||
!EINA_DBL_EQ(xy, 0));
eina_matrix2_array_set(&m1, arr);
eina_matrix2_values_get(&m1,
&xx, &xy,
&yx, &yy);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yx, xy) ||
!EINA_DBL_EQ(xy, 1));
@ -93,7 +93,7 @@ EFL_START_TEST(eina_matrix2_operation)
eina_matrix2_values_get(&m2,
&xx, &xy,
&yx, &yy);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yx, xy) ||
!EINA_DBL_EQ(xy, 1));
@ -104,7 +104,7 @@ EFL_START_TEST(eina_matrix2_operation)
eina_matrix2_values_get(&m3,
&xx, &xy,
&yx, &yy);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yx, xy) ||
!EINA_DBL_EQ(xy, 5));
@ -112,7 +112,7 @@ EFL_START_TEST(eina_matrix2_operation)
eina_matrix2_values_get(&m3,
&xx, &xy,
&yx, &yy);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yx, xy) ||
!EINA_DBL_EQ(xy, 5));
@ -134,13 +134,13 @@ EFL_START_TEST(eina_matrix4)
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1);
fail_if(eina_matrix4_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(eina_matrix4_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
fail_if(!eina_matrix4_normalized(&n, &m));
fail_if(eina_matrix4_type_get(&n) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(!eina_matrix4_normalized(&n, &m));
ck_assert(eina_matrix4_type_get(&n) != EINA_MATRIX_TYPE_IDENTITY);
fail_if(!eina_matrix4_inverse(&n, &m));
fail_if(eina_matrix4_type_get(&n) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(!eina_matrix4_inverse(&n, &m));
ck_assert(eina_matrix4_type_get(&n) != EINA_MATRIX_TYPE_IDENTITY);
eina_matrix4_values_get(&m,
&xx, &xy, &xz, &xw,
@ -148,11 +148,11 @@ EFL_START_TEST(eina_matrix4)
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yy, zz) ||
!EINA_DBL_EQ(zz, ww) ||
!EINA_DBL_EQ(ww, 1));
fail_if(!EINA_DBL_EQ(xy, xz) ||
ck_assert(!EINA_DBL_EQ(xy, xz) ||
!EINA_DBL_EQ(xz, xw) ||
!EINA_DBL_EQ(xw, yx) ||
!EINA_DBL_EQ(yx, yz) ||
@ -172,7 +172,7 @@ EFL_START_TEST(eina_matrix4)
13, 14, 15, 16);
eina_matrix4_transpose(&n, &m);
fail_if(!EINA_DBL_EQ(n.xx, 1) ||
ck_assert(!EINA_DBL_EQ(n.xx, 1) ||
!EINA_DBL_EQ(n.xy, 5) ||
!EINA_DBL_EQ(n.xz, 9) ||
!EINA_DBL_EQ(n.xw, 13) ||
@ -228,7 +228,7 @@ EFL_START_TEST(eina_matrix4_operation)
0, 0, 0, 2,
0, 2, 0, 0);
det = eina_matrix4_determinant(&m);
fail_if(!EINA_DBL_EQ(det, -16));
ck_assert(!EINA_DBL_EQ(det, -16));
eina_matrix4_inverse(&m1, &m);
eina_matrix4_values_get(&m1,
@ -341,7 +341,7 @@ EFL_START_TEST(eina_matrix4_operation)
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!MATRIX4_CMP(xx, xy, xz, xw,
ck_assert(!MATRIX4_CMP(xx, xy, xz, xw,
yx, yy, yz, yw,
zx, zy, zz, zw,
wx, wy, wz, ww,
@ -356,7 +356,7 @@ EFL_START_TEST(eina_matrix4_operation)
&yx, &yy, &yz, &yw,
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!MATRIX4_CMP(xx, xy, xz, xw,
ck_assert(!MATRIX4_CMP(xx, xy, xz, xw,
yx, yy, yz, yw,
zx, zy, zz, zw,
wx, wy, wz, ww,
@ -372,7 +372,7 @@ EFL_START_TEST(eina_matrix4_operation)
&yx, &yy, &yz, &yw,
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!MATRIX4_CMP(xx, xy, xz, xw,
ck_assert(!MATRIX4_CMP(xx, xy, xz, xw,
yx, yy, yz, yw,
zx, zy, zz, zw,
wx, wy, wz, ww,
@ -388,7 +388,7 @@ EFL_START_TEST(eina_matrix4_operation)
&yx, &yy, &yz, &yw,
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!MATRIX4_CMP(xx, xy, xz, xw,
ck_assert(!MATRIX4_CMP(xx, xy, xz, xw,
yx, yy, yz, yw,
zx, zy, zz, zw,
wx, wy, wz, ww,
@ -404,7 +404,7 @@ EFL_START_TEST(eina_matrix4_operation)
&yx, &yy, &yz, &yw,
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!MATRIX4_CMP(xx, xy, xz, xw,
ck_assert(!MATRIX4_CMP(xx, xy, xz, xw,
yx, yy, yz, yw,
zx, zy, zz, zw,
wx, wy, wz, ww,
@ -426,7 +426,7 @@ EFL_START_TEST(eina_matrix4_operation)
&yx, &yy, &yz, &yw,
&zx, &zy, &zz, &zw,
&wx, &wy, &wz, &ww);
fail_if(!MATRIX4_CMP(xx, xy, xz, xw,
ck_assert(!MATRIX4_CMP(xx, xy, xz, xw,
yx, yy, yz, yw,
zx, zy, zz, zw,
wx, wy, wz, ww,
@ -451,7 +451,7 @@ EFL_START_TEST(eina_matrix4_2_3)
eina_matrix3_matrix4_to(&m4, &m3);
eina_matrix4_matrix3_to(&m3b, &m4);
fail_if(memcmp(&m3, &m3b, sizeof (Eina_Matrix3)) != 0);
ck_assert(memcmp(&m3, &m3b, sizeof (Eina_Matrix3)) != 0);
}
EFL_END_TEST
@ -479,27 +479,27 @@ EFL_START_TEST(eina_matrix3)
1, 1, 1,
0, 1, 0,
0, 0, 1);
fail_if(eina_matrix3_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(eina_matrix3_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
eina_matrix3_values_get(&m,
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yy, zz) ||
!EINA_DBL_EQ(zz, 1));
fail_if(!EINA_DBL_EQ(xy, xz) ||
ck_assert(!EINA_DBL_EQ(xy, xz) ||
!EINA_DBL_EQ(yx, yz) ||
!EINA_DBL_EQ(zx, zy) ||
!EINA_DBL_EQ(zy, 0));
ret = eina_matrix3_equal(&m, &m1);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret = eina_matrix3_equal(&m1, &m2);
fail_if(ret != EINA_FALSE);
ck_assert(ret != EINA_FALSE);
}
EFL_END_TEST
@ -554,7 +554,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
1, 0, tx,
@ -571,7 +571,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
tx, 0, 0,
@ -599,11 +599,11 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!EINA_DBL_EQ(xx, yy) ||
ck_assert(!EINA_DBL_EQ(xx, yy) ||
!EINA_DBL_EQ(yy, zz) ||
!EINA_DBL_EQ(zz, 1));
fail_if(!EINA_DBL_EQ(xy, xz) ||
ck_assert(!EINA_DBL_EQ(xy, xz) ||
!EINA_DBL_EQ(yx, yz) ||
!EINA_DBL_EQ(zx, zy) ||
!EINA_DBL_EQ(zy, 0));
@ -613,7 +613,7 @@ EFL_START_TEST(eina_matrix3_operations)
2, 1, 1,
1, 2, 2);
ret = eina_matrix3_determinant(&m1);
fail_if(!EINA_DBL_EQ(ret, -3));
ck_assert(!EINA_DBL_EQ(ret, -3));
eina_matrix3_values_set(&m1,
3, 3, 3,
@ -641,7 +641,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
-0.5, 0.5, 0.0,
@ -657,7 +657,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
1, 4, 7,
@ -673,7 +673,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
24, 5, -4,
@ -685,7 +685,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
24, -12, -2,
@ -705,7 +705,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
12, 12, 12,
@ -721,7 +721,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
12, 12, 12,
@ -733,7 +733,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
2, 2, 2,
@ -745,7 +745,7 @@ EFL_START_TEST(eina_matrix3_operations)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(!MATRIX3_CMP(xx, xy, xz,
ck_assert(!MATRIX3_CMP(xx, xy, xz,
yx, yy, yz,
zx, zy, zz,
1, 1, 1,
@ -791,11 +791,11 @@ EFL_START_TEST(eina_matrix3_f16p16)
&xx, &xy, &xz,
&yx, &yy, &yz,
&zx, &zy, &zz);
fail_if(xx != yy ||
ck_assert(xx != yy ||
yy != zz ||
zz != 65536);
fail_if(xy != xz ||
ck_assert(xy != xz ||
yx != yz ||
zx != zy ||
zy != 0);
@ -806,11 +806,11 @@ EFL_START_TEST(eina_matrix3_f16p16)
7, 8, 9);
eina_matrix3_matrix3_f16p16_to(&m2, &m1);
eina_matrix3_f16p16_identity(&m1);
fail_if(m1.xx != m1.yy ||
ck_assert(m1.xx != m1.yy ||
m1.yy != m1.zz ||
m1.zz != 65536);
fail_if(m1.xy != m1.xz ||
ck_assert(m1.xy != m1.xz ||
m1.yx != m1.yz ||
m1.zx != m1.zy ||
m1.zy != 0);
@ -849,13 +849,13 @@ EFL_START_TEST(eina_matrix3_map_transform)
eina_matrix3_point_transform(&m,
x, y,
&x1, &y1);
fail_if(!EINA_DBL_EQ(x1, 3) ||
ck_assert(!EINA_DBL_EQ(x1, 3) ||
!EINA_DBL_EQ(y1, 2));
EINA_RECTANGLE_SET(&r, 0, 0, 3, 4);
eina_matrix3_rectangle_transform(&m, &r, &q);
fail_if(!EINA_DBL_EQ(q.x0, 0) ||
ck_assert(!EINA_DBL_EQ(q.x0, 0) ||
!EINA_DBL_EQ(q.y0, 0) ||
!EINA_DBL_EQ(q.x1, 0) ||
!EINA_DBL_EQ(q.y1, 3) ||
@ -870,9 +870,9 @@ EFL_START_TEST(eina_matrix3_map_transform)
3.0, 3.0,
0.0, 3.0);
ret = eina_matrix3_square_quad_map(&m, &q);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
fail_if(!MATRIX3_CMP(m.xx, m.xy, m.xz,
ck_assert(!MATRIX3_CMP(m.xx, m.xy, m.xz,
m.yx, m.yy, m.yz,
m.zx, m.zy, m.zz,
3, 0, 0,
@ -880,9 +880,9 @@ EFL_START_TEST(eina_matrix3_map_transform)
0, 0, 1));
ret = eina_matrix3_quad_square_map(&m, &q);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
fail_if(!EINA_DBL_EQ(q.x0, 0) ||
ck_assert(!EINA_DBL_EQ(q.x0, 0) ||
!EINA_DBL_EQ(q.y0, 0) ||
!EINA_DBL_EQ(q.x1, 3) ||
!EINA_DBL_EQ(q.y1, 0) ||
@ -914,7 +914,7 @@ EFL_START_TEST(eina_normal3_test)
&zx, &zy, &zz
);
fail_if((fabs(xy) - 1.0) > DBL_EPSILON ||
ck_assert((fabs(xy) - 1.0) > DBL_EPSILON ||
(fabs(yx) - 1.0) > DBL_EPSILON ||
(fabs(yz) - 1.0) > DBL_EPSILON ||
(fabs(zy) - 1.0) > DBL_EPSILON
@ -931,7 +931,7 @@ EFL_START_TEST(eina_normal3_test)
&yx, &yy, &yz,
&zx, &zy, &zz
);
fail_if((fabs(xy)) > DBL_EPSILON ||
ck_assert((fabs(xy)) > DBL_EPSILON ||
(fabs(yx)) > DBL_EPSILON ||
(fabs(yz)) > DBL_EPSILON ||
(fabs(zy)) > DBL_EPSILON

View File

@ -29,7 +29,7 @@ static void matrixsparse_initialize(Eina_Matrixsparse *matrix,
if (data[i][j] != 0)
{
r = eina_matrixsparse_data_idx_set(matrix, i, j, &data[i][j]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
}
}
@ -48,12 +48,12 @@ static void matrixsparse_check(Eina_Matrixsparse *matrix,
if (data[i][j] != 0)
{
test1 = eina_matrixsparse_data_idx_get(matrix, i, j);
fail_if(test1 == NULL || *test1 != data[i][j]);
ck_assert(test1 == NULL || *test1 != data[i][j]);
}
else
{
test1 = eina_matrixsparse_data_idx_get(matrix, i, j);
fail_if(test1 != NULL);
ck_assert(test1 != NULL);
}
}
}
@ -108,95 +108,95 @@ EFL_START_TEST(eina_test_simple)
matrix = eina_matrixsparse_new(MAX_ROWS, MAX_COLS,
eina_matrixsparse_free_cell_cb, data);
fail_if(matrix == NULL);
ck_assert(matrix == NULL);
r = eina_matrixsparse_cell_idx_get(matrix, 3, 5, &cell);
fail_if(r == EINA_FALSE);
fail_if(cell != NULL);
ck_assert(r == EINA_FALSE);
ck_assert(cell != NULL);
matrixsparse_initialize(matrix, data, MAX_ROWS, MAX_COLS);
/* data fetching */
test1 = eina_matrixsparse_data_idx_get(matrix, 3, 0);
fail_if(test1 == NULL);
fail_if(*test1 != data[3][0]);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[3][0]);
test1 = eina_matrixsparse_data_idx_get(matrix, 3, 5);
fail_if(test1 == NULL);
fail_if(*test1 != data[3][5]);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[3][5]);
test1 = eina_matrixsparse_data_idx_get(matrix, 3, 6);
fail_if(test1 == NULL);
fail_if(*test1 != data[3][6]);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[3][6]);
test1 = eina_matrixsparse_data_idx_get(matrix, 3, 1);
fail_if(test1 != NULL);
ck_assert(test1 != NULL);
r = eina_matrixsparse_cell_idx_get(matrix, 3, 5, &cell);
fail_if(r == EINA_FALSE);
fail_if(cell == NULL);
ck_assert(r == EINA_FALSE);
ck_assert(cell == NULL);
test1 = eina_matrixsparse_cell_data_get(cell);
fail_if(test1 == NULL);
fail_if(*test1 != data[3][5]);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[3][5]);
r = eina_matrixsparse_cell_position_get(cell, &row, &col);
fail_if(r == EINA_FALSE);
fail_if(row != 3 || col != 5);
ck_assert(r == EINA_FALSE);
ck_assert(row != 3 || col != 5);
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 3);
fail_if(test1 == NULL);
fail_if(*test1 != data[4][3]);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[4][3]);
test1 = eina_matrixsparse_data_idx_get(matrix, 1, 3);
fail_if(test1 == NULL);
fail_if(*test1 != data[1][3]);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[1][3]);
/* data changing */
r = eina_matrixsparse_data_idx_set(matrix, 1, 9, &data[1][9]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_replace(matrix, 4, 3, &value, (void **)&test1);
fail_if(r == EINA_FALSE);
fail_if(test1 == NULL);
fail_if(*test1 != data[4][3]);
ck_assert(r == EINA_FALSE);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[4][3]);
data[4][3] = value;
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 3);
fail_if(test1 == NULL || *test1 != value);
ck_assert(test1 == NULL || *test1 != value);
r = eina_matrixsparse_cell_data_replace(cell, &value2, (void **)&test1);
fail_if(r == EINA_FALSE);
fail_if(test1 == NULL);
fail_if(*test1 != data[3][5]);
ck_assert(r == EINA_FALSE);
ck_assert(test1 == NULL);
ck_assert(*test1 != data[3][5]);
data[3][5] = value2;
test1 = eina_matrixsparse_data_idx_get(matrix, 3, 5);
fail_if(test1 == NULL);
fail_if(*test1 != value2);
ck_assert(test1 == NULL);
ck_assert(*test1 != value2);
r = eina_matrixsparse_cell_idx_get(matrix, 4, 2, &cell);
fail_if(r == EINA_FALSE || cell == NULL);
ck_assert(r == EINA_FALSE || cell == NULL);
r = eina_matrixsparse_cell_data_set(cell, &value3);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[4][2] = value3;
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 2);
fail_if(test1 == NULL || *test1 != value3);
ck_assert(test1 == NULL || *test1 != value3);
r = eina_matrixsparse_data_idx_replace(matrix,
6,
5,
&value4,
(void **)&test1);
fail_if(r == EINA_FALSE || test1 != NULL);
ck_assert(r == EINA_FALSE || test1 != NULL);
data[6][5] = value4;
/* cell deletion */
r = eina_matrixsparse_row_idx_clear(matrix, 4);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[4][6] = 0;
data[4][8] = 0;
data[4][2] = 0;
@ -204,17 +204,17 @@ EFL_START_TEST(eina_test_simple)
data[4][7] = 0;
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 3);
fail_if(test1 != NULL);
ck_assert(test1 != NULL);
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 8);
fail_if(test1 != NULL);
ck_assert(test1 != NULL);
test1 = eina_matrixsparse_data_idx_get(matrix, 5, 3);
fail_if(!test1);
fail_if(*test1 != data[5][3]);
ck_assert(!test1);
ck_assert(*test1 != data[5][3]);
r = eina_matrixsparse_column_idx_clear(matrix, 3);
fail_if(r != EINA_TRUE);
ck_assert(r != EINA_TRUE);
data[0][3] = 0;
data[1][3] = 0;
data[4][3] = 0;
@ -223,45 +223,45 @@ EFL_START_TEST(eina_test_simple)
data[7][3] = 0;
r = eina_matrixsparse_cell_idx_clear(matrix, 3, 5);
fail_if(r != EINA_TRUE);
ck_assert(r != EINA_TRUE);
data[3][5] = 0;
r = eina_matrixsparse_cell_idx_clear(matrix, 3, 9);
fail_if(r != EINA_TRUE);
ck_assert(r != EINA_TRUE);
data[3][9] = 0;
r = eina_matrixsparse_cell_idx_clear(matrix, 4, 3);
fail_if(r != EINA_TRUE);
ck_assert(r != EINA_TRUE);
data[4][3] = 0;
r = eina_matrixsparse_cell_idx_get(matrix, 3, 7, &cell);
fail_if(r == EINA_FALSE);
fail_if(cell == NULL);
ck_assert(r == EINA_FALSE);
ck_assert(cell == NULL);
r = eina_matrixsparse_cell_clear(cell);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[3][7] = 0;
r = eina_matrixsparse_cell_idx_get(matrix, 2, 7, &cell);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_cell_idx_clear(matrix, 2, 8);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[2][8] = 0;
r = eina_matrixsparse_cell_idx_clear(matrix, 2, 7);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[2][7] = 0;
r = eina_matrixsparse_cell_idx_get(matrix, 7, 7, &cell);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_row_idx_clear(matrix, 8);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[8][8] = 0;
r = eina_matrixsparse_row_idx_clear(matrix, 7);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[7][3] = 0;
data[7][7] = 0;
@ -287,7 +287,7 @@ EFL_START_TEST(eina_test_resize)
matrix = eina_matrixsparse_new(MAX_ROWS, MAX_COLS,
eina_matrixsparse_free_cell_cb, data);
fail_if(matrix == NULL);
ck_assert(matrix == NULL);
/* cell insertion */
data[0][5] = 5;
@ -322,10 +322,10 @@ EFL_START_TEST(eina_test_resize)
matrixsparse_initialize(matrix, data, MAX_ROWS, MAX_COLS);
eina_matrixsparse_size_get(matrix, &nrows, &ncols);
fail_if(nrows != MAX_ROWS || ncols != MAX_COLS);
ck_assert(nrows != MAX_ROWS || ncols != MAX_COLS);
r = eina_matrixsparse_size_set(matrix, nrows - 2, ncols - 2);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[1][9] = 0;
data[1][8] = 0;
data[2][8] = 0;
@ -335,7 +335,7 @@ EFL_START_TEST(eina_test_resize)
matrixsparse_check(matrix, data, MAX_ROWS, MAX_COLS);
r = eina_matrixsparse_size_set(matrix, 5, 1);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[0][5] = 0;
data[1][3] = 0;
data[1][6] = 0;
@ -358,21 +358,21 @@ EFL_START_TEST(eina_test_resize)
matrixsparse_check(matrix, data, MAX_ROWS, MAX_COLS);
r = eina_matrixsparse_size_set(matrix, 1, 1);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[3][0] = 0;
data[1][0] = 0;
matrixsparse_check(matrix, data, MAX_ROWS, MAX_COLS);
r = eina_matrixsparse_size_set(matrix, 5, 4);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 4, 2, &data[4][2]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[4][2] = 42;
matrixsparse_check(matrix, data, MAX_ROWS, MAX_COLS);
r = eina_matrixsparse_size_set(matrix, 5, 1);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
data[4][2] = 0;
matrixsparse_check(matrix, data, MAX_ROWS, MAX_COLS);
@ -407,69 +407,69 @@ EFL_START_TEST(eina_test_iterators)
matrix = eina_matrixsparse_new(MAX_ROWS, MAX_COLS,
eina_matrixsparse_free_cell_cb, data);
fail_if(matrix == NULL);
ck_assert(matrix == NULL);
r = eina_matrixsparse_data_idx_set(matrix, 3, 5, &data[3][5]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 3, 6, &data[3][6]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 3, 7, &data[3][7]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 3, 9, &data[3][9]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 3, 0, &data[3][0]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 4, 6, &data[4][6]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 4, 8, &data[4][8]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 4, 2, &data[4][2]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 4, 3, &data[4][3]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 4, 7, &data[4][7]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 6, 4, &data[6][4]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 5, 3, &data[5][3]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 6, 3, &data[6][3]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 7, 3, &data[7][3]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 0, 3, &data[0][3]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 1, 3, &data[1][3]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 1, 6, &data[1][6]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_matrixsparse_data_idx_set(matrix, 1, 9, &data[1][9]);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
it = eina_matrixsparse_iterator_new(matrix);
fail_if(it == NULL);
ck_assert(it == NULL);
EINA_ITERATOR_FOREACH(it, cell)
{
fail_if(cell == NULL);
ck_assert(cell == NULL);
r = eina_matrixsparse_cell_position_get(cell, &row, &col);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
test1 = eina_matrixsparse_cell_data_get(cell);
fail_if(test1 == NULL || *test1 != data[row][col]);
ck_assert(test1 == NULL || *test1 != data[row][col]);
}
eina_iterator_free(it);
it = eina_matrixsparse_iterator_complete_new(matrix);
fail_if(it == NULL);
ck_assert(it == NULL);
EINA_ITERATOR_FOREACH(it, cell)
{
fail_if(cell == NULL);
ck_assert(cell == NULL);
r = eina_matrixsparse_cell_position_get(cell, &row, &col);
fail_if(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
test1 = eina_matrixsparse_cell_data_get(cell);
if (test1)
fail_if(*test1 != data[row][col]);
ck_assert(*test1 != data[row][col]);
}
eina_iterator_free(it);

View File

@ -33,25 +33,25 @@ _eina_mempool_test(Eina_Mempool *mp,
int *ptr;
int i;
fail_if(!mp);
ck_assert(!mp);
for (i = 0; i < 512; ++i)
{
tbl[i] = eina_mempool_malloc(mp, sizeof (int));
fail_if(!tbl[i]);
ck_assert(!tbl[i]);
if (accurate_from)
fail_if(eina_mempool_from(mp, tbl[i]) != EINA_TRUE);
ck_assert(eina_mempool_from(mp, tbl[i]) != EINA_TRUE);
*tbl[i] = i;
}
for (i = 0; i < 512; ++i)
fail_if(*tbl[i] != i);
ck_assert(*tbl[i] != i);
for (i = 0; i < 256; ++i)
{
eina_mempool_free(mp, tbl[i]);
if (accurate_from)
fail_if(eina_mempool_from(mp, tbl[i]) != EINA_FALSE);
ck_assert(eina_mempool_from(mp, tbl[i]) != EINA_FALSE);
}
it = eina_mempool_iterator_new(mp);
@ -69,9 +69,9 @@ _eina_mempool_test(Eina_Mempool *mp,
}
if (with_realloc)
fail_if(eina_mempool_realloc(mp, tbl[500], 25) == NULL);
ck_assert(eina_mempool_realloc(mp, tbl[500], 25) == NULL);
else
fail_if(eina_mempool_realloc(mp, tbl[500], 25) != NULL);
ck_assert(eina_mempool_realloc(mp, tbl[500], 25) != NULL);
if (with_gc)
{

View File

@ -32,14 +32,14 @@ static Eina_Bool list_cb(Eina_Module *m, void *data EINA_UNUSED)
const char *file;
/* the reference count */
fail_if(!eina_module_load(m));
ck_assert(!eina_module_load(m));
/* get */
sym = eina_module_symbol_get(m, "dummy_symbol");
fail_if(!sym);
fail_if(*sym != 0xbad);
ck_assert(!sym);
ck_assert(*sym != 0xbad);
file = eina_module_file_get(m);
fail_if(!file);
fail_if(eina_module_unload(m));
ck_assert(!file);
ck_assert(eina_module_unload(m));
return EINA_TRUE;
}
@ -57,7 +57,7 @@ EFL_START_TEST(eina_module_load_unload)
EINA_TRUE,
&list_cb,
NULL);
fail_if(!_modules);
ck_assert(!_modules);
eina_module_list_load(_modules);
eina_module_list_unload(_modules);
eina_module_list_free(_modules);
@ -76,8 +76,8 @@ EFL_START_TEST(eina_module_find_test)
EINA_TRUE,
&list_cb,
NULL);
fail_if(!_modules);
fail_if(eina_module_find(_modules, NULL) != NULL);
ck_assert(!_modules);
ck_assert(eina_module_find(_modules, NULL) != NULL);
}
EFL_END_TEST

View File

@ -99,13 +99,13 @@ EFL_START_TEST(eina_quadtree_collision)
_eina_quadtree_rectangle_vert,
_eina_quadtree_rectangle_hort);
fail_if(!q);
ck_assert(!q);
for (i = 0; objects[i].r.w != 0 && objects[i].r.h != 0; ++i)
{
objects[i].item = eina_quadtree_add(q, &objects[i].r);
fail_if(!objects[i].item);
fail_if(!eina_quadtree_show(objects[i].item));
ck_assert(!objects[i].item);
ck_assert(!eina_quadtree_show(objects[i].item));
}
eina_quadtree_resize(q, 640, 480);
@ -128,12 +128,12 @@ EFL_START_TEST(eina_quadtree_collision)
if (&objects[tests[i].result[k]].r == r)
break;
}
fail_if(k == tests[i].count);
ck_assert(k == tests[i].count);
head = head->next;
count++;
}
fail_if(count != tests[i].count);
ck_assert(count != tests[i].count);
}
for (i = 0; i < (int)(sizeof (hidden) / sizeof (int)); ++i)
@ -150,12 +150,12 @@ EFL_START_TEST(eina_quadtree_collision)
{
r = eina_quadtree_object(head);
fail_if(r != &objects[tests[1].result[show[count]]].r);
ck_assert(r != &objects[tests[1].result[show[count]]].r);
head = head->next;
count++;
}
fail_if(count != 3);
ck_assert(count != 3);
eina_quadtree_cycle(q);
eina_quadtree_show(objects[4].item);
@ -180,7 +180,7 @@ EFL_START_TEST(eina_quadtree_collision)
head = head->next;
count++;
}
fail_if(count != 1);
ck_assert(count != 1);
eina_quadtree_free(q);

View File

@ -98,7 +98,7 @@ EFL_START_TEST(eina_test_quaternion_norm)
double result = eina_quaternion_norm(&q);
fail_if(!EINA_FLT_EQ(result, sqrt(51)));
ck_assert(!EINA_FLT_EQ(result, sqrt(51)));
}
EFL_END_TEST
@ -113,8 +113,8 @@ EFL_START_TEST(eina_test_quaternion_conjugate)
eina_quaternion_conjugate(&t1, &q1);
eina_quaternion_conjugate(&t2, &q2);
fail_if(!eina_quaternion_cmp(&t1, &r1));
fail_if(!eina_quaternion_cmp(&t2, &r2));
ck_assert(!eina_quaternion_cmp(&t1, &r1));
ck_assert(!eina_quaternion_cmp(&t2, &r2));
}
EFL_END_TEST
@ -133,10 +133,10 @@ EFL_START_TEST(eina_test_quaternion_matrix)
eina_quaternion_rotation_matrix3_get(&tm, &q);
fail_if(!eina_matrix3_cmp(&tm, &m));
ck_assert(!eina_matrix3_cmp(&tm, &m));
eina_matrix3_quaternion_get(&tq, &m);
fail_if(!eina_quaternion_cmp(&tq, &q) && !eina_quaternion_cmp(&tq, &q1));
ck_assert(!eina_quaternion_cmp(&tq, &q) && !eina_quaternion_cmp(&tq, &q1));
}
EFL_END_TEST
@ -151,7 +151,7 @@ EFL_START_TEST(eina_test_quaternion_op)
eina_quaternion_negative(&neg, &q);
eina_quaternion_add(&r, &q, &neg);
fail_if(!eina_quaternion_cmp(&z, &r));
ck_assert(!eina_quaternion_cmp(&z, &r));
}
EFL_END_TEST
@ -167,32 +167,32 @@ EFL_START_TEST(eina_test_quaternion_f16p16)
eina_quaternion_f16p16_set(&p, x, y, z, w);
fail_if(!eina_quaternion_cmp(&p, &q));
ck_assert(!eina_quaternion_cmp(&p, &q));
res = eina_quaternion_f16p16_norm(&r);
fail_if(res != 131070);
ck_assert(res != 131070);
eina_quaternion_f16p16_negative(&s, &r);
fail_if(s.x != s.y ||
ck_assert(s.x != s.y ||
s.y != s.z ||
s.z != s.w ||
s.w != -65536);
eina_quaternion_f16p16_add(&t, &s, &r);
fail_if(t.x != t.y ||
ck_assert(t.x != t.y ||
t.y != t.z ||
t.z != t.w ||
t.w != 0);
res = 1;
eina_quaternion_f16p16_scale(&t, &r, res);
fail_if(t.x != t.y ||
ck_assert(t.x != t.y ||
t.y != t.z ||
t.z != t.w ||
t.w != 65536);
eina_quaternion_f16p16_conjugate(&t, &r);
fail_if(t.x != -65536 ||
ck_assert(t.x != -65536 ||
t.y != -65536 ||
t.z != -65536 ||
t.w != 65536);
@ -202,10 +202,10 @@ EFL_START_TEST(eina_test_quaternion_f16p16)
s.z = 65536;
s.w = 65536;
res = eina_quaternion_f16p16_dot(&s, &r);
fail_if(res != 262144);
ck_assert(res != 262144);
eina_quaternion_f16p16_mul(&t, &s, &r);
fail_if(t.x != 131072 ||
ck_assert(t.x != 131072 ||
t.y != 131072 ||
t.z != 131072 ||
t.w != 0);
@ -220,7 +220,7 @@ EFL_START_TEST(eina_test_quaternion_dot)
res = eina_quaternion_dot(&q, &r);
fail_if(!EINA_DBL_EQ(res, 59));
ck_assert(!EINA_DBL_EQ(res, 59));
}
EFL_END_TEST
@ -233,7 +233,7 @@ EFL_START_TEST(eina_test_quaternion_scale)
eina_quaternion_scale(&r, &q, scale);
fail_if(!eina_quaternion_cmp(&r, &res));
ck_assert(!eina_quaternion_cmp(&r, &res));
}
EFL_END_TEST
@ -245,7 +245,7 @@ EFL_START_TEST(eina_test_quaternion_set)
eina_quaternion_set(&q, 1, 3, 4, 5);
fail_if(!eina_quaternion_cmp(&q, &r));
ck_assert(!eina_quaternion_cmp(&q, &r));
}
EFL_END_TEST
@ -258,7 +258,7 @@ EFL_START_TEST(eina_test_quaternion_mul)
eina_quaternion_mul(&r, &p, &q);
fail_if(!eina_quaternion_cmp(&r, &res));
ck_assert(!eina_quaternion_cmp(&r, &res));
}
EFL_END_TEST
@ -280,7 +280,7 @@ EFL_START_TEST(eina_test_matrix_recompose)
&scale,
&skew);
fail_if(eina_matrix4_type_get(&m4) != EINA_MATRIX_TYPE_IDENTITY);
ck_assert(eina_matrix4_type_get(&m4) != EINA_MATRIX_TYPE_IDENTITY);
}
EFL_END_TEST
@ -292,7 +292,7 @@ EFL_START_TEST(eina_test_quaternion_normalized)
eina_quaternion_normalized(&res, &p);
fail_if(!eina_quaternion_cmp(&q, &res));
ck_assert(!eina_quaternion_cmp(&q, &res));
}
EFL_END_TEST
@ -316,7 +316,7 @@ EFL_START_TEST(eina_test_matrix_quaternion)
eina_matrix3_scale(&m3, 4, 5);
eina_matrix3_matrix4_to(&m4, &m3);
fail_if(!eina_matrix4_quaternion_to(&rotation,
ck_assert(!eina_matrix4_quaternion_to(&rotation,
&perspective,
&translation,
&scale,
@ -332,13 +332,13 @@ EFL_START_TEST(eina_test_matrix_quaternion)
eina_matrix4_matrix3_to(&m3r, &m4r);
fail_if(!eina_point_3d_cmp(&scale, &rsc));
fail_if(!eina_point_3d_cmp(&translation, &rt));
fail_if(!eina_quaternion_cmp(&perspective, &rp));
fail_if(!eina_quaternion_cmp(&rotation, &rr));
ck_assert(!eina_point_3d_cmp(&scale, &rsc));
ck_assert(!eina_point_3d_cmp(&translation, &rt));
ck_assert(!eina_quaternion_cmp(&perspective, &rp));
ck_assert(!eina_quaternion_cmp(&rotation, &rr));
// Disable this test for the moment as it seems a rounding issue
// fail_if(!eina_matrix3_cmp(&m3r, &m3));
// ck_assert(!eina_matrix3_cmp(&m3r, &m3));
}
EFL_END_TEST
@ -353,19 +353,19 @@ EFL_START_TEST(eina_test_quaternion_f16p16_lerp)
eina_quaternion_f16p16_lerp(&r, &p, &q, 65536);
fail_if(!eina_quaternion_f16p16_cmp(&r, &res1));
ck_assert(!eina_quaternion_f16p16_cmp(&r, &res1));
eina_quaternion_f16p16_lerp(&r, &p, &q, 0);
fail_if(!eina_quaternion_f16p16_cmp(&r, &res2));
ck_assert(!eina_quaternion_f16p16_cmp(&r, &res2));
eina_quaternion_f16p16_slerp(&r, &p, &q, 0);
fail_if(!eina_quaternion_f16p16_cmp(&r, &res2));
ck_assert(!eina_quaternion_f16p16_cmp(&r, &res2));
eina_quaternion_f16p16_slerp(&r, &p, &q, 65536);
fail_if(!eina_quaternion_f16p16_cmp(&r, &res1));
ck_assert(!eina_quaternion_f16p16_cmp(&r, &res1));
eina_quaternion_f16p16_nlerp(&r, &p, &q, 0);
fail_if(!eina_quaternion_f16p16_cmp(&r, &res2));
ck_assert(!eina_quaternion_f16p16_cmp(&r, &res2));
eina_quaternion_f16p16_nlerp(&r, &p, &q, 65536);
fail_if(!eina_quaternion_f16p16_cmp(&r, &res1));
ck_assert(!eina_quaternion_f16p16_cmp(&r, &res1));
}
EFL_END_TEST
@ -378,28 +378,28 @@ EFL_START_TEST(eina_test_quaternion_lerp)
eina_quaternion_lerp(&rr, &rp, &rq, 0.5);
fail_if(!eina_quaternion_cmp(&rr, &res));
ck_assert(!eina_quaternion_cmp(&rr, &res));
eina_quaternion_set(&rp, 1, 1, 1, 0);
eina_quaternion_set(&rq, 0, 1, 1, 0);
eina_quaternion_set(&res, 0.5, 1.0, 1.0, 0.0);
eina_quaternion_lerp(&rr, &rp, &rq, 0.5);
fail_if(!eina_quaternion_cmp(&rr, &res));
ck_assert(!eina_quaternion_cmp(&rr, &res));
eina_quaternion_set(&rp, 0, 0, 1, 0);
eina_quaternion_set(&rq, 1, 1, 1, 0);
eina_quaternion_set(&res, 0.5, 0.5, 1.0, 0.0);
eina_quaternion_slerp(&rr, &rp, &rq, 0.5);
fail_if(!eina_quaternion_cmp(&rr, &res));
ck_assert(!eina_quaternion_cmp(&rr, &res));
eina_quaternion_set(&rp, 0, 0, 0, 0);
eina_quaternion_set(&rq, 1, 1, 1, 0);
eina_quaternion_set(&res, 1.0, 1.0, 1.0, 0.0);
eina_quaternion_nlerp(&rr, &rp, &rq, 1.0);
fail_if(!eina_quaternion_cmp(&rr, &res));
ck_assert(!eina_quaternion_cmp(&rr, &res));
}
EFL_END_TEST
@ -415,12 +415,12 @@ EFL_START_TEST(eina_test_quaternion_f16p16_rotate_matrix)
eina_quaternion_f16p16_rotate(&r, &c, &q);
fail_if(r.x != res.x ||
ck_assert(r.x != res.x ||
r.y != res.y ||
r.z != res.z);
eina_quaternion_f16p16_rotation_matrix3_get(&m, &q);
fail_if(!eina_matrix3_f16p16_cmp(&m, &mres));
ck_assert(!eina_matrix3_f16p16_cmp(&m, &mres));
}
EFL_END_TEST
@ -434,11 +434,11 @@ EFL_START_TEST(eina_test_quaternion_rotate)
eina_quaternion_rotate(&r, &c, &q);
fail_if(!eina_point_3d_cmp(&r, &res));
ck_assert(!eina_point_3d_cmp(&r, &res));
eina_quaternion_set(&q, 1, 1, 0, 0);
eina_quaternion_rotate(&r, &c, &q);
fail_if(!eina_point_3d_cmp(&r, &res1));
ck_assert(!eina_point_3d_cmp(&r, &res1));
}
EFL_END_TEST
@ -453,32 +453,32 @@ EFL_START_TEST(eina_test_quaternion_operations)
Eina_Matrix4 m;
eina_quaternion_inverse(&out, &in);
fail_if((out.x + 0.2 > DBL_EPSILON) || (out.y + 0.2 > DBL_EPSILON) ||
ck_assert((out.x + 0.2 > DBL_EPSILON) || (out.y + 0.2 > DBL_EPSILON) ||
(out.z + 0.1 > DBL_EPSILON) || (out.w - 0.1 > DBL_EPSILON));
eina_quaternion_array_set(&out, v);
fail_if((!EINA_DBL_EQ(out.x, 0)) || (!EINA_DBL_EQ(out.y, 1)) ||
ck_assert((!EINA_DBL_EQ(out.x, 0)) || (!EINA_DBL_EQ(out.y, 1)) ||
(!EINA_DBL_EQ(out.z, 2)) || (!EINA_DBL_EQ(out.w, 3)));
eina_quaternion_copy(&out, &in);
fail_if((!EINA_DBL_EQ(out.x, 2)) || (!EINA_DBL_EQ(out.y, 2)) ||
ck_assert((!EINA_DBL_EQ(out.x, 2)) || (!EINA_DBL_EQ(out.y, 2)) ||
(!EINA_DBL_EQ(out.z, 1)) || (!EINA_DBL_EQ(out.w, 1)));
eina_quaternion_homogeneous_regulate(&out, &in2);
fail_if((!EINA_DBL_EQ(out.x, 1)) || (!EINA_DBL_EQ(out.y, 1)) ||
ck_assert((!EINA_DBL_EQ(out.x, 1)) || (!EINA_DBL_EQ(out.y, 1)) ||
(!EINA_DBL_EQ(out.z, 1)) || (!EINA_DBL_EQ(out.w, 1)));
eina_quaternion_subtract(&out, &in2, &in);
fail_if((!EINA_DBL_EQ(out.x, 3)) || (!EINA_DBL_EQ(out.y, 3)) ||
ck_assert((!EINA_DBL_EQ(out.x, 3)) || (!EINA_DBL_EQ(out.y, 3)) ||
(!EINA_DBL_EQ(out.z, 4)) || (!EINA_DBL_EQ(out.w, 4)));
fail_if(!EINA_DBL_EQ(eina_quaternion_length_get(&in2), 10));
fail_if(!EINA_DBL_EQ(eina_quaternion_length_square_get(&in), 10));
fail_if((eina_quaternion_distance_get(&in2, &in) - sqrt(50)) > DBL_EPSILON);
fail_if(!EINA_DBL_EQ(eina_quaternion_distance_square_get(&in2, &in), 50));
ck_assert(!EINA_DBL_EQ(eina_quaternion_length_get(&in2), 10));
ck_assert(!EINA_DBL_EQ(eina_quaternion_length_square_get(&in), 10));
ck_assert((eina_quaternion_distance_get(&in2, &in) - sqrt(50)) > DBL_EPSILON);
ck_assert(!EINA_DBL_EQ(eina_quaternion_distance_square_get(&in2, &in), 50));
angle = eina_quaternion_angle_plains(&in, &in2);
fail_if(angle - 0.963 > DBL_EPSILON);
ck_assert(angle - 0.963 > DBL_EPSILON);
eina_matrix4_values_set(&m,
1, 0, 0, 0,
@ -486,7 +486,7 @@ EFL_START_TEST(eina_test_quaternion_operations)
0, 0, 1, 0,
0, 0, 0, 1);
eina_quaternion_transform(&out, &in, &m);
fail_if((fabs(out.x) - 2.0) > DBL_EPSILON ||
ck_assert((fabs(out.x) - 2.0) > DBL_EPSILON ||
(fabs(out.y) - 2.0) > DBL_EPSILON ||
(fabs(out.z) - 1.0) > DBL_EPSILON ||
(fabs(out.w) - 1.0) > DBL_EPSILON
@ -498,7 +498,7 @@ EFL_START_TEST(eina_test_quaternion_operations)
0, 0, 1, 0,
0, 0, 0, 1);
eina_quaternion_transform(&out, &in, &m);
fail_if((fabs(out.x) - 1.0) > DBL_EPSILON ||
ck_assert((fabs(out.x) - 1.0) > DBL_EPSILON ||
(fabs(out.y) - 1.0) > DBL_EPSILON ||
(fabs(out.z) - 1.0) > DBL_EPSILON ||
(fabs(out.w) - 1.0) > DBL_EPSILON

View File

@ -226,7 +226,7 @@ _eina_rbtree_black_height(Eina_Rbtree *tree, Eina_Rbtree_Cmp_Node_Cb cmp)
right = tree->son[EINA_RBTREE_RIGHT];
/* Consecutive red links. */
fail_if(_eina_rbtree_is_red(tree) &&
ck_assert(_eina_rbtree_is_red(tree) &&
(_eina_rbtree_is_red(left) || _eina_rbtree_is_red(right)));
left_height = _eina_rbtree_black_height(left, cmp);
@ -236,20 +236,20 @@ _eina_rbtree_black_height(Eina_Rbtree *tree, Eina_Rbtree_Cmp_Node_Cb cmp)
if (left)
{
dir = cmp(tree, left, NULL);
fail_if(dir != EINA_RBTREE_LEFT);
ck_assert(dir != EINA_RBTREE_LEFT);
}
if (right)
{
dir = cmp(tree, right, NULL);
fail_if(dir != EINA_RBTREE_RIGHT);
ck_assert(dir != EINA_RBTREE_RIGHT);
}
/* Check black height */
if (left_height != right_height)
fprintf(stderr, "%i != %i\n", left_height, right_height);
fail_if(left_height != right_height);
ck_assert(left_height != right_height);
return _eina_rbtree_is_red(tree) ? left_height : left_height + 1;
}
@ -266,8 +266,8 @@ eina_rbtree_int_cmp(const Eina_Rbtree_Int *left,
const Eina_Rbtree_Int *right,
EINA_UNUSED void *data)
{
fail_if(!left);
fail_if(!right);
ck_assert(!left);
ck_assert(!right);
if (left->value < right->value)
return EINA_RBTREE_LEFT;
@ -281,7 +281,7 @@ eina_rbtree_int_key(const Eina_Rbtree_Int *node,
EINA_UNUSED int length,
EINA_UNUSED void *data)
{
fail_if(!node);
ck_assert(!node);
return node->value - *key;
}
@ -351,7 +351,7 @@ EFL_START_TEST(eina_rbtree_lookup)
EINA_RBTREE_CMP_KEY_CB(
eina_rbtree_int_key),
NULL);
fail_if(!item);
ck_assert(!item);
i = 42;
item =
@ -361,7 +361,7 @@ EFL_START_TEST(eina_rbtree_lookup)
EINA_RBTREE_CMP_KEY_CB(
eina_rbtree_int_key),
NULL);
fail_if(item);
ck_assert(item);
free(mem);
}
EFL_END_TEST
@ -380,7 +380,7 @@ EFL_START_TEST(eina_rbtree_remove)
mem = _eina_rbtree_int_init(num_nodes);
ea = eina_array_new(num_nodes);
fail_if(!ea);
ck_assert(!ea);
for (i = 0; i < num_nodes; ++i)
@ -410,7 +410,7 @@ EFL_START_TEST(eina_rbtree_remove)
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
}
fail_if(root != NULL);
ck_assert(root != NULL);
eina_array_free(ea);
free(mem);
}
@ -435,7 +435,7 @@ EFL_START_TEST(eina_rbtree_simple_remove)
_eina_rbtree_black_height(root,
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
fail_if(root == NULL);
ck_assert(root == NULL);
i = 69;
lookup = eina_rbtree_inline_lookup(root,
@ -445,7 +445,7 @@ EFL_START_TEST(eina_rbtree_simple_remove)
eina_rbtree_int_key),
NULL);
_eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
fail_if(lookup == NULL);
ck_assert(lookup == NULL);
root =
eina_rbtree_inline_remove(root, lookup, EINA_RBTREE_CMP_NODE_CB(
@ -475,7 +475,7 @@ EFL_START_TEST(eina_rbtree_simple_remove2)
_eina_rbtree_black_height(root,
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
fail_if(root == NULL);
ck_assert(root == NULL);
i = 69;
lookup = eina_rbtree_inline_lookup(root,
@ -485,7 +485,7 @@ EFL_START_TEST(eina_rbtree_simple_remove2)
eina_rbtree_int_key),
NULL);
_eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
fail_if(lookup == NULL);
ck_assert(lookup == NULL);
root =
eina_rbtree_inline_remove(root, lookup, EINA_RBTREE_CMP_NODE_CB(
@ -528,7 +528,7 @@ EFL_START_TEST(eina_rbtree_simple_remove3)
_eina_rbtree_black_height(root,
EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
fail_if(root == NULL);
ck_assert(root == NULL);
i = 1113497590;
lookup = eina_rbtree_inline_lookup(root,
@ -538,7 +538,7 @@ EFL_START_TEST(eina_rbtree_simple_remove3)
eina_rbtree_int_key),
NULL);
_eina_rbtree_black_height(root, EINA_RBTREE_CMP_NODE_CB(eina_rbtree_int_cmp));
fail_if(lookup == NULL);
ck_assert(lookup == NULL);
root =
eina_rbtree_inline_remove(root, lookup, EINA_RBTREE_CMP_NODE_CB(

View File

@ -37,34 +37,34 @@ EFL_START_TEST(eina_rectangle_pool)
pool = eina_rectangle_pool_new(256, 256);
fail_if(pool == NULL);
ck_assert(pool == NULL);
eina_rectangle_pool_data_set(pool, rects);
fail_if(eina_rectangle_pool_data_get(pool) != rects);
ck_assert(eina_rectangle_pool_data_get(pool) != rects);
fail_if(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
ck_assert(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
for (x = 0; x < 8; x++)
for (y = 0; y < 8; y++)
{
rects[x][y] = eina_rectangle_pool_request(pool, 32, 32);
fail_if(rects[x][y] == NULL);
ck_assert(rects[x][y] == NULL);
}
fail_if(eina_rectangle_pool_count(pool) != 64);
ck_assert(eina_rectangle_pool_count(pool) != 64);
fail_if(eina_rectangle_pool_get(rects[0][0]) != pool);
ck_assert(eina_rectangle_pool_get(rects[0][0]) != pool);
fail_if(eina_rectangle_pool_geometry_get(pool, &w, &h) != EINA_TRUE);
fail_if(w != 256 || h != 256);
ck_assert(eina_rectangle_pool_geometry_get(pool, &w, &h) != EINA_TRUE);
ck_assert(w != 256 || h != 256);
fail_if(eina_rectangle_pool_request(pool, 32, 32) != NULL);
fail_if(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
ck_assert(eina_rectangle_pool_request(pool, 32, 32) != NULL);
ck_assert(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
for (x = 0; x < 8; x++)
eina_rectangle_pool_release(rects[0][x]);
fail_if(eina_rectangle_pool_request(pool, 16, 16) == NULL);
ck_assert(eina_rectangle_pool_request(pool, 16, 16) == NULL);
eina_rectangle_pool_free(pool);
@ -82,31 +82,31 @@ EFL_START_TEST(eina_rectangle_pool_skyline)
pool = eina_rectangle_pool_new(256, 256);
fail_if(pool == NULL);
ck_assert(pool == NULL);
eina_rectangle_pool_packing_set(pool, Eina_Packing_Bottom_Left_Skyline_Improved);
eina_rectangle_pool_data_set(pool, rects);
fail_if(eina_rectangle_pool_data_get(pool) != rects);
ck_assert(eina_rectangle_pool_data_get(pool) != rects);
fail_if(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
ck_assert(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
for (x = 0; x < 8; x++)
for (y = 0; y < 8; y++)
{
rects[x][y] = eina_rectangle_pool_request(pool, 32, 32);
fail_if(rects[x][y] == NULL);
ck_assert(rects[x][y] == NULL);
}
fail_if(eina_rectangle_pool_count(pool) != 64);
ck_assert(eina_rectangle_pool_count(pool) != 64);
fail_if(eina_rectangle_pool_get(rects[0][0]) != pool);
ck_assert(eina_rectangle_pool_get(rects[0][0]) != pool);
fail_if(eina_rectangle_pool_geometry_get(pool, &w, &h) != EINA_TRUE);
fail_if(w != 256 || h != 256);
ck_assert(eina_rectangle_pool_geometry_get(pool, &w, &h) != EINA_TRUE);
ck_assert(w != 256 || h != 256);
fail_if(eina_rectangle_pool_request(pool, 32, 32) != NULL);
fail_if(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
ck_assert(eina_rectangle_pool_request(pool, 32, 32) != NULL);
ck_assert(eina_rectangle_pool_request(pool, 1024, 1024) != NULL);
for (x = 0; x < 8; x++)
eina_rectangle_pool_release(rects[0][x]);
@ -133,56 +133,56 @@ EFL_START_TEST(eina_rectangle_union_intersect)
rd = r1;
fail_if(eina_rectangle_intersection(&rd, &r3));
fail_if(!eina_rectangle_intersection(&rd, &r2));
ck_assert(eina_rectangle_intersection(&rd, &r3));
ck_assert(!eina_rectangle_intersection(&rd, &r2));
fail_if(rd.x != r2.x
ck_assert(rd.x != r2.x
|| rd.y != r2.y
|| rd.w != r2.w
|| rd.h != r2.h);
rd = r1;
fail_if(!eina_rectangle_intersection(&rd, &r4));
ck_assert(!eina_rectangle_intersection(&rd, &r4));
fail_if(rd.x != 30
ck_assert(rd.x != 30
|| rd.y != 30
|| rd.w != 30
|| rd.h != 30);
rd = r1;
eina_rectangle_union(&rd, &r2);
fail_if(rd.x != r1.x
ck_assert(rd.x != r1.x
|| rd.y != r1.y
|| rd.w != r1.w
|| rd.h != r1.h);
rd = r6;
fail_if(eina_rectangle_intersection(&rd, &r5));
ck_assert(eina_rectangle_intersection(&rd, &r5));
rd = r7;
fail_if(eina_rectangle_intersection(&rd, &r3));
ck_assert(eina_rectangle_intersection(&rd, &r3));
rd = r8;
fail_if(eina_rectangle_intersection(&rd, &r3));
ck_assert(eina_rectangle_intersection(&rd, &r3));
rd = r1;
eina_rectangle_union(&rd, &r3);
fail_if(rd.x != 0
ck_assert(rd.x != 0
|| rd.y != 0
|| rd.w != 60
|| rd.h != 60);
rd = r3;
eina_rectangle_union(&rd, &r4);
fail_if(rd.x != 0
ck_assert(rd.x != 0
|| rd.y != 0
|| rd.w != 80
|| rd.h != 80);
rd = r5;
eina_rectangle_union(&rd, &r6);
fail_if(rd.x != 10
ck_assert(rd.x != 10
|| rd.y != 10
|| rd.w != 20
|| rd.h != 20);

View File

@ -61,7 +61,7 @@ EFL_START_TEST(eina_test_sched_prio_drop)
r = eina_thread_create(&tid, EINA_THREAD_NORMAL, -1, _thread_run, NULL);
fail_unless(r);
ck_assert(r);
niceval2 = getpriority(PRIO_PROCESS, 0);
/* niceness of main thread should not have changed */

View File

@ -92,7 +92,7 @@ EFL_START_TEST(eina_simple_xml_parser_null_node_dump)
{
char *out = eina_simple_xml_node_dump(NULL, " ");
fail_if(out != NULL);
ck_assert(out != NULL);
}
EFL_END_TEST
@ -104,9 +104,9 @@ EFL_START_TEST(eina_simple_xml_parser_childs_count)
"<test version=\"0.1\"><child>I'm a child.</child><child><![CDATA[I'm a 2-nd child.]]></child><!-- Some comment --></test>";
const int sz = strlen(buf);
Eina_Simple_XML_Node_Root *root = eina_simple_xml_node_load(buf, sz, EINA_TRUE);
fail_if(root == NULL);
fail_if(root->children == NULL);
fail_if(eina_inlist_count(root->children) != 2);
ck_assert(root == NULL);
ck_assert(root->children == NULL);
ck_assert(eina_inlist_count(root->children) != 2);
eina_simple_xml_node_root_free(root);
}
@ -142,73 +142,73 @@ eina_simple_xml_parser_parse_with_custom_callback_tag_cb(void *data,
{
if (!strncmp("gpx ", content, strlen("gpx ")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_begin);
ck_assert(*parse_current_state != simple_xml_parser_current_state_begin);
*parse_current_state = simple_xml_parser_current_state_gpx;
}
else if (!strncmp("metadata>", content, strlen("metadata>")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_gpx);
ck_assert(*parse_current_state != simple_xml_parser_current_state_gpx);
*parse_current_state = simple_xml_parser_current_state_metadata;
}
else if (!strncmp("link ", content, strlen("link ")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_metadata);
ck_assert(*parse_current_state != simple_xml_parser_current_state_metadata);
*parse_current_state = simple_xml_parser_current_state_link;
}
else if (!strncmp("text>", content, strlen("text>")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_link);
ck_assert(*parse_current_state != simple_xml_parser_current_state_link);
*parse_current_state = simple_xml_parser_current_state_text;
}
else if (!strncmp("time>", content, strlen("time>")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_text);
ck_assert(*parse_current_state != simple_xml_parser_current_state_text);
*parse_current_state = simple_xml_parser_current_state_time;
}
else if (!strncmp("trk>", content, strlen("trk>")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_time);
ck_assert(*parse_current_state != simple_xml_parser_current_state_time);
*parse_current_state = simple_xml_parser_current_state_trk;
}
else if (!strncmp("name>", content, strlen("name>")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_trk);
ck_assert(*parse_current_state != simple_xml_parser_current_state_trk);
*parse_current_state = simple_xml_parser_current_state_name;
}
else if (!strncmp("trkseg>", content, strlen("trkseg>")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_name);
ck_assert(*parse_current_state != simple_xml_parser_current_state_name);
*parse_current_state = simple_xml_parser_current_state_trkseg;
}
else
{
fail_if(*parse_current_state != simple_xml_parser_current_state_trkpt);
ck_assert(*parse_current_state != simple_xml_parser_current_state_trkpt);
}
}
else if (type == EINA_SIMPLE_XML_OPEN_EMPTY)
{
if (!strncmp("trkpt ", content, strlen("trkpt ")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_trkseg &&
ck_assert(*parse_current_state != simple_xml_parser_current_state_trkseg &&
*parse_current_state != simple_xml_parser_current_state_trkpt);
*parse_current_state = simple_xml_parser_current_state_trkpt;
}
}
else if (type == EINA_SIMPLE_XML_COMMENT)
{
fail_if(*parse_current_state != simple_xml_parser_current_state_trkpt);
ck_assert(*parse_current_state != simple_xml_parser_current_state_trkpt);
*parse_current_state = simple_xml_parser_current_state_comment;
}
else if (type == EINA_SIMPLE_XML_CDATA)
{
fail_if(*parse_current_state != simple_xml_parser_current_state_comment);
ck_assert(*parse_current_state != simple_xml_parser_current_state_comment);
*parse_current_state = simple_xml_parser_current_state_cdata;
}
else if (type == EINA_SIMPLE_XML_CLOSE)
{
if (!strncmp("gpx", content, strlen("gpx")))
{
fail_if(*parse_current_state != simple_xml_parser_current_state_cdata);
ck_assert(*parse_current_state != simple_xml_parser_current_state_cdata);
*parse_current_state = simple_xml_parser_current_state_end;
}
}
@ -245,7 +245,7 @@ EFL_START_TEST(eina_simple_xml_parser_parse_with_custom_callback)
EINA_TRUE,
eina_simple_xml_parser_parse_with_custom_callback_tag_cb,
&parse_current_state);
fail_if(parse_current_state != simple_xml_parser_current_state_end);
ck_assert(parse_current_state != simple_xml_parser_current_state_end);
}
free(buf);
}

View File

@ -35,15 +35,15 @@ EFL_START_TEST(eina_test_slice_init)
EINA_RW_SLICE_DECLARE(d, 512);
fail_unless(a.len == sizeof("hello world") - 1);
fail_unless(strcmp(a.mem, "hello world") == 0);
ck_assert(a.len == sizeof("hello world") - 1);
ck_assert(strcmp(a.mem, "hello world") == 0);
fail_unless(b.len == sizeof(buf));
ck_assert(b.len == sizeof(buf));
fail_unless(c.len == strlen("hi there"));
fail_unless(strcmp(c.mem, "hi there") == 0);
ck_assert(c.len == strlen("hi there"));
ck_assert(strcmp(c.mem, "hi there") == 0);
fail_unless(d.len == 512);
ck_assert(d.len == 512);
}
EFL_END_TEST
@ -58,77 +58,77 @@ EFL_START_TEST(eina_test_slice_ro)
char *str;
dup = eina_slice_dup(slice);
fail_unless(dup.len == slice.len);
fail_unless(dup.mem != slice.mem);
fail_unless(eina_slice_compare(eina_rw_slice_slice_get(dup), slice) == 0);
ck_assert(dup.len == slice.len);
ck_assert(dup.mem != slice.mem);
ck_assert(eina_slice_compare(eina_rw_slice_slice_get(dup), slice) == 0);
free(dup.mem);
str = eina_slice_strdup(slice);
fail_unless(str != NULL);
fail_unless(strcmp(str, "hi there") == 0);
ck_assert(str != NULL);
ck_assert(strcmp(str, "hi there") == 0);
free(str);
a = eina_slice_seek(slice, strlen("hi "), SEEK_SET);
fail_unless(a.mem == slice.bytes + strlen("hi "));
fail_unless(a.len == slice.len - strlen("hi "));
ck_assert(a.mem == slice.bytes + strlen("hi "));
ck_assert(a.len == slice.len - strlen("hi "));
a = eina_slice_seek(slice, 0, SEEK_SET);
fail_unless(a.mem == slice.bytes + 0);
fail_unless(a.len == slice.len);
ck_assert(a.mem == slice.bytes + 0);
ck_assert(a.len == slice.len);
a = eina_slice_seek(slice, -1, SEEK_END);
fail_unless(a.mem == slice.bytes + slice.len - 1);
fail_unless(a.len == 1);
ck_assert(a.mem == slice.bytes + slice.len - 1);
ck_assert(a.len == 1);
a = eina_slice_seek(slice, 0, SEEK_END);
fail_unless(a.mem == eina_slice_end_get(slice));
fail_unless(a.len == 0);
ck_assert(a.mem == eina_slice_end_get(slice));
ck_assert(a.len == 0);
p = eina_slice_end_get(slice);
fail_unless(p == slice.bytes + slice.len);
ck_assert(p == slice.bytes + slice.len);
slice = (Eina_Slice)EINA_SLICE_STR_LITERAL("HELLO WORLD");
slice.len = strlen("hi there"); /* crop... */
p = eina_slice_strchr(slice, ' ');
fail_unless(p == slice.bytes + 5); /* 5 = index of ' ' in HELLO WORLD.. */
ck_assert(p == slice.bytes + 5); /* 5 = index of ' ' in HELLO WORLD.. */
p = eina_slice_strchr(slice, '!');
fail_unless(p == NULL);
ck_assert(p == NULL);
needle = (Eina_Slice)EINA_SLICE_STR_LITERAL(" W");
p = eina_slice_find(slice, needle);
fail_unless(p == slice.bytes + 5); /* 5 = index of ' W' in HELLO WORLD..*/
ck_assert(p == slice.bytes + 5); /* 5 = index of ' W' in HELLO WORLD..*/
needle = (Eina_Slice)EINA_SLICE_STR_LITERAL("LO");
p = eina_slice_find(slice, needle);
fail_unless(p == slice.bytes + 3); /* 3 = index of 'LO' in HELLO WORLD..*/
ck_assert(p == slice.bytes + 3); /* 3 = index of 'LO' in HELLO WORLD..*/
needle = (Eina_Slice)EINA_SLICE_STR_LITERAL("HELLO");
p = eina_slice_find(slice, needle);
fail_unless(p == slice.mem);
ck_assert(p == slice.mem);
needle = (Eina_Slice)EINA_SLICE_STR_LITERAL("WORLD"); /* would go out of boundaries */
p = eina_slice_find(slice, needle);
fail_unless(p == NULL);
ck_assert(p == NULL);
r = eina_slice_startswith(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("HEL"));
fail_unless(r == EINA_TRUE);
ck_assert(r == EINA_TRUE);
r = eina_slice_startswith(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("WORLD"));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_slice_startswith(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL(""));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_slice_endswith(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("WO"));
fail_unless(r == EINA_TRUE);
ck_assert(r == EINA_TRUE);
r = eina_slice_endswith(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("WORLD"));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_slice_endswith(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL(""));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
}
EFL_END_TEST
@ -146,87 +146,87 @@ EFL_START_TEST(eina_test_slice_rw)
rw_slice.len--; /* do not account \0 (now 0xff) */
ro_slice = eina_rw_slice_slice_get(rw_slice);
fail_unless(rw_slice.len == ro_slice.len);
fail_unless(rw_slice.mem == ro_slice.mem);
ck_assert(rw_slice.len == ro_slice.len);
ck_assert(rw_slice.mem == ro_slice.mem);
a = eina_slice_dup(ro_slice);
fail_unless(a.len == ro_slice.len);
fail_unless(a.mem != ro_slice.mem);
fail_unless(eina_rw_slice_compare(a, rw_slice) == 0);
ck_assert(a.len == ro_slice.len);
ck_assert(a.mem != ro_slice.mem);
ck_assert(eina_rw_slice_compare(a, rw_slice) == 0);
free(a.mem);
str = eina_rw_slice_strdup(rw_slice);
fail_unless(str != NULL);
fail_unless(strcmp(str, "hi there") == 0);
ck_assert(str != NULL);
ck_assert(strcmp(str, "hi there") == 0);
free(str);
a = eina_rw_slice_seek(rw_slice, strlen("hi "), SEEK_SET);
fail_unless(a.mem == rw_slice.bytes + strlen("hi "));
fail_unless(a.len == rw_slice.len - strlen("hi "));
ck_assert(a.mem == rw_slice.bytes + strlen("hi "));
ck_assert(a.len == rw_slice.len - strlen("hi "));
a = eina_rw_slice_seek(rw_slice, 0, SEEK_SET);
fail_unless(a.mem == rw_slice.bytes + 0);
fail_unless(a.len == rw_slice.len);
ck_assert(a.mem == rw_slice.bytes + 0);
ck_assert(a.len == rw_slice.len);
a = eina_rw_slice_seek(rw_slice, -1, SEEK_END);
fail_unless(a.mem == rw_slice.bytes + rw_slice.len - 1);
fail_unless(a.len == 1);
ck_assert(a.mem == rw_slice.bytes + rw_slice.len - 1);
ck_assert(a.len == 1);
a = eina_rw_slice_seek(rw_slice, 0, SEEK_END);
fail_unless(a.mem == eina_rw_slice_end_get(rw_slice));
fail_unless(a.len == 0);
ck_assert(a.mem == eina_rw_slice_end_get(rw_slice));
ck_assert(a.len == 0);
p = eina_rw_slice_end_get(rw_slice);
fail_unless(p == rw_slice.bytes + rw_slice.len);
ck_assert(p == rw_slice.bytes + rw_slice.len);
ro_slice = (Eina_Slice)EINA_SLICE_STR_LITERAL("HELLO WORLD, big string to be cropped");
a = eina_rw_slice_copy(rw_slice, ro_slice);
fail_unless(a.mem == rw_slice.mem);
fail_unless(a.len == rw_slice.len);
fail_unless(strncmp(a.mem, "HELLO WO", a.len) == 0);
ck_assert(a.mem == rw_slice.mem);
ck_assert(a.len == rw_slice.len);
ck_assert(strncmp(a.mem, "HELLO WO", a.len) == 0);
p = eina_rw_slice_strchr(rw_slice, ' ');
fail_unless(p == rw_slice.bytes + 5); /* 5 = index of ' ' in HELLO WORLD.. */
ck_assert(p == rw_slice.bytes + 5); /* 5 = index of ' ' in HELLO WORLD.. */
p = eina_rw_slice_strchr(rw_slice, '!');
fail_unless(p == NULL);
ck_assert(p == NULL);
ro_slice = (Eina_Slice)EINA_SLICE_STR_LITERAL(" W");
p = eina_rw_slice_find(rw_slice, ro_slice);
fail_unless(p == rw_slice.bytes + 5); /* 5 = index of ' W' in HELLO WORLD..*/
ck_assert(p == rw_slice.bytes + 5); /* 5 = index of ' W' in HELLO WORLD..*/
ro_slice = (Eina_Slice)EINA_SLICE_STR_LITERAL("LO");
p = eina_rw_slice_find(rw_slice, ro_slice);
fail_unless(p == rw_slice.bytes + 3); /* 3 = index of 'LO' in HELLO WORLD..*/
ck_assert(p == rw_slice.bytes + 3); /* 3 = index of 'LO' in HELLO WORLD..*/
ro_slice = (Eina_Slice)EINA_SLICE_STR_LITERAL("HELLO");
p = eina_rw_slice_find(rw_slice, ro_slice);
fail_unless(p == rw_slice.mem);
ck_assert(p == rw_slice.mem);
ro_slice = (Eina_Slice)EINA_SLICE_STR_LITERAL("WORLD"); /* would go out of boundaries */
p = eina_rw_slice_find(rw_slice, ro_slice);
fail_unless(p == NULL);
ck_assert(p == NULL);
fail_unless(buf[sizeof(buf) - 1] == 0xff);
ck_assert(buf[sizeof(buf) - 1] == 0xff);
r = eina_rw_slice_startswith(rw_slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("HEL"));
fail_unless(r == EINA_TRUE);
ck_assert(r == EINA_TRUE);
r = eina_rw_slice_startswith(rw_slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("WORLD"));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_rw_slice_startswith(rw_slice, (Eina_Slice)EINA_SLICE_STR_LITERAL(""));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_rw_slice_endswith(rw_slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("WO"));
fail_unless(r == EINA_TRUE);
ck_assert(r == EINA_TRUE);
r = eina_rw_slice_endswith(rw_slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("WORLD"));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
r = eina_rw_slice_endswith(rw_slice, (Eina_Slice)EINA_SLICE_STR_LITERAL(""));
fail_unless(r == EINA_FALSE);
ck_assert(r == EINA_FALSE);
}
EFL_END_TEST
@ -238,10 +238,10 @@ EFL_START_TEST(eina_test_slice_print)
snprintf(a, sizeof(a), EINA_SLICE_FMT, EINA_SLICE_PRINT(slice));
snprintf(b, sizeof(b), "%p+%zu", slice.mem, slice.len);
fail_unless(strcmp(a, b) == 0);
ck_assert(strcmp(a, b) == 0);
snprintf(a, sizeof(a), EINA_SLICE_STR_FMT, EINA_SLICE_STR_PRINT(slice));
fail_unless(strcmp(a, "Hello") == 0);
ck_assert(strcmp(a, "Hello") == 0);
}
EFL_END_TEST
@ -251,50 +251,50 @@ EFL_START_TEST(eina_test_slice_find)
const char *p;
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("a"));
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("ab"));
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("abc"));
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("f"));
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes + strlen("abcde"));
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("ef"));
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes + strlen("abcd"));
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("def"));
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes + strlen("abc"));
p = eina_slice_find(slice, slice);
fail_if(p == NULL);
ck_assert(p == NULL);
ck_assert_str_eq(p, (const char *)slice.bytes);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("x"));
fail_unless(p == NULL);
ck_assert(p == NULL);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("xyz"));
fail_unless(p == NULL);
ck_assert(p == NULL);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("xa"));
fail_unless(p == NULL);
ck_assert(p == NULL);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("xb"));
fail_unless(p == NULL);
ck_assert(p == NULL);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL("abcdefgh"));
fail_unless(p == NULL);
ck_assert(p == NULL);
p = eina_slice_find(slice, (Eina_Slice)EINA_SLICE_STR_LITERAL(""));
fail_unless(p == NULL);
ck_assert(p == NULL);
}
EFL_END_TEST

View File

@ -61,7 +61,7 @@ EFL_START_TEST(slstr_stringshare)
str = _slstr_stringshare();
ss = eina_stringshare_add("Hello world 3");
fail_if(ss != str);
ck_assert(ss != str);
}
EFL_END_TEST
@ -168,7 +168,7 @@ EFL_START_TEST(slstr_thread)
for (k = 0; k < threads; k++)
fail_if(!eina_thread_create(&th[k], EINA_THREAD_NORMAL, -1, _thread_cb, NULL));
ck_assert(!eina_thread_create(&th[k], EINA_THREAD_NORMAL, -1, _thread_cb, NULL));
for (k = 0; k < threads; k++)
eina_thread_join(th[k]);

View File

@ -33,84 +33,84 @@ EFL_START_TEST(str_simple)
const char *escape_ret = "\\ a\\\\x\\'";
fail_if(!eina_str_has_prefix("", ""));
ck_assert(!eina_str_has_prefix("", ""));
fail_if(!eina_str_has_prefix("x", "x"));
fail_if(!eina_str_has_prefix("xab", "x"));
fail_if(!eina_str_has_prefix("xab", "xab"));
ck_assert(!eina_str_has_prefix("x", "x"));
ck_assert(!eina_str_has_prefix("xab", "x"));
ck_assert(!eina_str_has_prefix("xab", "xab"));
fail_if(eina_str_has_prefix("x", "xab"));
fail_if(eina_str_has_prefix("xab", "xyz"));
fail_if(eina_str_has_prefix("", "x"));
fail_if(eina_str_has_prefix("X", "x"));
fail_if(eina_str_has_prefix("xAb", "X"));
fail_if(eina_str_has_prefix("xAb", "xab"));
ck_assert(eina_str_has_prefix("x", "xab"));
ck_assert(eina_str_has_prefix("xab", "xyz"));
ck_assert(eina_str_has_prefix("", "x"));
ck_assert(eina_str_has_prefix("X", "x"));
ck_assert(eina_str_has_prefix("xAb", "X"));
ck_assert(eina_str_has_prefix("xAb", "xab"));
fail_if(!eina_str_has_suffix("", ""));
ck_assert(!eina_str_has_suffix("", ""));
fail_if(!eina_str_has_suffix("x", "x"));
fail_if(!eina_str_has_suffix("abx", "x"));
fail_if(!eina_str_has_suffix("xab", "xab"));
ck_assert(!eina_str_has_suffix("x", "x"));
ck_assert(!eina_str_has_suffix("abx", "x"));
ck_assert(!eina_str_has_suffix("xab", "xab"));
fail_if(eina_str_has_suffix("x", "xab"));
fail_if(eina_str_has_suffix("xab", "xyz"));
fail_if(eina_str_has_suffix("", "x"));
fail_if(eina_str_has_suffix("X", "x"));
fail_if(eina_str_has_suffix("aBx", "X"));
fail_if(eina_str_has_suffix("xaB", "Xab"));
ck_assert(eina_str_has_suffix("x", "xab"));
ck_assert(eina_str_has_suffix("xab", "xyz"));
ck_assert(eina_str_has_suffix("", "x"));
ck_assert(eina_str_has_suffix("X", "x"));
ck_assert(eina_str_has_suffix("aBx", "X"));
ck_assert(eina_str_has_suffix("xaB", "Xab"));
fail_if(!eina_str_has_extension("", ""));
ck_assert(!eina_str_has_extension("", ""));
fail_if(!eina_str_has_extension("x", "x"));
fail_if(!eina_str_has_extension("abx", "x"));
fail_if(!eina_str_has_extension("xab", "xab"));
fail_if(!eina_str_has_extension("x", "X"));
fail_if(!eina_str_has_extension("abx", "X"));
fail_if(!eina_str_has_extension("xab", "Xab"));
fail_if(!eina_str_has_extension("X", "X"));
fail_if(!eina_str_has_extension("aBx", "X"));
fail_if(!eina_str_has_extension("xaB", "Xab"));
ck_assert(!eina_str_has_extension("x", "x"));
ck_assert(!eina_str_has_extension("abx", "x"));
ck_assert(!eina_str_has_extension("xab", "xab"));
ck_assert(!eina_str_has_extension("x", "X"));
ck_assert(!eina_str_has_extension("abx", "X"));
ck_assert(!eina_str_has_extension("xab", "Xab"));
ck_assert(!eina_str_has_extension("X", "X"));
ck_assert(!eina_str_has_extension("aBx", "X"));
ck_assert(!eina_str_has_extension("xaB", "Xab"));
fail_if(eina_str_has_extension("x", "xab"));
fail_if(eina_str_has_extension("xab", "xyz"));
fail_if(eina_str_has_extension("", "x"));
fail_if(eina_str_has_extension("x", "xAb"));
fail_if(eina_str_has_extension("xab", "xYz"));
fail_if(eina_str_has_extension("", "x"));
ck_assert(eina_str_has_extension("x", "xab"));
ck_assert(eina_str_has_extension("xab", "xyz"));
ck_assert(eina_str_has_extension("", "x"));
ck_assert(eina_str_has_extension("x", "xAb"));
ck_assert(eina_str_has_extension("xab", "xYz"));
ck_assert(eina_str_has_extension("", "x"));
fail_if(eina_streq("xab", NULL));
fail_if(eina_streq(NULL, "xab"));
fail_if(eina_streq("x", "xab"));
fail_if(eina_streq("xab", "XAB"));
fail_if(eina_streq("x", "x "));
fail_if(!eina_streq("xab", "xab"));
ck_assert(eina_streq("xab", NULL));
ck_assert(eina_streq(NULL, "xab"));
ck_assert(eina_streq("x", "xab"));
ck_assert(eina_streq("xab", "XAB"));
ck_assert(eina_streq("x", "x "));
ck_assert(!eina_streq("xab", "xab"));
fail_if(eina_strlen_bounded("abc", 4) != strlen("abc"));
fail_if(eina_strlen_bounded("abc", 2) != (size_t)-1);
ck_assert(eina_strlen_bounded("abc", 4) != strlen("abc"));
ck_assert(eina_strlen_bounded("abc", 2) != (size_t)-1);
str = malloc(sizeof(char) * 4);
strcpy(str, "bSd");
eina_str_tolower(&str);
fail_if(strcmp(str, "bsd") != 0);
ck_assert(strcmp(str, "bsd") != 0);
eina_str_toupper(&str);
fail_if(strcmp(str, "BSD") != 0);
ck_assert(strcmp(str, "BSD") != 0);
free(str);
str = malloc(sizeof(char) * 8);
strcpy(str, " a\\x'");
ret = eina_str_escape(str);
fail_if(strlen(ret) != strlen(escape_ret));
ck_assert(strlen(ret) != strlen(escape_ret));
for (i = 0; i <= strlen(ret); i++)
fail_if(ret[i] != escape_ret[i]);
ck_assert(ret[i] != escape_ret[i]);
free(str);
free(ret);
str = malloc(sizeof(char) * 4);
strcpy(str, "a\t ");
ret = eina_str_escape(str);
fail_if(!eina_streq(ret, "a\\t\\ "));
ck_assert(!eina_streq(ret, "a\\t\\ "));
free(str);
free(ret);
@ -125,55 +125,55 @@ EFL_START_TEST(str_split)
result = eina_str_split_full(NULL, ":", 1, &elements);
fail_if(result != NULL);
fail_if(elements != 0);
ck_assert(result != NULL);
ck_assert(elements != 0);
result = eina_str_split_full("nomatch", NULL, 1, &elements);
fail_if(result != NULL);
fail_if(elements != 0);
ck_assert(result != NULL);
ck_assert(elements != 0);
result = eina_str_split_full("match:match", ":", 1, &elements);
fail_if(result == NULL);
fail_if(elements != 1);
fail_if(strcmp(result[0], "match:match") != 0);
ck_assert(result == NULL);
ck_assert(elements != 1);
ck_assert(strcmp(result[0], "match:match") != 0);
free(result[0]);
free(result);
result = eina_str_split_full("match:match:nomatch:nomatch", ":", 3, &elements);
fail_if(result == NULL);
fail_if(elements != 3);
fail_if(strcmp(result[0], "match") != 0);
fail_if(strcmp(result[1], "match") != 0);
fail_if(strcmp(result[2], "nomatch:nomatch") != 0);
ck_assert(result == NULL);
ck_assert(elements != 3);
ck_assert(strcmp(result[0], "match") != 0);
ck_assert(strcmp(result[1], "match") != 0);
ck_assert(strcmp(result[2], "nomatch:nomatch") != 0);
free(result[0]);
free(result);
result = eina_str_split_full("nomatch", "", -1, &elements);
fail_if(result != NULL);
fail_if(elements != 0);
ck_assert(result != NULL);
ck_assert(elements != 0);
result = eina_str_split_full("nomatch", "x", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 1);
fail_if(strcmp(result[0], "nomatch") != 0);
fail_if(result[1]);
ck_assert(result == NULL);
ck_assert(elements != 1);
ck_assert(strcmp(result[0], "nomatch") != 0);
ck_assert(result[1]);
free(result[0]);
free(result);
result = eina_str_split_full("nomatch", "xyz", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 1);
fail_if(strcmp(result[0], "nomatch") != 0);
fail_if(result[1]);
ck_assert(result == NULL);
ck_assert(elements != 1);
ck_assert(strcmp(result[0], "nomatch") != 0);
ck_assert(result[1]);
free(result[0]);
free(result);
result = eina_str_split_full("match:match:match", ":", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 3);
ck_assert(result == NULL);
ck_assert(elements != 3);
for (elements = 0; elements < 3 - 1; elements++)
fail_if(strcmp(result[elements], "match") != 0);
fail_if(result[3]);
ck_assert(strcmp(result[elements], "match") != 0);
ck_assert(result[3]);
free(result[0]);
free(result);
@ -183,65 +183,65 @@ EFL_START_TEST(str_split)
strcat(str, "ma:");
strcat(str, "ma");
result = eina_str_split_full(str, ":", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 301);
ck_assert(result == NULL);
ck_assert(elements != 301);
free(result[0]);
free(result);
free(str);
result = eina_str_split_full("a:b:c", ":", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 3);
fail_if(strcmp(result[0], "a") != 0);
fail_if(strcmp(result[1], "b") != 0);
fail_if(strcmp(result[2], "c") != 0);
fail_if(result[3]);
ck_assert(result == NULL);
ck_assert(elements != 3);
ck_assert(strcmp(result[0], "a") != 0);
ck_assert(strcmp(result[1], "b") != 0);
ck_assert(strcmp(result[2], "c") != 0);
ck_assert(result[3]);
free(result[0]);
free(result);
result = eina_str_split_full("a:b:", ":", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 3);
fail_if(strcmp(result[0], "a") != 0);
fail_if(strcmp(result[1], "b") != 0);
fail_if(strcmp(result[2], "") != 0);
fail_if(result[3]);
ck_assert(result == NULL);
ck_assert(elements != 3);
ck_assert(strcmp(result[0], "a") != 0);
ck_assert(strcmp(result[1], "b") != 0);
ck_assert(strcmp(result[2], "") != 0);
ck_assert(result[3]);
free(result[0]);
free(result);
result = eina_str_split_full(":b:c", ":", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 3);
fail_if(strcmp(result[0], "") != 0);
fail_if(strcmp(result[1], "b") != 0);
fail_if(strcmp(result[2], "c") != 0);
fail_if(result[3]);
ck_assert(result == NULL);
ck_assert(elements != 3);
ck_assert(strcmp(result[0], "") != 0);
ck_assert(strcmp(result[1], "b") != 0);
ck_assert(strcmp(result[2], "c") != 0);
ck_assert(result[3]);
free(result[0]);
free(result);
result = eina_str_split_full(":", ":", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 2);
fail_if(strcmp(result[0], "") != 0);
fail_if(strcmp(result[1], "") != 0);
fail_if(result[2]);
ck_assert(result == NULL);
ck_assert(elements != 2);
ck_assert(strcmp(result[0], "") != 0);
ck_assert(strcmp(result[1], "") != 0);
ck_assert(result[2]);
free(result[0]);
free(result);
result = eina_str_split_full("a", "!!!!!!!!!", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 1);
fail_if(strcmp(result[0], "a") != 0);
fail_if(result[1]);
ck_assert(result == NULL);
ck_assert(elements != 1);
ck_assert(strcmp(result[0], "a") != 0);
ck_assert(result[1]);
free(result[0]);
free(result);
result = eina_str_split_full("aaba", "ab", -1, &elements);
fail_if(result == NULL);
fail_if(elements != 2);
fail_if(strcmp(result[0], "a") != 0);
fail_if(strcmp(result[1], "a") != 0);
fail_if(result[2]);
ck_assert(result == NULL);
ck_assert(elements != 2);
ck_assert(strcmp(result[0], "a") != 0);
ck_assert(strcmp(result[1], "a") != 0);
ck_assert(result[2]);
free(result[0]);
free(result);
@ -258,32 +258,32 @@ EFL_START_TEST(str_lcat_lcpy)
dst[0] = '\0';
ret = eina_strlcat(dst, "cat1", ds);
fail_if(ret != 4);
fail_if(strcmp(dst, "cat1") != 0);
ck_assert(ret != 4);
ck_assert(strcmp(dst, "cat1") != 0);
ret = eina_strlcat(dst, NULL, ds);
fail_if(ret != 4);
fail_if(strcmp(dst, "cat1") != 0);
ck_assert(ret != 4);
ck_assert(strcmp(dst, "cat1") != 0);
ret = eina_strlcat(dst, "cat234", ds);
fail_if(ret != (ds - 1 + 2));
fail_if(strcmp(dst, "cat1cat2") != 0);
ck_assert(ret != (ds - 1 + 2));
ck_assert(strcmp(dst, "cat1cat2") != 0);
ret = eina_strlcat(dst, "cat3", ds);
fail_if(ret != (ds - 1 + 4));
fail_if(strcmp(dst, "cat1cat2") != 0);
ck_assert(ret != (ds - 1 + 4));
ck_assert(strcmp(dst, "cat1cat2") != 0);
ret = eina_strlcat(dst, "cat3", ds - 1);
fail_if(ret != (ds - 1 + 4));
fail_if(strcmp(dst, "cat1cat2") != 0);
ck_assert(ret != (ds - 1 + 4));
ck_assert(strcmp(dst, "cat1cat2") != 0);
ret = eina_strlcpy(dst, "copycopy", ds);
fail_if(ret != 8);
fail_if(strcmp(dst, "copycopy") != 0);
ck_assert(ret != 8);
ck_assert(strcmp(dst, "copycopy") != 0);
ret = eina_strlcpy(dst, "copy2copy2", ds);
fail_if(ret != 10);
fail_if(strcmp(dst, "copy2cop") != 0);
ck_assert(ret != 10);
ck_assert(strcmp(dst, "copy2cop") != 0);
}
EFL_END_TEST
@ -298,20 +298,20 @@ EFL_START_TEST(str_join_len)
dst[0] = '\0';
ret = eina_str_join_len(dst, ds, '#', "ab", 2, "cde", 3);
fail_if(ret != 6);
fail_if(strcmp(dst, "ab#cde") != 0);
ck_assert(ret != 6);
ck_assert(strcmp(dst, "ab#cde") != 0);
ret = eina_str_join_len(dst, ds, '#', "abcdefghi", 9, "cde", 3);
fail_if(ret != 13);
fail_if(strcmp(dst, "abcdefgh") != 0);
ck_assert(ret != 13);
ck_assert(strcmp(dst, "abcdefgh") != 0);
ret = eina_str_join_len(dst, ds, '#', "abcdefgh", 8, "cde", 3);
fail_if(ret != 12);
fail_if(strcmp(dst, "abcdefgh") != 0);
ck_assert(ret != 12);
ck_assert(strcmp(dst, "abcdefgh") != 0);
ret = eina_str_join_len(dst, ds, '#', "abcd", 4, "efgh", 4);
fail_if(ret != 9);
fail_if(strcmp(dst, "abcd#efg") != 0);
ck_assert(ret != 9);
ck_assert(strcmp(dst, "abcd#efg") != 0);
}
EFL_END_TEST
@ -332,14 +332,14 @@ EFL_START_TEST(str_memdup)
t1.d = 123.456;
t2 = (struct temp *)eina_memdup((unsigned char *)&t1, sizeof(struct temp), EINA_TRUE);
fail_if(t2->i != t1.i);
fail_if(strcmp(t2->s,t1.s) != 0);
fail_if(!EINA_FLT_EQ(t2->d, t1.d));
ck_assert(t2->i != t1.i);
ck_assert(strcmp(t2->s,t1.s) != 0);
ck_assert(!EINA_FLT_EQ(t2->d, t1.d));
free(t2);
memcpy(buf, "aaabbb", 6);
temp_buf = eina_memdup(buf, 6, EINA_TRUE);
fail_if(strcmp((char *) temp_buf, "aaabbb") != 0);
ck_assert(strcmp((char *) temp_buf, "aaabbb") != 0);
free(temp_buf);
}
@ -355,7 +355,7 @@ EFL_START_TEST(str_strftime)
info = localtime(&curr_time);
buf = eina_strftime("%I:%M%p", info);
fail_if(buf == NULL);
ck_assert(buf == NULL);
free(buf);
}
@ -372,17 +372,17 @@ EFL_START_TEST(str_convert)
ret = eina_str_convert("UTF-8", "UTF-16LE", utf8);
fail_if(ret == NULL);
ck_assert(ret == NULL);
for( i=0; i<24; i++)
fail_if(ret[i] != utf16[i]);
ck_assert(ret[i] != utf16[i]);
free(ret);
ret = eina_str_convert_len("UTF-8", "UTF-16LE", utf8, 24, &ret_sz);
fail_if(ret == NULL);
fail_if(ret_sz != 24);
ck_assert(ret == NULL);
ck_assert(ret_sz != 24);
for( i=0; i<24; i++)
fail_if(ret[i] != utf16[i]);
ck_assert(ret[i] != utf16[i]);
free(ret);
}

View File

@ -36,39 +36,39 @@ EFL_START_TEST(eina_test_strbuf_simple)
"This test should be so long that it is longer than the initial size of strbuf"
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
txt = eina_strbuf_string_steal(buf);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(txt, TEST_TEXT TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(txt, TEST_TEXT TEST_TEXT));
free(txt);
fail_if(eina_strbuf_length_get(buf) != 0);
fail_if(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
ck_assert(eina_strbuf_length_get(buf) != 0);
ck_assert(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_reset(buf);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(eina_strbuf_length_get(buf) != 0);
fail_if(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(eina_strbuf_length_get(buf) != 0);
ck_assert(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ro_slice = eina_strbuf_slice_get(buf);
fail_if(ro_slice.len != eina_strbuf_length_get(buf));
fail_if(ro_slice.mem != eina_strbuf_string_get(buf));
ck_assert(ro_slice.len != eina_strbuf_length_get(buf));
ck_assert(ro_slice.mem != eina_strbuf_string_get(buf));
rw_slice = eina_strbuf_rw_slice_get(buf);
fail_if(rw_slice.len != eina_strbuf_length_get(buf));
fail_if(rw_slice.mem != eina_strbuf_string_get(buf));
ck_assert(rw_slice.len != eina_strbuf_length_get(buf));
ck_assert(rw_slice.mem != eina_strbuf_string_get(buf));
eina_strbuf_string_free(buf);
fail_if(eina_strbuf_length_get(buf));
ck_assert(eina_strbuf_length_get(buf));
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
eina_strbuf_free(buf);
@ -86,39 +86,39 @@ EFL_START_TEST(eina_test_strbuf_manage_simple)
txt = strdup(TEST_TEXT);
buf = eina_strbuf_manage_new(txt);
fail_if(!buf);
ck_assert(!buf);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
txt = eina_strbuf_string_steal(buf);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(txt, TEST_TEXT TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(txt, TEST_TEXT TEST_TEXT));
free(txt);
fail_if(eina_strbuf_length_get(buf) != 0);
fail_if(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
ck_assert(eina_strbuf_length_get(buf) != 0);
ck_assert(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_reset(buf);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(eina_strbuf_length_get(buf) != 0);
fail_if(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(eina_strbuf_length_get(buf) != 0);
ck_assert(!strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
eina_strbuf_free(buf);
buf = eina_strbuf_manage_read_only_new_length(TEST_TEXT, strlen(TEST_TEXT));
fail_if(!buf);
ck_assert(!buf);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_append(buf, TEST_TEXT);
fail_if(strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), TEST_TEXT TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
txt = eina_strbuf_string_steal(buf);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(txt, TEST_TEXT TEST_TEXT));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(txt, TEST_TEXT TEST_TEXT));
free(txt);
#undef TEST_TEXT
@ -130,35 +130,35 @@ EFL_START_TEST(eina_test_strbuf_remove)
Eina_Strbuf *buf;
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_strbuf_append(buf, "123 456 789 abc");
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_remove(buf, 0, 4);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "456 789 abc"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "456 789 abc"));
eina_strbuf_remove(buf, 8, 1000);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "456 789 "));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "456 789 "));
eina_strbuf_remove(buf, 7, eina_strbuf_length_get(buf));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "456 789"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "456 789"));
eina_strbuf_remove(buf, 2, 4);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "45789"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "45789"));
eina_strbuf_remove(buf, 4, 1);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "45789"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "45789"));
eina_strbuf_remove(buf, 0, eina_strbuf_length_get(buf));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), ""));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), ""));
#define TEST_TEXT \
"This test should be so long that it is longer than the initial size of strbuf"
eina_strbuf_append(buf, TEST_TEXT TEST_TEXT);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
eina_strbuf_remove(buf, 0, eina_strbuf_length_get(buf) - 1);
fail_if(strcmp(eina_strbuf_string_get(buf), "f"));
ck_assert(strcmp(eina_strbuf_string_get(buf), "f"));
#undef TEST_TEXT
eina_strbuf_free(buf);
@ -173,41 +173,41 @@ EFL_START_TEST(eina_test_strbuf_append)
ro_slice.len -= strlen("ELSE");
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_strbuf_append(buf, "abc");
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "abc"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "abc"));
eina_strbuf_reset(buf);
eina_strbuf_append_escaped(buf, "abc");
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "abc"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "abc"));
eina_strbuf_reset(buf);
eina_strbuf_append_escaped(buf, "abc '\\");
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "abc\\ \\'\\\\"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "abc\\ \\'\\\\"));
eina_strbuf_reset(buf);
eina_strbuf_append_n(buf, "abc", 2);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "ab"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "ab"));
eina_strbuf_reset(buf);
eina_strbuf_append_char(buf, 'a');
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "a"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "a"));
eina_strbuf_reset(buf);
eina_strbuf_append_length(buf, "something", strlen("something"));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "something"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "something"));
eina_strbuf_reset(buf);
eina_strbuf_append_slice(buf, ro_slice);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "something"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "something"));
eina_strbuf_reset(buf);
eina_strbuf_free(buf);
@ -222,40 +222,40 @@ EFL_START_TEST(eina_test_strbuf_insert)
ro_slice.len = 2;
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_strbuf_insert(buf, "abc", 10);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "abc"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "abc"));
eina_strbuf_insert(buf, "123", 0);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "123abc"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "123abc"));
eina_strbuf_insert(buf, "xyz", eina_strbuf_length_get(buf));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "123abcxyz"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "123abcxyz"));
eina_strbuf_insert(buf, "xyz", 1);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "1xyz23abcxyz"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "1xyz23abcxyz"));
eina_strbuf_insert_n(buf, "ABCDEF", 2, 1);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "1ABxyz23abcxyz"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "1ABxyz23abcxyz"));
eina_strbuf_insert_slice(buf, ro_slice, 3);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "1ABEIxyz23abcxyz"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "1ABEIxyz23abcxyz"));
eina_strbuf_insert_escaped(buf, "678", 3);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strncmp(eina_strbuf_string_get(buf) + 3, "678", 3));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strncmp(eina_strbuf_string_get(buf) + 3, "678", 3));
eina_strbuf_insert_escaped(buf, "089 '\\", 9);
fail_if(strlen(eina_strbuf_string_get(
ck_assert(strlen(eina_strbuf_string_get(
buf)) != eina_strbuf_length_get(buf));
fail_if(strncmp(eina_strbuf_string_get(buf) + 9,
ck_assert(strncmp(eina_strbuf_string_get(buf) + 9,
"089\\ \\'\\\\",
strlen("089\\ \\'\\\\")));
eina_strbuf_reset(buf);
@ -269,53 +269,53 @@ EFL_START_TEST(eina_test_strbuf_replace)
Eina_Strbuf *buf;
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
eina_strbuf_append(buf, "aaa");
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "aaa"));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "aaa"));
fail_if(!eina_strbuf_replace(buf, "a", "b", 1));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "baa"));
ck_assert(!eina_strbuf_replace(buf, "a", "b", 1));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "baa"));
fail_if(eina_strbuf_replace_all(buf, "a", "b") != 2);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "bbb"));
ck_assert(eina_strbuf_replace_all(buf, "a", "b") != 2);
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "bbb"));
fail_if(!eina_strbuf_replace(buf, "b", "cc", 2));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "bccb"));
ck_assert(!eina_strbuf_replace(buf, "b", "cc", 2));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "bccb"));
fail_if(eina_strbuf_replace_all(buf, "c", "aa") != 2);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "baaaab"));
ck_assert(eina_strbuf_replace_all(buf, "c", "aa") != 2);
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "baaaab"));
fail_if(eina_strbuf_replace(buf, "c", "aa", 0));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "baaaab"));
ck_assert(eina_strbuf_replace(buf, "c", "aa", 0));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "baaaab"));
fail_if(eina_strbuf_replace(buf, "c", "aa", 2));
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "baaaab"));
ck_assert(eina_strbuf_replace(buf, "c", "aa", 2));
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "baaaab"));
fail_if(eina_strbuf_replace_all(buf, "c", "aa") != 0);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "baaaab"));
ck_assert(eina_strbuf_replace_all(buf, "c", "aa") != 0);
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "baaaab"));
fail_if(eina_strbuf_replace_last(buf, "a", "x") == 0);
fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
fail_if(strcmp(eina_strbuf_string_get(buf), "baaaxb"));
ck_assert(eina_strbuf_replace_last(buf, "a", "x") == 0);
ck_assert(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf));
ck_assert(strcmp(eina_strbuf_string_get(buf), "baaaxb"));
fail_if(eina_strbuf_replace_first(buf, "a", "b") == 0);
fail_if(strcmp(eina_strbuf_string_get(buf), "bbaaxb"));
ck_assert(eina_strbuf_replace_first(buf, "a", "b") == 0);
ck_assert(strcmp(eina_strbuf_string_get(buf), "bbaaxb"));
eina_strbuf_free(buf);
buf = eina_strbuf_manage_read_only_new_length("baaaab",6);
fail_if(!buf);
fail_if(eina_strbuf_replace_first(buf, "a", "b") == 0);
fail_if(strcmp(eina_strbuf_string_get(buf), "bbaaab"));
ck_assert(!buf);
ck_assert(eina_strbuf_replace_first(buf, "a", "b") == 0);
ck_assert(strcmp(eina_strbuf_string_get(buf), "bbaaab"));
eina_strbuf_free(buf);
}
@ -333,51 +333,51 @@ EFL_START_TEST(eina_test_strbuf_realloc)
pattern[i] = '\0';
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
sz = 0;
eina_strbuf_append_length(buf, pattern, 1);
fail_if(eina_strbuf_length_get(buf) != sz + 1);
fail_if(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 1));
ck_assert(eina_strbuf_length_get(buf) != sz + 1);
ck_assert(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 1));
sz += 1;
eina_strbuf_append_length(buf, pattern, 32);
fail_if(eina_strbuf_length_get(buf) != sz + 32);
fail_if(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 32));
ck_assert(eina_strbuf_length_get(buf) != sz + 32);
ck_assert(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 32));
sz += 32;
eina_strbuf_append_length(buf, pattern, 64);
fail_if(eina_strbuf_length_get(buf) != sz + 64);
fail_if(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 64));
ck_assert(eina_strbuf_length_get(buf) != sz + 64);
ck_assert(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 64));
sz += 64;
eina_strbuf_append_length(buf, pattern, 128);
fail_if(eina_strbuf_length_get(buf) != sz + 128);
fail_if(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 128));
ck_assert(eina_strbuf_length_get(buf) != sz + 128);
ck_assert(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 128));
sz += 128;
eina_strbuf_append_length(buf, pattern, 4096);
fail_if(eina_strbuf_length_get(buf) != sz + 4096);
fail_if(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 4096));
ck_assert(eina_strbuf_length_get(buf) != sz + 4096);
ck_assert(memcmp(eina_strbuf_string_get(buf) + sz, pattern, 4096));
sz += 4096;
eina_strbuf_append_length(buf, pattern, sizeof(pattern) - 1);
fail_if(eina_strbuf_length_get(buf) != sz + sizeof(pattern) - 1);
fail_if(memcmp(eina_strbuf_string_get(buf) + sz, pattern, sizeof(pattern) -
ck_assert(eina_strbuf_length_get(buf) != sz + sizeof(pattern) - 1);
ck_assert(memcmp(eina_strbuf_string_get(buf) + sz, pattern, sizeof(pattern) -
1));
sz += sizeof(pattern) - 1;
eina_strbuf_remove(buf, 1024, 1024 + 1234);
fail_if(eina_strbuf_length_get(buf) != sz - 1234);
ck_assert(eina_strbuf_length_get(buf) != sz - 1234);
sz -= 1234;
eina_strbuf_remove(buf, 0, 0 + 8192);
fail_if(eina_strbuf_length_get(buf) != sz - 8192);
ck_assert(eina_strbuf_length_get(buf) != sz - 8192);
sz -= 8192;
eina_strbuf_remove(buf, 0, 0 + 32);
fail_if(eina_strbuf_length_get(buf) != sz - 32);
ck_assert(eina_strbuf_length_get(buf) != sz - 32);
eina_strbuf_free(buf);
}
@ -392,7 +392,7 @@ EFL_START_TEST(eina_test_strbuf_append_realloc)
size_t i, target_pattern_size;
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
for (i = 0; i < runs; i++)
{
@ -423,7 +423,7 @@ EFL_START_TEST(eina_test_strbuf_prepend_realloc)
size_t i, target_pattern_size;
buf = eina_strbuf_new();
fail_if(!buf);
ck_assert(!buf);
for (i = 0; i < runs; i++)
{
@ -451,39 +451,39 @@ EFL_START_TEST(eina_test_strbuf_trim)
const char *str;
buf = eina_strbuf_new();
fail_unless(buf != NULL);
ck_assert(buf != NULL);
eina_strbuf_append(buf, " string ");
eina_strbuf_trim(buf);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "string") != 0);
ck_assert(str == NULL || strcmp(str, "string") != 0);
eina_strbuf_reset(buf);
eina_strbuf_append(buf, " string ");
eina_strbuf_ltrim(buf);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "string ") != 0);
ck_assert(str == NULL || strcmp(str, "string ") != 0);
eina_strbuf_rtrim(buf);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "string") != 0);
ck_assert(str == NULL || strcmp(str, "string") != 0);
eina_strbuf_reset(buf);
eina_strbuf_append(buf, " ");
eina_strbuf_trim(buf);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "") != 0);
ck_assert(str == NULL || strcmp(str, "") != 0);
eina_strbuf_reset(buf);
eina_strbuf_append(buf, " ");
eina_strbuf_rtrim(buf);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "") != 0);
ck_assert(str == NULL || strcmp(str, "") != 0);
eina_strbuf_reset(buf);
eina_strbuf_append(buf, " ");
eina_strbuf_ltrim(buf);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "") != 0);
ck_assert(str == NULL || strcmp(str, "") != 0);
eina_strbuf_reset(buf);
eina_strbuf_free(buf);
@ -496,21 +496,21 @@ EFL_START_TEST(eina_test_strbuf_tolower)
const char *str;
buf = eina_strbuf_new();
fail_unless(buf != NULL);
ck_assert(buf != NULL);
eina_strbuf_append(buf, "UPPER");
eina_strbuf_tolower(buf);
str = eina_strbuf_string_get(buf);
fail_unless(str && !strcmp(str, "upper"));
ck_assert(str && !strcmp(str, "upper"));
eina_strbuf_tolower(buf);
str = eina_strbuf_string_get(buf);
fail_unless(str && !strcmp(str, "upper"));
ck_assert(str && !strcmp(str, "upper"));
eina_strbuf_append(buf, "1@ ");
eina_strbuf_tolower(buf);
str = eina_strbuf_string_get(buf);
fail_unless(str && !strcmp(str, "upper1@ "));
ck_assert(str && !strcmp(str, "upper1@ "));
eina_strbuf_free(buf);
}
@ -522,36 +522,36 @@ EFL_START_TEST(eina_test_strbuf_substr_get)
const char *str;
buf = eina_strbuf_new();
fail_unless(buf != NULL);
ck_assert(buf != NULL);
eina_strbuf_append(buf, "string");
substr = eina_strbuf_substr_get(buf, 2, 3);
str = eina_strbuf_string_get(substr);
fail_unless(str && !strcmp(str, "rin"));
ck_assert(str && !strcmp(str, "rin"));
eina_strbuf_free(substr);
substr = eina_strbuf_substr_get(buf, 0, 6);
str = eina_strbuf_string_get(substr);
fail_unless(str && !strcmp(str, "string"));
ck_assert(str && !strcmp(str, "string"));
eina_strbuf_free(substr);
substr = eina_strbuf_substr_get(buf, 6, 0);
str = eina_strbuf_string_get(substr);
fail_unless(str && !strcmp(str, ""));
ck_assert(str && !strcmp(str, ""));
eina_strbuf_free(substr);
substr = eina_strbuf_substr_get(buf, 6, 1);
str = eina_strbuf_string_get(substr);
fail_if(str);
ck_assert(str);
eina_strbuf_free(substr);
substr = eina_strbuf_substr_get(buf, 0, 7);
str = eina_strbuf_string_get(substr);
fail_if(str);
ck_assert(str);
eina_strbuf_free(substr);
substr = eina_strbuf_substr_get(NULL, 0, 7);
fail_if(substr);
ck_assert(substr);
eina_strbuf_free(buf);
}
@ -587,26 +587,26 @@ EFL_START_TEST(eina_test_strbuf_prepend_print)
const char *str;
buf = eina_strbuf_new();
fail_unless(buf != NULL);
ck_assert(buf != NULL);
ret = eina_strbuf_prepend_printf(buf, "%s", "string");
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "string") != 0);
ck_assert(str == NULL || strcmp(str, "string") != 0);
ret = eina_strbuf_prepend_printf(buf, "This is %d ", 1);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "This is 1 string") != 0);
ck_assert(str == NULL || strcmp(str, "This is 1 string") != 0);
ret = eina_strbuf_prepend_printf(buf, "%s ", "hello");
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, "hello This is 1 string") != 0);
ck_assert(str == NULL || strcmp(str, "hello This is 1 string") != 0);
eina_strbuf_reset(buf);
str = test_prepend(buf, "This", "is", "test", "string");
fail_if(str == NULL || strcmp(str, "This is test string") != 0);
ck_assert(str == NULL || strcmp(str, "This is test string") != 0);
eina_strbuf_free(buf);
}
@ -643,7 +643,7 @@ EFL_START_TEST(eina_test_strbuf_strftime_test)
buf = eina_strbuf_new();
eina_strbuf_append_strftime(buf, "%I:%M%p", info);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, cbuf) != 0);
ck_assert(str == NULL || strcmp(str, cbuf) != 0);
eina_strbuf_reset(buf);
eina_strbuf_append(buf, "Hours: Minutes");
@ -651,7 +651,7 @@ EFL_START_TEST(eina_test_strbuf_strftime_test)
eina_strbuf_insert_strftime(buf, "%M ", info, 10);
strftime(cbuf, 32, "%I Hours: %M Minutes", info);
str = eina_strbuf_string_get(buf);
fail_if(str == NULL || strcmp(str, cbuf) != 0);
ck_assert(str == NULL || strcmp(str, cbuf) != 0);
eina_strbuf_free(buf);
}

View File

@ -43,20 +43,20 @@ EINA_TEST_START(eina_stringshare_simple)
t0 = eina_stringshare_add(TEST0);
t1 = eina_stringshare_add(TEST1);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(strcmp(t0, TEST0) != 0);
fail_if(strcmp(t1, TEST1) != 0);
fail_if((int)strlen(TEST0) != eina_stringshare_strlen(t0));
fail_if((int)strlen(TEST1) != eina_stringshare_strlen(t1));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(strcmp(t0, TEST0) != 0);
ck_assert(strcmp(t1, TEST1) != 0);
ck_assert((int)strlen(TEST0) != eina_stringshare_strlen(t0));
ck_assert((int)strlen(TEST1) != eina_stringshare_strlen(t1));
t0 = eina_stringshare_ref(t0);
fail_if(t0 == NULL);
fail_if((int)strlen(TEST0) != eina_stringshare_strlen(t0));
ck_assert(t0 == NULL);
ck_assert((int)strlen(TEST0) != eina_stringshare_strlen(t0));
slice = eina_stringshare_slice_get(t0);
fail_if(slice.mem != t0);
fail_if(slice.len != strlen(TEST0));
ck_assert(slice.mem != t0);
ck_assert(slice.len != strlen(TEST0));
eina_stringshare_del(t0);
eina_stringshare_del(t0);
@ -73,22 +73,22 @@ EINA_TEST_START(eina_stringshare_simple_refplace)
t0 = eina_stringshare_add(TEST0);
t1 = eina_stringshare_add(TEST1);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(strcmp(t0, TEST0) != 0);
fail_if(strcmp(t1, TEST1) != 0);
fail_if((int)strlen(TEST0) != eina_stringshare_strlen(t0));
fail_if((int)strlen(TEST1) != eina_stringshare_strlen(t1));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(strcmp(t0, TEST0) != 0);
ck_assert(strcmp(t1, TEST1) != 0);
ck_assert((int)strlen(TEST0) != eina_stringshare_strlen(t0));
ck_assert((int)strlen(TEST1) != eina_stringshare_strlen(t1));
fail_if(eina_stringshare_refplace(&t0, t0));
fail_if(t0 == NULL);
fail_if((int)strlen(TEST0) != eina_stringshare_strlen(t0));
ck_assert(eina_stringshare_refplace(&t0, t0));
ck_assert(t0 == NULL);
ck_assert((int)strlen(TEST0) != eina_stringshare_strlen(t0));
slice = eina_stringshare_slice_get(t0);
fail_if(slice.mem != t0);
fail_if(slice.len != strlen(TEST0));
ck_assert(slice.mem != t0);
ck_assert(slice.len != strlen(TEST0));
fail_if(!eina_stringshare_refplace(&t1, t0));
ck_assert(!eina_stringshare_refplace(&t1, t0));
eina_stringshare_del(t0);
eina_stringshare_del(t1);
@ -115,12 +115,12 @@ EINA_TEST_START(eina_stringshare_small)
t0 = eina_stringshare_add(buf);
t1 = eina_stringshare_add(buf);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(t0 != t1);
fail_if(strcmp(t0, buf) != 0);
fail_if((int)strlen(buf) != eina_stringshare_strlen(t0));
fail_if((int)strlen(buf) != eina_stringshare_strlen(t1));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(t0 != t1);
ck_assert(strcmp(t0, buf) != 0);
ck_assert((int)strlen(buf) != eina_stringshare_strlen(t0));
ck_assert((int)strlen(buf) != eina_stringshare_strlen(t1));
eina_stringshare_ref(t0);
eina_stringshare_del(t0);
@ -139,12 +139,12 @@ EINA_TEST_START(eina_stringshare_test_share)
t0 = eina_stringshare_add(TEST0);
t1 = eina_stringshare_add(TEST0);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(strcmp(t0, TEST0) != 0);
fail_if(strcmp(t1, TEST0) != 0);
fail_if(t0 != t1);
fail_if((int)strlen(t0) != eina_stringshare_strlen(t0));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(strcmp(t0, TEST0) != 0);
ck_assert(strcmp(t1, TEST0) != 0);
ck_assert(t0 != t1);
ck_assert((int)strlen(t0) != eina_stringshare_strlen(t0));
eina_stringshare_del(t0);
eina_stringshare_del(t1);
@ -162,7 +162,7 @@ EINA_TEST_START(eina_stringshare_putstuff)
eina_convert_xtoa(i, build + 7);
tmp = eina_stringshare_add(build);
fail_if(tmp != eina_stringshare_add(build));
ck_assert(tmp != eina_stringshare_add(build));
}
}
EINA_TEST_END
@ -174,7 +174,7 @@ EINA_TEST_START(eina_stringshare_collision)
int i;
ea = eina_array_new(256);
fail_if(!ea);
ck_assert(!ea);
for (i = 0; i < 10000; ++i)
{
@ -183,7 +183,7 @@ EINA_TEST_START(eina_stringshare_collision)
if (rand() > RAND_MAX / 2)
{
const char *r = eina_stringshare_add(buffer);
fail_if(r == NULL);
ck_assert(r == NULL);
}
}
@ -194,9 +194,9 @@ EINA_TEST_START(eina_stringshare_collision)
eina_convert_itoa(60000 - i, buffer);
eina_array_push(ea, (void *)eina_stringshare_add(buffer));
r = eina_stringshare_add(buffer);
fail_if(r == NULL);
ck_assert(r == NULL);
r = eina_stringshare_add(buffer);
fail_if(r == NULL);
ck_assert(r == NULL);
}
for (i = 0; i < 200; ++i)
@ -215,24 +215,24 @@ EINA_TEST_START(eina_stringshare_print)
const char *t2;
const char *t3;
fail_if(eina_stringshare_printf(0) != NULL);
fail_if(eina_stringshare_printf("%s", "") == NULL);
fail_if(strlen(eina_stringshare_printf("%s", "")) > 0);
fail_if(eina_stringshare_nprintf(0, "%s", "") == NULL);
fail_if(strlen(eina_stringshare_nprintf(0, "%s", "")) > 0);
ck_assert(eina_stringshare_printf(0) != NULL);
ck_assert(eina_stringshare_printf("%s", "") == NULL);
ck_assert(strlen(eina_stringshare_printf("%s", "")) > 0);
ck_assert(eina_stringshare_nprintf(0, "%s", "") == NULL);
ck_assert(strlen(eina_stringshare_nprintf(0, "%s", "")) > 0);
t1 = eina_stringshare_printf("x%sy", TEST1);
t2 = my_vprintf("x%sy", TEST1);
t3 = eina_stringshare_nprintf(10, "x%sy", TEST1);
fail_if(t1 == NULL);
fail_if(t2 == NULL);
fail_if(t3 == NULL);
fail_if(strcmp(t1, "x"TEST1"y") != 0);
fail_if(strcmp(t2, "x"TEST1"y") != 0);
fail_if(strcmp(t3, "x"TEST1"y") != 0);
fail_if(((int)strlen(TEST1) + 2) != eina_stringshare_strlen(t1));
fail_if(((int)strlen(TEST1) + 2) != eina_stringshare_strlen(t2));
fail_if(8 != eina_stringshare_strlen(t3));
ck_assert(t1 == NULL);
ck_assert(t2 == NULL);
ck_assert(t3 == NULL);
ck_assert(strcmp(t1, "x"TEST1"y") != 0);
ck_assert(strcmp(t2, "x"TEST1"y") != 0);
ck_assert(strcmp(t3, "x"TEST1"y") != 0);
ck_assert(((int)strlen(TEST1) + 2) != eina_stringshare_strlen(t1));
ck_assert(((int)strlen(TEST1) + 2) != eina_stringshare_strlen(t2));
ck_assert(8 != eina_stringshare_strlen(t3));
eina_stringshare_del(t1);
eina_stringshare_del(t2);
eina_stringshare_del(t3);

View File

@ -40,7 +40,7 @@ check_iterator(Eina_Iterator *it, struct test_rect *cur_test)
struct Eina_Tile_Grid_Info *tile;
EINA_ITERATOR_FOREACH(it, tile) {
fail_if(cur_test[i].col != tile->col ||
ck_assert(cur_test[i].col != tile->col ||
cur_test[i].row != tile->row ||
cur_test[i].x != tile->rect.x ||
cur_test[i].y != tile->rect.y ||
@ -50,7 +50,7 @@ check_iterator(Eina_Iterator *it, struct test_rect *cur_test)
i++;
}
fail_if(i == 0);
ck_assert(i == 0);
}
EFL_START_TEST(eina_test_tile_grid_slicer_iterator)
@ -139,42 +139,42 @@ EFL_START_TEST(eina_test_tiler_all)
tl = eina_tiler_new(1, 1);
eina_tiler_area_size_get(tl, &width, &height);
fail_if(width != 1 && height != 1);
ck_assert(width != 1 && height != 1);
width = 640;
height = 480;
eina_tiler_area_size_set(tl, width, height);
eina_tiler_area_size_get(tl, &width, &height);
fail_if(width != 640 && height != 480);
ck_assert(width != 640 && height != 480);
eina_tiler_tile_size_set(tl, 32, 32);
EINA_RECTANGLE_SET(&r, 50, 50, 20, 20);
fail_if(!eina_tiler_rect_add(tl, &r));
ck_assert(!eina_tiler_rect_add(tl, &r));
EINA_RECTANGLE_SET(&r, -10, -10, 5, 5);
fail_if(eina_tiler_rect_add(tl, &r));
ck_assert(eina_tiler_rect_add(tl, &r));
EINA_RECTANGLE_SET(&r, 40, 40, 20, 20);
eina_tiler_rect_del(tl, &r);
it = eina_tiler_iterator_new(tl);
fail_if(!it);
ck_assert(!it);
EINA_ITERATOR_FOREACH(it, rp)
{
fail_if(rp->w <= 0);
fail_if(rp->h <= 0);
fail_if(rp->x < 0 || rp->x + rp->w > 640);
fail_if(rp->y < 0 || rp->y + rp->h > 480);
ck_assert(rp->w <= 0);
ck_assert(rp->h <= 0);
ck_assert(rp->x < 0 || rp->x + rp->w > 640);
ck_assert(rp->y < 0 || rp->y + rp->h > 480);
++i;
}
fail_if(eina_iterator_container_get(it) != tl);
ck_assert(eina_iterator_container_get(it) != tl);
eina_iterator_free(it);
fail_if(i == 0);
ck_assert(i == 0);
eina_tiler_clear(tl);
@ -193,36 +193,36 @@ EFL_START_TEST(eina_test_tiler_stable)
tl = eina_tiler_new(640, 480);
fail_if(!tl);
ck_assert(!tl);
eina_tiler_tile_size_set(tl, 1, 1);
EINA_RECTANGLE_SET(&r, 50, 50, 20, 20);
fail_if(!eina_tiler_rect_add(tl, &r));
ck_assert(!eina_tiler_rect_add(tl, &r));
EINA_RECTANGLE_SET(&r, 40, 40, 20, 20);
eina_tiler_rect_del(tl, &r);
EINA_RECTANGLE_SET(&r, 50, 50, 20, 20);
fail_if(!eina_tiler_rect_add(tl, &r));
ck_assert(!eina_tiler_rect_add(tl, &r));
EINA_RECTANGLE_SET(&r, 40, 40, 20, 20);
eina_tiler_rect_del(tl, &r);
it = eina_tiler_iterator_new(tl);
fail_if(!it);
ck_assert(!it);
EINA_ITERATOR_FOREACH(it, rp)
{
EINA_RECTANGLE_SET(&r, 40, 40, 20, 20);
fail_if(eina_rectangle_intersection(&r, rp));
ck_assert(eina_rectangle_intersection(&r, rp));
EINA_RECTANGLE_SET(&r, 50, 50, 20, 20);
fail_if(!eina_rectangles_intersect(&r, rp));
ck_assert(!eina_rectangles_intersect(&r, rp));
++i;
}
fail_if(i != 2);
ck_assert(i != 2);
eina_iterator_free(it);
@ -240,10 +240,10 @@ EFL_START_TEST(eina_test_tiler_calculation)
t1 = eina_tiler_new(500, 500);
fail_if(!t1);
ck_assert(!t1);
t2 = eina_tiler_new(500, 500);
fail_if(!t2);
ck_assert(!t2);
eina_tiler_tile_size_set(t1, 1, 1);
eina_tiler_tile_size_set(t2, 1, 1);
@ -254,85 +254,85 @@ EFL_START_TEST(eina_test_tiler_calculation)
EINA_RECTANGLE_SET(&r2, 100, 100, 300, 300);
eina_tiler_rect_add(t2, &r2);
fail_if(!eina_tiler_union(t1, t2));
ck_assert(!eina_tiler_union(t1, t2));
itr = eina_tiler_iterator_new(t1);
EINA_ITERATOR_FOREACH(itr, rp)
{
fail_if(rp->w != 500);
fail_if(rp->h != 500);
fail_if(rp->x != 0);
fail_if(rp->y != 0);
ck_assert(rp->w != 500);
ck_assert(rp->h != 500);
ck_assert(rp->x != 0);
ck_assert(rp->y != 0);
++i;
}
eina_iterator_free(itr);
eina_tiler_clear(t1);
fail_if(i != 1);
ck_assert(i != 1);
eina_tiler_rect_add(t1, &r1);
fail_if(!eina_tiler_subtract(t1, t2));
ck_assert(!eina_tiler_subtract(t1, t2));
i = 0;
itr = eina_tiler_iterator_new(t1);
EINA_ITERATOR_FOREACH(itr, rp)
{
fail_if(!eina_rectangles_intersect(&r1, rp));
fail_if(eina_rectangles_intersect(&r2, rp));
ck_assert(!eina_rectangles_intersect(&r1, rp));
ck_assert(eina_rectangles_intersect(&r2, rp));
fail_if(rp->w <= 0);
fail_if(rp->h <= 0);
fail_if(rp->x < 0 || rp->x + rp->w > 500);
fail_if(rp->y < 0 || rp->y + rp->h > 500);
ck_assert(rp->w <= 0);
ck_assert(rp->h <= 0);
ck_assert(rp->x < 0 || rp->x + rp->w > 500);
ck_assert(rp->y < 0 || rp->y + rp->h > 500);
++i;
}
eina_iterator_free(itr);
eina_tiler_clear(t1);
fail_if(i != 4);
ck_assert(i != 4);
EINA_RECTANGLE_SET(&r3, 0, 0, 50, 50);
eina_tiler_rect_add(t1, &r3);
t = eina_tiler_intersection(t1, t2);
fail_if(t);
ck_assert(t);
eina_tiler_clear(t1);
eina_tiler_rect_add(t1, &r1);
t = eina_tiler_intersection(t1, t2);
fail_if(!t);
ck_assert(!t);
i = 0;
itr = eina_tiler_iterator_new(t);
EINA_ITERATOR_FOREACH(itr, rp)
{
fail_if(!eina_rectangles_intersect(&r1, rp));
fail_if(!eina_rectangles_intersect(&r2, rp));
ck_assert(!eina_rectangles_intersect(&r1, rp));
ck_assert(!eina_rectangles_intersect(&r2, rp));
fail_if(rp->w <= 0);
fail_if(rp->h <= 0);
fail_if(rp->x < 0 || rp->x + rp->w > 500);
fail_if(rp->y < 0 || rp->y + rp->h > 500);
ck_assert(rp->w <= 0);
ck_assert(rp->h <= 0);
ck_assert(rp->x < 0 || rp->x + rp->w > 500);
ck_assert(rp->y < 0 || rp->y + rp->h > 500);
++i;
}
eina_iterator_free(itr);
eina_tiler_clear(t);
fail_if(i != 1);
ck_assert(i != 1);
eina_tiler_rect_add(t, &r1);
fail_if(!eina_tiler_equal(t, t1));
fail_if(!eina_tiler_equal(t1, t));
ck_assert(!eina_tiler_equal(t, t1));
ck_assert(!eina_tiler_equal(t1, t));
EINA_RECTANGLE_SET(&r1, 0, 0, 250, 250);
eina_tiler_rect_del(t, &r1);
fail_if(eina_tiler_equal(t1, t));
ck_assert(eina_tiler_equal(t1, t));
eina_tiler_free(t);
eina_tiler_free(t1);
@ -349,21 +349,21 @@ EFL_START_TEST(eina_test_tiler_size)
Eina_Bool rects = EINA_FALSE;
t = eina_tiler_new(131070, 131070);
fail_if(!t);
ck_assert(!t);
eina_tiler_tile_size_set(t, 1, 1);
fail_if(!eina_tiler_rect_add(t, &(Eina_Rectangle){0, 0, 131070, 131070}));
ck_assert(!eina_tiler_rect_add(t, &(Eina_Rectangle){0, 0, 131070, 131070}));
it = eina_tiler_iterator_new(t);
fail_if(!it);
ck_assert(!it);
EINA_ITERATOR_FOREACH(it, r)
{
rects = EINA_TRUE;
fail_if(r->x);
fail_if(r->y);
fail_if(r->w != 131070);
fail_if(r->h != 131070);
ck_assert(r->x);
ck_assert(r->y);
ck_assert(r->w != 131070);
ck_assert(r->h != 131070);
}
fail_if(!rects);
ck_assert(!rects);
eina_iterator_free(it);
eina_tiler_free(t);
}

View File

@ -39,7 +39,7 @@ EFL_START_TEST(tmpstr_simple)
snprintf(buf, max_str_len, "Tmp string %d", (i + 1));
tmp_strings[i] = eina_tmpstr_add(buf);
fail_if(strcmp(buf, tmp_strings[i]));
ck_assert(strcmp(buf, tmp_strings[i]));
}
// Delete these tmp strings
@ -47,7 +47,7 @@ EFL_START_TEST(tmpstr_simple)
{
snprintf(buf, max_str_len, "Tmp string %d", (cnt_tmp_strings - i - 1 + 1));
fail_if(strcmp(buf, tmp_strings[cnt_tmp_strings - i - 1]));
ck_assert(strcmp(buf, tmp_strings[cnt_tmp_strings - i - 1]));
eina_tmpstr_del(tmp_strings[cnt_tmp_strings - i - 1]);
tmp_strings[cnt_tmp_strings - i - 1] = 0;
@ -73,7 +73,7 @@ EFL_START_TEST(tmpstr_simple_len)
snprintf(buf, max_str_len, "Tmp string %d", (i + 1));
tmp_strings[i] = eina_tmpstr_add_length(buf, (max_str_len + 1));
fail_if(strcmp(buf, tmp_strings[i]));
ck_assert(strcmp(buf, tmp_strings[i]));
}
// Delete these tmp strings
@ -81,7 +81,7 @@ EFL_START_TEST(tmpstr_simple_len)
{
snprintf(buf, max_str_len, "Tmp string %d", (cnt_tmp_strings - i - 1 + 1));
fail_if(strcmp(buf, tmp_strings[cnt_tmp_strings - i - 1]));
ck_assert(strcmp(buf, tmp_strings[cnt_tmp_strings - i - 1]));
eina_tmpstr_del(tmp_strings[cnt_tmp_strings - i - 1]);
tmp_strings[cnt_tmp_strings - i - 1] = 0;
@ -99,7 +99,7 @@ EFL_START_TEST(tmpstr_manage)
char *buf = malloc(7);
strcpy(buf, "tmpstr");
Eina_Tmpstr *tstr1 = eina_tmpstr_manage_new(buf);
fail_if(strcmp(buf, tstr1));
ck_assert(strcmp(buf, tstr1));
eina_tmpstr_del(tstr1);
}
@ -111,7 +111,7 @@ EFL_START_TEST(tmpstr_manage_len)
char *buf = malloc(10);
strcpy(buf, "tmpstr");
Eina_Tmpstr *tstr1 = eina_tmpstr_manage_new_length(buf, 7);
fail_if(strcmp(buf, tstr1));
ck_assert(strcmp(buf, tstr1));
eina_tmpstr_del(tstr1);
}

View File

@ -34,38 +34,38 @@ EFL_START_TEST(trash_simple)
trash = calloc(1, sizeof(Eina_Trash));
fail_if(trash == NULL);
ck_assert(trash == NULL);
eina_trash_init(&trash);
for (i = 1; i < 51; ++i)
{
array = eina_array_new(1);
fail_if(!array);
ck_assert(!array);
eina_array_push(array, &inp_int);
eina_trash_push(&trash, array);
array = eina_array_new(1);
fail_if(!array);
ck_assert(!array);
eina_array_push(array, &inp_char);
eina_trash_push(&trash, array);
}
data = eina_trash_pop(&trash);
fail_if(!data);
fail_if(*((char *)eina_array_data_get(data, 0)) != inp_char);
ck_assert(!data);
ck_assert(*((char *)eina_array_data_get(data, 0)) != inp_char);
data = eina_trash_pop(&trash);
fail_if(!data);
fail_if(*((int *)eina_array_data_get(data, 0)) != inp_int);
ck_assert(!data);
ck_assert(*((int *)eina_array_data_get(data, 0)) != inp_int);
free(data);
i = 0;
EINA_TRASH_CLEAN(&trash, data)
{
fail_if(!data);
ck_assert(!data);
free(data);
++i;
}
fail_if(i != 98);
ck_assert(i != 98);
}
EFL_END_TEST

View File

@ -76,25 +76,25 @@ EFL_START_TEST(eina_unicode_strcmp_test)
{
/* 1 & 2 */
fail_if(eina_unicode_strcmp(STR1,STR2) == 0);
fail_if(eina_unicode_strcmp(STR1,STR2) < 1);
ck_assert(eina_unicode_strcmp(STR1,STR2) == 0);
ck_assert(eina_unicode_strcmp(STR1,STR2) < 1);
/* 1 & 3 */
fail_if(eina_unicode_strcmp(STR1, STR3) != 0);
ck_assert(eina_unicode_strcmp(STR1, STR3) != 0);
/* 1 & 4 */
fail_if(eina_unicode_strcmp(STR1, STR4) == 0);
fail_if(eina_unicode_strcmp(STR1, STR4) > 1);
ck_assert(eina_unicode_strcmp(STR1, STR4) == 0);
ck_assert(eina_unicode_strcmp(STR1, STR4) > 1);
/* 1 & empty */
fail_if(eina_unicode_strcmp(STR1, EMPTYSTR) < 1);
ck_assert(eina_unicode_strcmp(STR1, EMPTYSTR) < 1);
/* Self tests */
fail_if(eina_unicode_strcmp(STR1, STR1) != 0);
fail_if(eina_unicode_strcmp(STR2, STR2) != 0);
fail_if(eina_unicode_strcmp(STR3, STR3) != 0);
fail_if(eina_unicode_strcmp(STR4, STR4) != 0);
fail_if(eina_unicode_strcmp(EMPTYSTR, EMPTYSTR) != 0);
ck_assert(eina_unicode_strcmp(STR1, STR1) != 0);
ck_assert(eina_unicode_strcmp(STR2, STR2) != 0);
ck_assert(eina_unicode_strcmp(STR3, STR3) != 0);
ck_assert(eina_unicode_strcmp(STR4, STR4) != 0);
ck_assert(eina_unicode_strcmp(EMPTYSTR, EMPTYSTR) != 0);
}
EFL_END_TEST
@ -106,29 +106,29 @@ EFL_START_TEST(eina_unicode_strcpy_test)
rv = eina_unicode_strcpy(buf,STR1);
fail_if(rv != buf);
fail_if(eina_unicode_strcmp(buf,STR1) != 0);
ck_assert(rv != buf);
ck_assert(eina_unicode_strcmp(buf,STR1) != 0);
rv = eina_unicode_strcpy(buf,STR2);
fail_if(rv != buf);
fail_if(eina_unicode_strcmp(buf,STR2) != 0);
ck_assert(rv != buf);
ck_assert(eina_unicode_strcmp(buf,STR2) != 0);
/* Now a shorter string */
rv = eina_unicode_strcpy(buf,STR2);
fail_if(rv != buf);
fail_if(eina_unicode_strcmp(buf,STR2) != 0);
ck_assert(rv != buf);
ck_assert(eina_unicode_strcmp(buf,STR2) != 0);
/* Really short string */
rv = eina_unicode_strcpy(buf,STR4);
fail_if(rv != buf);
fail_if(eina_unicode_strcmp(buf,STR4) != 0);
fail_if(buf[2] != 'n'); /* check old buf is there */
ck_assert(rv != buf);
ck_assert(eina_unicode_strcmp(buf,STR4) != 0);
ck_assert(buf[2] != 'n'); /* check old buf is there */
buf[1] = '7';
rv = eina_unicode_strcpy(buf,EMPTYSTR);
fail_if(rv != buf);
fail_if(buf[0] != 0);
fail_if(buf[1] != '7');
ck_assert(rv != buf);
ck_assert(buf[0] != 0);
ck_assert(buf[1] != '7');
}
EFL_END_TEST
@ -140,24 +140,24 @@ EFL_START_TEST(eina_unicode_strncpy_test)
rv = eina_unicode_strncpy(buf,STR1,9);
fail_if(rv != buf);
fail_if(eina_unicode_strcmp(buf,STR1) != 0);
ck_assert(rv != buf);
ck_assert(eina_unicode_strcmp(buf,STR1) != 0);
buf[1] = '7';
rv = eina_unicode_strncpy(buf,STR1,1);
fail_if(rv != buf);
fail_if(buf[1] != '7');
fail_if(buf[0] != STR1[0]);
ck_assert(rv != buf);
ck_assert(buf[1] != '7');
ck_assert(buf[0] != STR1[0]);
buf[9] = '7';
rv = eina_unicode_strncpy(buf, STR4, 10);
fail_if(rv != buf);
fail_if(eina_unicode_strcmp(buf,STR4) != 0);
fail_if(buf[9] != 0);
ck_assert(rv != buf);
ck_assert(eina_unicode_strcmp(buf,STR4) != 0);
ck_assert(buf[9] != 0);
buf[0] = '7';
eina_unicode_strncpy(buf, STR1, 0);
fail_if(buf[0] != '7');
ck_assert(buf[0] != '7');
#ifdef EINA_SAFETY_CHECKS
{
@ -178,8 +178,8 @@ EFL_START_TEST(eina_unicode_strncpy_test)
TEST_MAGIC_SAFETY("eina_unicode_strncpy",
"safety check failed: source == NULL");
rv = eina_unicode_strncpy(buf, NULL, 0);
fail_if(buf[0] != '7');
fail_unless(ctx.did);
ck_assert(buf[0] != '7');
ck_assert(ctx.did);
/* Hopefully won't segfault */
#ifdef SHOW_LOG
@ -188,8 +188,8 @@ EFL_START_TEST(eina_unicode_strncpy_test)
TEST_MAGIC_SAFETY("eina_unicode_strncpy",
"safety check failed: dest == NULL");
rv = eina_unicode_strncpy(NULL, STR1, 0);
fail_if(rv != NULL);
fail_unless(ctx.did);
ck_assert(rv != NULL);
ck_assert(ctx.did);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
#undef TEST_MAGIC_SAFETY
@ -205,11 +205,11 @@ EFL_START_TEST(eina_ustr_strlen_test)
{
fail_if(eina_unicode_strlen(STR1) != 8);
fail_if(eina_unicode_strlen(STR2) != 9);
fail_if(eina_unicode_strlen(STR3) != 8);
fail_if(eina_unicode_strlen(STR4) != 1);
fail_if(eina_unicode_strlen(EMPTYSTR) != 0);
ck_assert(eina_unicode_strlen(STR1) != 8);
ck_assert(eina_unicode_strlen(STR2) != 9);
ck_assert(eina_unicode_strlen(STR3) != 8);
ck_assert(eina_unicode_strlen(STR4) != 1);
ck_assert(eina_unicode_strlen(EMPTYSTR) != 0);
#ifdef EINA_SAFETY_CHECKS
{
@ -227,8 +227,8 @@ EFL_START_TEST(eina_ustr_strlen_test)
#endif
TEST_MAGIC_SAFETY("eina_unicode_strlen",
"safety check failed: ustr == NULL");
fail_if(eina_unicode_strlen(NULL));
fail_unless(ctx.did);
ck_assert(eina_unicode_strlen(NULL));
ck_assert(ctx.did);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
#undef TEST_MAGIC_SAFETY
@ -242,17 +242,17 @@ EFL_START_TEST(eina_unicode_strnlen_test)
{
/* Strlen style tests*/
fail_if(eina_unicode_strnlen(STR1,10) != 8);
fail_if(eina_unicode_strnlen(STR2,10) != 9);
fail_if(eina_unicode_strnlen(STR3,10) != 8);
fail_if(eina_unicode_strnlen(STR4,10) != 1);
fail_if(eina_unicode_strnlen(EMPTYSTR,10) != 0);
ck_assert(eina_unicode_strnlen(STR1,10) != 8);
ck_assert(eina_unicode_strnlen(STR2,10) != 9);
ck_assert(eina_unicode_strnlen(STR3,10) != 8);
ck_assert(eina_unicode_strnlen(STR4,10) != 1);
ck_assert(eina_unicode_strnlen(EMPTYSTR,10) != 0);
/* Too short tests */
fail_if(eina_unicode_strnlen(STR1,3) != 3);
fail_if(eina_unicode_strnlen(STR2,3) != 3);
fail_if(eina_unicode_strnlen(STR3,3) != 3);
fail_if(eina_unicode_strnlen(EMPTYSTR,1) != 0);
ck_assert(eina_unicode_strnlen(STR1,3) != 3);
ck_assert(eina_unicode_strnlen(STR2,3) != 3);
ck_assert(eina_unicode_strnlen(STR3,3) != 3);
ck_assert(eina_unicode_strnlen(EMPTYSTR,1) != 0);
#ifdef EINA_SAFETY_CHECKS
{
@ -270,8 +270,8 @@ EFL_START_TEST(eina_unicode_strnlen_test)
#endif
TEST_MAGIC_SAFETY("eina_unicode_strnlen",
"safety check failed: ustr == NULL");
fail_if(eina_unicode_strnlen(NULL,0) != 0);
fail_unless(ctx.did);
ck_assert(eina_unicode_strnlen(NULL,0) != 0);
ck_assert(ctx.did);
eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
#undef TEST_MAGIC_SAFETY
@ -287,14 +287,14 @@ EFL_START_TEST(eina_unicode_strdup_test)
buf = eina_unicode_strdup(STR1);
fail_if(!buf);
fail_if(eina_unicode_strlen(buf) != eina_unicode_strlen(STR1));
fail_if(eina_unicode_strcmp(buf, STR1));
ck_assert(!buf);
ck_assert(eina_unicode_strlen(buf) != eina_unicode_strlen(STR1));
ck_assert(eina_unicode_strcmp(buf, STR1));
free(buf);
buf = eina_unicode_strdup(EMPTYSTR);
fail_if(!buf);
fail_if(buf[0] != 0);
ck_assert(!buf);
ck_assert(buf[0] != 0);
free(buf);
}
EFL_END_TEST
@ -306,19 +306,19 @@ EFL_START_TEST(eina_unicode_strstr_test)
buf = eina_unicode_strstr(STR1,on);
fail_if(!buf);
fail_if(buf != STR1 + 6);
fail_if(eina_unicode_strcmp(buf,on) != 0);
ck_assert(!buf);
ck_assert(buf != STR1 + 6);
ck_assert(eina_unicode_strcmp(buf,on) != 0);
buf = eina_unicode_strstr(STR2,on);
fail_if(buf);
ck_assert(buf);
buf = eina_unicode_strstr(EMPTYSTR, on);
fail_if(buf);
ck_assert(buf);
buf = eina_unicode_strstr(STR1, EMPTYSTR);
fail_if(!buf);
fail_if(buf != STR1);
ck_assert(!buf);
ck_assert(buf != STR1);
}
EFL_END_TEST
@ -338,9 +338,9 @@ EFL_START_TEST(eina_unicode_escape_test)
for (i = 0; i < sizeof(str)/sizeof(str[0]); ++i)
{
buf = eina_unicode_escape(str[i]);
fail_if(!buf);
fail_if(eina_unicode_strlen(buf) != eina_unicode_strlen(result_str[i]));
fail_if(eina_unicode_strcmp(buf, result_str[i]) != 0);
ck_assert(!buf);
ck_assert(eina_unicode_strlen(buf) != eina_unicode_strlen(result_str[i]));
ck_assert(eina_unicode_strcmp(buf, result_str[i]) != 0);
free(buf);
}
@ -355,80 +355,80 @@ EFL_START_TEST(eina_unicode_utf8)
/* Valid utf-8 cases */
/* First possible sequence of a certain length */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\x00", &ind) != 0x00) ||
ck_assert((eina_unicode_utf8_next_get("\x00", &ind) != 0x00) ||
(ind != 0));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\x01", &ind) != 0x01) ||
ck_assert((eina_unicode_utf8_next_get("\x01", &ind) != 0x01) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xC2\x80", &ind) != 0x80) ||
ck_assert((eina_unicode_utf8_next_get("\xC2\x80", &ind) != 0x80) ||
(ind != 2));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xE0\xA0\x80", &ind) != 0x800) ||
ck_assert((eina_unicode_utf8_next_get("\xE0\xA0\x80", &ind) != 0x800) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF0\x90\x80\x80", &ind) != 0x10000) ||
ck_assert((eina_unicode_utf8_next_get("\xF0\x90\x80\x80", &ind) != 0x10000) ||
(ind != 4));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF8\x88\x80\x80\x80", &ind) != 0x200000) || (ind != 5));
ck_assert((eina_unicode_utf8_next_get("\xF8\x88\x80\x80\x80", &ind) != 0x200000) || (ind != 5));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFC\x84\x80\x80\x80\x80", &ind) != 0x4000000) || (ind != 6));
ck_assert((eina_unicode_utf8_next_get("\xFC\x84\x80\x80\x80\x80", &ind) != 0x4000000) || (ind != 6));
/* Last possible sequence of a certain length */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\x7F", &ind) != 0x7F) ||
ck_assert((eina_unicode_utf8_next_get("\x7F", &ind) != 0x7F) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xDF\xBF", &ind) != 0x7FF) ||
ck_assert((eina_unicode_utf8_next_get("\xDF\xBF", &ind) != 0x7FF) ||
(ind != 2));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xEF\xBF\xBF", &ind) != 0xFFFF) ||
ck_assert((eina_unicode_utf8_next_get("\xEF\xBF\xBF", &ind) != 0xFFFF) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF7\xBF\xBF\xBF", &ind) != 0x1FFFFF) ||
ck_assert((eina_unicode_utf8_next_get("\xF7\xBF\xBF\xBF", &ind) != 0x1FFFFF) ||
(ind != 4));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFB\xBF\xBF\xBF\xBF", &ind) != 0x3FFFFFF) || (ind != 5));
ck_assert((eina_unicode_utf8_next_get("\xFB\xBF\xBF\xBF\xBF", &ind) != 0x3FFFFFF) || (ind != 5));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFD\xBF\xBF\xBF\xBF\xBF", &ind) != 0x7FFFFFFF) || (ind != 6));
ck_assert((eina_unicode_utf8_next_get("\xFD\xBF\xBF\xBF\xBF\xBF", &ind) != 0x7FFFFFFF) || (ind != 6));
/* Other boundary conditions */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xED\x9F\xBF", &ind) != 0xD7FF) ||
ck_assert((eina_unicode_utf8_next_get("\xED\x9F\xBF", &ind) != 0xD7FF) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xEE\x80\x80", &ind) != 0xE000) ||
ck_assert((eina_unicode_utf8_next_get("\xEE\x80\x80", &ind) != 0xE000) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xEF\xBF\xBD", &ind) != 0xFFFD) ||
ck_assert((eina_unicode_utf8_next_get("\xEF\xBF\xBD", &ind) != 0xFFFD) ||
(ind != 3));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF4\x8F\xBF\xBF", &ind) != 0x10FFFF) ||
ck_assert((eina_unicode_utf8_next_get("\xF4\x8F\xBF\xBF", &ind) != 0x10FFFF) ||
(ind != 4));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF4\x90\x80\x80", &ind) != 0x110000) ||
ck_assert((eina_unicode_utf8_next_get("\xF4\x90\x80\x80", &ind) != 0x110000) ||
(ind != 4));
/* Error cases */
/* Standalone continuation bytes */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\x80", &ind) != 0xDC80) ||
ck_assert((eina_unicode_utf8_next_get("\x80", &ind) != 0xDC80) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xBF", &ind) != 0xDCBF) ||
ck_assert((eina_unicode_utf8_next_get("\xBF", &ind) != 0xDCBF) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\x80\xBF", &ind) != 0xDC80) ||
ck_assert((eina_unicode_utf8_next_get("\x80\xBF", &ind) != 0xDC80) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xBF\x80", &ind) != 0xDCBF) ||
ck_assert((eina_unicode_utf8_next_get("\xBF\x80", &ind) != 0xDCBF) ||
(ind != 1));
/* All possible continuation bytes */
for (ch = 0x80 ; ch <= 0xBF ; ch++)
{
char buf[] = {ch, 0};
ind = 0;
fail_if((eina_unicode_utf8_next_get(buf, &ind) != (0xDC00 | ch)) ||
ck_assert((eina_unicode_utf8_next_get(buf, &ind) != (0xDC00 | ch)) ||
(ind != 1));
}
@ -446,9 +446,9 @@ EFL_START_TEST(eina_unicode_utf8)
ind = 0; \
for (i = 0, ch = start ; ch <= end ; ch++) \
{ \
fail_if((eina_unicode_utf8_next_get(buf, &ind) != (0xDC00 | ch)) || \
ck_assert((eina_unicode_utf8_next_get(buf, &ind) != (0xDC00 | ch)) || \
(ind != ++i)); \
fail_if((eina_unicode_utf8_next_get(buf, &ind) != 0x20) || \
ck_assert((eina_unicode_utf8_next_get(buf, &ind) != 0x20) || \
(ind != ++i)); \
} \
} \
@ -482,13 +482,13 @@ EFL_START_TEST(eina_unicode_utf8)
} \
buf[j] = 0; \
ind = 0; \
fail_if( \
ck_assert( \
(eina_unicode_utf8_next_get(buf, &ind) != (0xDC00 | first))); \
while ((val = eina_unicode_utf8_next_get(buf, &ind))) \
{ \
fail_if(val != (0xDC00 | conti)); \
ck_assert(val != (0xDC00 | conti)); \
} \
fail_if(ind != i); \
ck_assert(ind != i); \
} \
} \
while (0)
@ -507,54 +507,54 @@ EFL_START_TEST(eina_unicode_utf8)
/* Impossible bytes */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFE", &ind) != 0xDCFE) ||
ck_assert((eina_unicode_utf8_next_get("\xFE", &ind) != 0xDCFE) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFF", &ind) != 0xDCFF) ||
ck_assert((eina_unicode_utf8_next_get("\xFF", &ind) != 0xDCFF) ||
(ind != 1));
/* Overlong sequences */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xC0\xAF", &ind) != 0xDCC0) ||
ck_assert((eina_unicode_utf8_next_get("\xC0\xAF", &ind) != 0xDCC0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xE0\x80\xAF", &ind) != 0xDCE0) ||
ck_assert((eina_unicode_utf8_next_get("\xE0\x80\xAF", &ind) != 0xDCE0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF0\x80\x80\xAF", &ind) != 0xDCF0) ||
ck_assert((eina_unicode_utf8_next_get("\xF0\x80\x80\xAF", &ind) != 0xDCF0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF8\x80\x80\x80\xAF", &ind) != 0xDCF8) ||
ck_assert((eina_unicode_utf8_next_get("\xF8\x80\x80\x80\xAF", &ind) != 0xDCF8) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFC\x80\x80\x80\x80\xAF", &ind) != 0xDCFC) ||
ck_assert((eina_unicode_utf8_next_get("\xFC\x80\x80\x80\x80\xAF", &ind) != 0xDCFC) ||
(ind != 1));
/* Maximum overlong sequences */
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xC1\xBF", &ind) != 0xDCC1) ||
ck_assert((eina_unicode_utf8_next_get("\xC1\xBF", &ind) != 0xDCC1) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xE0\x9F\xBF", &ind) != 0xDCE0) ||
ck_assert((eina_unicode_utf8_next_get("\xE0\x9F\xBF", &ind) != 0xDCE0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF0\x8F\xBF\xBF", &ind) != 0xDCF0) ||
ck_assert((eina_unicode_utf8_next_get("\xF0\x8F\xBF\xBF", &ind) != 0xDCF0) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xF8\x87\xBF\xBF\xBF", &ind) != 0xDCF8) ||
ck_assert((eina_unicode_utf8_next_get("\xF8\x87\xBF\xBF\xBF", &ind) != 0xDCF8) ||
(ind != 1));
ind = 0;
fail_if((eina_unicode_utf8_next_get("\xFC\x83\xBF\xBF\xBF\xBF", &ind) != 0xDCFC) ||
ck_assert((eina_unicode_utf8_next_get("\xFC\x83\xBF\xBF\xBF\xBF", &ind) != 0xDCFC) ||
(ind != 1));
/* Add some more error cases here */
/* Just to cover prev/len. General utf-8 parsing was covered above */
fail_if(eina_unicode_utf8_get_len("\xF4\x90\x80\x80\xF4\x8F\xBF\xBF") != 2);
ck_assert(eina_unicode_utf8_get_len("\xF4\x90\x80\x80\xF4\x8F\xBF\xBF") != 2);
ind = 0;
fail_if((eina_unicode_utf8_get_prev("\xED\x9F\xBF", &ind) != 0xD7FF) ||
ck_assert((eina_unicode_utf8_get_prev("\xED\x9F\xBF", &ind) != 0xD7FF) ||
(ind != 0));
ind = 3;
fail_if((eina_unicode_utf8_get_prev("\xED\x9F\xBF", &ind) != 0x00) ||
ck_assert((eina_unicode_utf8_get_prev("\xED\x9F\xBF", &ind) != 0x00) ||
(ind != 0));
}
@ -576,11 +576,11 @@ EFL_START_TEST(eina_unicode_utf8_conversion)
uni_out = eina_unicode_utf8_to_unicode(c_in, &len);
fail_if((len != 9) || eina_unicode_strcmp(uni_in, uni_out));
ck_assert((len != 9) || eina_unicode_strcmp(uni_in, uni_out));
free(uni_out);
c_out = eina_unicode_unicode_to_utf8(uni_in, &len);
fail_if((len != 24) || strcmp(c_in, c_out));
ck_assert((len != 24) || strcmp(c_in, c_out));
free(c_out);
/* Range conversion */

View File

@ -41,16 +41,16 @@ EFL_START_TEST(eina_ustringshare_simple)
t0 = eina_ustringshare_add(TEST0);
t1 = eina_ustringshare_add(TEST1);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(eina_unicode_strcmp(t0, TEST0) != 0);
fail_if(eina_unicode_strcmp(t1, TEST1) != 0);
fail_if((int)eina_unicode_strlen(TEST0) != eina_ustringshare_strlen(t0));
fail_if((int)eina_unicode_strlen(TEST1) != eina_ustringshare_strlen(t1));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(eina_unicode_strcmp(t0, TEST0) != 0);
ck_assert(eina_unicode_strcmp(t1, TEST1) != 0);
ck_assert((int)eina_unicode_strlen(TEST0) != eina_ustringshare_strlen(t0));
ck_assert((int)eina_unicode_strlen(TEST1) != eina_ustringshare_strlen(t1));
t0 = eina_ustringshare_ref(t0);
fail_if(t0 == NULL);
fail_if((int)strlen((char*)TEST0) != eina_stringshare_strlen((const char*)t0));
ck_assert(t0 == NULL);
ck_assert((int)strlen((char*)TEST0) != eina_stringshare_strlen((const char*)t0));
eina_ustringshare_del(t0);
eina_ustringshare_del(t0);
@ -69,13 +69,13 @@ EFL_START_TEST(eina_ustringshare_test_share)
t0 = eina_ustringshare_add(TEST0);
t1 = eina_ustringshare_add(TEST0);
fail_if(t0 == NULL);
fail_if(t1 == NULL);
fail_if(eina_unicode_strcmp(t0, TEST0) != 0);
fail_if(eina_unicode_strcmp(t1, TEST0) != 0);
fail_if(t0 != t1);
fail_if((int)eina_unicode_strlen(TEST0) != eina_ustringshare_strlen(t0));
fail_if((int)eina_unicode_strlen(TEST0) != eina_ustringshare_strlen(t1));
ck_assert(t0 == NULL);
ck_assert(t1 == NULL);
ck_assert(eina_unicode_strcmp(t0, TEST0) != 0);
ck_assert(eina_unicode_strcmp(t1, TEST0) != 0);
ck_assert(t0 != t1);
ck_assert((int)eina_unicode_strlen(TEST0) != eina_ustringshare_strlen(t0));
ck_assert((int)eina_unicode_strlen(TEST0) != eina_ustringshare_strlen(t1));
eina_ustringshare_del(t0);
eina_ustringshare_del(t1);
@ -98,8 +98,8 @@ EFL_START_TEST(eina_ustringshare_putstuff)
build[7] = i;
build[8] = 0;
tmp = eina_ustringshare_add(build);
fail_if(tmp != eina_ustringshare_add(build));
fail_if((int)eina_unicode_strlen(build) != eina_ustringshare_strlen(tmp));
ck_assert(tmp != eina_ustringshare_add(build));
ck_assert((int)eina_unicode_strlen(build) != eina_ustringshare_strlen(tmp));
}
}

File diff suppressed because it is too large Load Diff

View File

@ -42,54 +42,54 @@ EFL_START_TEST(eina_test_vector2_operations)
eina_vector2_set(&v1, x, y);
fail_if(!EINA_DBL_EQ(v1.x, 1) || !EINA_DBL_EQ(v1.y, 2));
ck_assert(!EINA_DBL_EQ(v1.x, 1) || !EINA_DBL_EQ(v1.y, 2));
eina_vector2_array_set(&v2, arr);
fail_if(!EINA_DBL_EQ(v2.x, 5) || !EINA_DBL_EQ(v2.y, 5));
ck_assert(!EINA_DBL_EQ(v2.x, 5) || !EINA_DBL_EQ(v2.y, 5));
eina_vector2_copy(&v1, &v2);
fail_if(!EINA_DBL_EQ(v1.x, 5) || !EINA_DBL_EQ(v1.y, 5));
ck_assert(!EINA_DBL_EQ(v1.x, 5) || !EINA_DBL_EQ(v1.y, 5));
eina_vector2_negate(&v1, &v2);
fail_if(!EINA_DBL_EQ(v1.x, -5) || !EINA_DBL_EQ(v1.y, -5));
ck_assert(!EINA_DBL_EQ(v1.x, -5) || !EINA_DBL_EQ(v1.y, -5));
eina_vector2_set(&v1, x, y);
eina_vector2_add(&v3, &v1, &v2);
fail_if(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 7));
ck_assert(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 7));
eina_vector2_subtract(&v3, &v2, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 4) || !EINA_DBL_EQ(v3.y, 3));
ck_assert(!EINA_DBL_EQ(v3.x, 4) || !EINA_DBL_EQ(v3.y, 3));
eina_vector2_scale(&v3, &v1, y);
fail_if(!EINA_DBL_EQ(v3.x, 2) || !EINA_DBL_EQ(v3.y, 4));
ck_assert(!EINA_DBL_EQ(v3.x, 2) || !EINA_DBL_EQ(v3.y, 4));
res = eina_vector2_dot_product(&v1, &v2);
fail_if(!EINA_DBL_EQ(res, 15));
ck_assert(!EINA_DBL_EQ(res, 15));
res = eina_vector2_length_get(&v2);
fail_if((res - sqrt(50)) > DBL_EPSILON);
ck_assert((res - sqrt(50)) > DBL_EPSILON);
res = eina_vector2_length_square_get(&v2);
fail_if(!EINA_DBL_EQ(res, 50));
ck_assert(!EINA_DBL_EQ(res, 50));
res = eina_vector2_distance_get(&v2, &v1);
fail_if((res - sqrt(25)) > DBL_EPSILON);
ck_assert((res - sqrt(25)) > DBL_EPSILON);
res = eina_vector2_distance_square_get(&v2, &v1);
fail_if(!EINA_DBL_EQ(res, 25));
ck_assert(!EINA_DBL_EQ(res, 25));
eina_vector2_normalize(&v3, &v2);
fail_if((v3.x - v2.x / sqrt(50)) > DBL_EPSILON ||
ck_assert((v3.x - v2.x / sqrt(50)) > DBL_EPSILON ||
(v3.y - v2.y / sqrt(50)) > DBL_EPSILON);
eina_matrix2_values_set(&m2,
2, 2,
2, 2);
eina_vector2_transform(&v3, &m2, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 6));
ck_assert(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 6));
eina_vector2_transform(&v3, &m2, &v3);
fail_if(!EINA_DBL_EQ(v3.x, 24) || !EINA_DBL_EQ(v3.y, 24));
ck_assert(!EINA_DBL_EQ(v3.x, 24) || !EINA_DBL_EQ(v3.y, 24));
eina_matrix3_values_set(&m3,
2, 2, 2,
@ -97,14 +97,14 @@ EFL_START_TEST(eina_test_vector2_operations)
2, 2, 2);
eina_vector2_homogeneous_position_transform(&v3, &m3, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 1) || !EINA_DBL_EQ(v3.y, 1));
ck_assert(!EINA_DBL_EQ(v3.x, 1) || !EINA_DBL_EQ(v3.y, 1));
eina_vector2_homogeneous_direction_transform(&v3, &m3, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 6));
ck_assert(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 6));
eina_vector2_homogeneous_direction_transform(&v3, &m3, &v3);
fail_if(!EINA_DBL_EQ(v3.x, 24) || !EINA_DBL_EQ(v3.y, 24));
ck_assert(!EINA_DBL_EQ(v3.x, 24) || !EINA_DBL_EQ(v3.y, 24));
}
EFL_END_TEST
@ -126,69 +126,69 @@ EFL_START_TEST(eina_test_vector3_operations)
eina_vector3_set(&v1, x, y, z);
fail_if(!EINA_DBL_EQ(v1.x, 1) || !EINA_DBL_EQ(v1.y, 2) || !EINA_DBL_EQ(v1.z, 3));
ck_assert(!EINA_DBL_EQ(v1.x, 1) || !EINA_DBL_EQ(v1.y, 2) || !EINA_DBL_EQ(v1.z, 3));
eina_vector3_array_set(&v2, arr);
fail_if(!EINA_DBL_EQ(v2.x, 5) || !EINA_DBL_EQ(v2.y, 5) || !EINA_DBL_EQ(v2.z, 5));
ck_assert(!EINA_DBL_EQ(v2.x, 5) || !EINA_DBL_EQ(v2.y, 5) || !EINA_DBL_EQ(v2.z, 5));
eina_vector3_copy(&v1, &v2);
fail_if(!EINA_DBL_EQ(v1.x, 5) || !EINA_DBL_EQ(v1.y, 5) || !EINA_DBL_EQ(v1.z, 5));
ck_assert(!EINA_DBL_EQ(v1.x, 5) || !EINA_DBL_EQ(v1.y, 5) || !EINA_DBL_EQ(v1.z, 5));
eina_vector3_negate(&v1, &v2);
fail_if(!EINA_DBL_EQ(v1.x, -5) || !EINA_DBL_EQ(v1.y, -5) || !EINA_DBL_EQ(v1.z, -5));
ck_assert(!EINA_DBL_EQ(v1.x, -5) || !EINA_DBL_EQ(v1.y, -5) || !EINA_DBL_EQ(v1.z, -5));
eina_vector3_set(&v1, x, y, z);
eina_vector3_add(&v3, &v1, &v2);
fail_if(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 7) || !EINA_DBL_EQ(v3.z, 8));
ck_assert(!EINA_DBL_EQ(v3.x, 6) || !EINA_DBL_EQ(v3.y, 7) || !EINA_DBL_EQ(v3.z, 8));
eina_vector3_subtract(&v3, &v2, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 4) || !EINA_DBL_EQ(v3.y, 3) || !EINA_DBL_EQ(v3.z, 2));
ck_assert(!EINA_DBL_EQ(v3.x, 4) || !EINA_DBL_EQ(v3.y, 3) || !EINA_DBL_EQ(v3.z, 2));
eina_vector3_scale(&v3, &v1, y);
fail_if(!EINA_DBL_EQ(v3.x, 2) || !EINA_DBL_EQ(v3.y, 4) || !EINA_DBL_EQ(v3.z, 6));
ck_assert(!EINA_DBL_EQ(v3.x, 2) || !EINA_DBL_EQ(v3.y, 4) || !EINA_DBL_EQ(v3.z, 6));
eina_vector3_multiply(&v3, &v2, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 5) || !EINA_DBL_EQ(v3.y, 10) || !EINA_DBL_EQ(v3.z, 15));
ck_assert(!EINA_DBL_EQ(v3.x, 5) || !EINA_DBL_EQ(v3.y, 10) || !EINA_DBL_EQ(v3.z, 15));
res = eina_vector3_dot_product(&v1, &v2);
fail_if(!EINA_DBL_EQ(res, 30));
ck_assert(!EINA_DBL_EQ(res, 30));
eina_vector3_cross_product(&v3, &v1, &v2);
fail_if(!EINA_DBL_EQ(v3.x, -5) || !EINA_DBL_EQ(v3.y, 10) || !EINA_DBL_EQ(v3.z, -5));
ck_assert(!EINA_DBL_EQ(v3.x, -5) || !EINA_DBL_EQ(v3.y, 10) || !EINA_DBL_EQ(v3.z, -5));
eina_vector3_cross_product(&v3, &v1, &v3);
fail_if(!EINA_DBL_EQ(v3.x, -40) || !EINA_DBL_EQ(v3.y, -10) || !EINA_DBL_EQ(v3.z, 20));
ck_assert(!EINA_DBL_EQ(v3.x, -40) || !EINA_DBL_EQ(v3.y, -10) || !EINA_DBL_EQ(v3.z, 20));
res = eina_vector3_length_get(&v2);
fail_if((res - sqrt(75)) > DBL_EPSILON);
ck_assert((res - sqrt(75)) > DBL_EPSILON);
res = eina_vector3_length_square_get(&v2);
fail_if(!EINA_DBL_EQ(res, 75));
ck_assert(!EINA_DBL_EQ(res, 75));
res = eina_vector3_distance_get(&v2, &v1);
fail_if((res - sqrt(29)) > (DBL_EPSILON * 2.0));
ck_assert((res - sqrt(29)) > (DBL_EPSILON * 2.0));
res = eina_vector3_distance_square_get(&v2, &v1);
fail_if(!EINA_DBL_EQ(res, 29));
ck_assert(!EINA_DBL_EQ(res, 29));
eina_vector3_normalize(&v3, &v2);
fail_if((v3.x - v2.x / sqrt(75)) > DBL_EPSILON ||
ck_assert((v3.x - v2.x / sqrt(75)) > DBL_EPSILON ||
(v3.y - v2.y / sqrt(75)) > DBL_EPSILON ||
(v3.z - v2.z / sqrt(75)) > DBL_EPSILON);
res = eina_vector3_angle_get(&v1, &v2);
fail_if((res - (30 / (sqrt(14) * sqrt(75)))) > DBL_EPSILON);
ck_assert((res - (30 / (sqrt(14) * sqrt(75)))) > DBL_EPSILON);
eina_matrix3_values_set(&m3,
2, 2, 2,
2, 2, 2,
2, 2, 2);
eina_vector3_transform(&v3, &m3, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 12) || !EINA_DBL_EQ(v3.y, 12) || !EINA_DBL_EQ(v3.z, 12));
ck_assert(!EINA_DBL_EQ(v3.x, 12) || !EINA_DBL_EQ(v3.y, 12) || !EINA_DBL_EQ(v3.z, 12));
eina_vector3_transform(&v3, &m3, &v3);
fail_if(!EINA_DBL_EQ(v3.x, 72) || !EINA_DBL_EQ(v3.y, 72) || !EINA_DBL_EQ(v3.z, 72));
ck_assert(!EINA_DBL_EQ(v3.x, 72) || !EINA_DBL_EQ(v3.y, 72) || !EINA_DBL_EQ(v3.z, 72));
eina_matrix4_values_set(&m4,
2, 2, 2, 2,
@ -196,44 +196,44 @@ EFL_START_TEST(eina_test_vector3_operations)
2, 2, 2, 2,
2, 2, 2, 2);
eina_vector3_homogeneous_position_transform(&v3, &m4, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 1) || !EINA_DBL_EQ(v3.y, 1) || !EINA_DBL_EQ(v3.z, 1));
ck_assert(!EINA_DBL_EQ(v3.x, 1) || !EINA_DBL_EQ(v3.y, 1) || !EINA_DBL_EQ(v3.z, 1));
eina_quaternion_set(&q, 2, 2, 2, 0);
eina_vector3_quaternion_rotate(&v3, &v1, &q);
fail_if(!EINA_DBL_EQ(v3.x, 25) || !EINA_DBL_EQ(v3.y, 2) || !EINA_DBL_EQ(v3.z, -21));
ck_assert(!EINA_DBL_EQ(v3.x, 25) || !EINA_DBL_EQ(v3.y, 2) || !EINA_DBL_EQ(v3.z, -21));
eina_vector3_orthogonal_projection_on_plane(&v3, &v1, &v2);
fail_if(!EINA_DBL_EQ(v3.x, -1) || !EINA_DBL_EQ(v3.y, 0) || !EINA_DBL_EQ(v3.z, 1));
ck_assert(!EINA_DBL_EQ(v3.x, -1) || !EINA_DBL_EQ(v3.y, 0) || !EINA_DBL_EQ(v3.z, 1));
eina_vector3_plane_by_points(&q, &v3, &v1, &v2);
fail_if(!EINA_DBL_EQ(q.x, -2) || !EINA_DBL_EQ(q.y, 4) || !EINA_DBL_EQ(q.z, -2) || (q.z > DBL_EPSILON));
ck_assert(!EINA_DBL_EQ(q.x, -2) || !EINA_DBL_EQ(q.y, 4) || !EINA_DBL_EQ(q.z, -2) || (q.z > DBL_EPSILON));
eina_vector3_homogeneous_direction_set(&v3, &q);
fail_if(!EINA_DBL_EQ(v3.x, -2) || !EINA_DBL_EQ(v3.y, 4) || !EINA_DBL_EQ(v3.z, -2));
ck_assert(!EINA_DBL_EQ(v3.x, -2) || !EINA_DBL_EQ(v3.y, 4) || !EINA_DBL_EQ(v3.z, -2));
eina_quaternion_set(&q, 2, 2, 2, 0.5);
eina_vector3_homogeneous_position_set(&v3, &q);
fail_if(!EINA_DBL_EQ(v3.x, 4) || !EINA_DBL_EQ(v3.y, 4) || !EINA_DBL_EQ(v3.z, 4));
ck_assert(!EINA_DBL_EQ(v3.x, 4) || !EINA_DBL_EQ(v3.y, 4) || !EINA_DBL_EQ(v3.z, 4));
res2 = eina_vector3_equivalent(&v1, &v2);
fail_if(res2 != EINA_FALSE);
ck_assert(res2 != EINA_FALSE);
res2 = eina_vector3_equivalent(&v1, &v1);
fail_if(res2 != EINA_TRUE);
ck_assert(res2 != EINA_TRUE);
res2 = eina_vector3_triangle_equivalent(&v1, &v2, &v3,
&v2, &v3, &v1);
fail_if(res2 != EINA_FALSE);
ck_assert(res2 != EINA_FALSE);
res2 = eina_vector3_triangle_equivalent(&v1, &v2, &v3,
&v1, &v2, &v3);
fail_if(res2 != EINA_TRUE);
ck_assert(res2 != EINA_TRUE);
eina_vector3_homogeneous_direction_transform(&v3, &m4, &v1);
fail_if(!EINA_DBL_EQ(v3.x, 12) || !EINA_DBL_EQ(v3.y, 12) || !EINA_DBL_EQ(v3.z, 12));
ck_assert(!EINA_DBL_EQ(v3.x, 12) || !EINA_DBL_EQ(v3.y, 12) || !EINA_DBL_EQ(v3.z, 12));
eina_vector3_homogeneous_direction_transform(&v3, &m4, &v3);
fail_if(!EINA_DBL_EQ(v3.x, 72) || !EINA_DBL_EQ(v3.y, 72) || !EINA_DBL_EQ(v3.z, 72));
ck_assert(!EINA_DBL_EQ(v3.x, 72) || !EINA_DBL_EQ(v3.y, 72) || !EINA_DBL_EQ(v3.z, 72));
}
EFL_END_TEST

View File

@ -53,40 +53,40 @@ EFL_START_TEST(eina_test_xattr_set)
test_file_path = get_file_path(XATTR_TEST_DIR, filename);
fd = open(test_file_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
fail_if(fd == 0);
ck_assert(fd == 0);
ret = eina_xattr_set(test_file_path, attribute1, data1, strlen(data1), EINA_XATTR_INSERT);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret_str = eina_xattr_get(test_file_path, attribute1, &len);
fail_if(ret_str == NULL);
fail_if(len == 0);
fail_if(strcmp(ret_str, data1) != 0);
ck_assert(ret_str == NULL);
ck_assert(len == 0);
ck_assert(strcmp(ret_str, data1) != 0);
free(ret_str);
ret = eina_xattr_set(test_file_path, attribute1, data1, strlen(data1), EINA_XATTR_CREATED);
fail_if(ret != EINA_FALSE);
ck_assert(ret != EINA_FALSE);
ret = eina_xattr_set(test_file_path, attribute1, data2, strlen(data2), EINA_XATTR_REPLACE);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret_str = eina_xattr_get(test_file_path, attribute1, &len);
fail_if(ret_str == NULL);
fail_if(len == 0);
fail_if(strcmp(ret_str, data2) != 0);
ck_assert(ret_str == NULL);
ck_assert(len == 0);
ck_assert(strcmp(ret_str, data2) != 0);
free(ret_str);
ret = eina_xattr_del(test_file_path, attribute1);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret = eina_xattr_fd_set(fd, attribute1, data1, strlen(data1), EINA_XATTR_CREATED);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret_str = eina_xattr_fd_get(fd, attribute1, &len);
fail_if(ret_str == NULL);
fail_if(len == 0);
fail_if(strcmp(ret_str, data1) != 0);
ck_assert(ret_str == NULL);
ck_assert(len == 0);
ck_assert(strcmp(ret_str, data1) != 0);
free(ret_str);
ret = eina_xattr_fd_del(fd, attribute1);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
close(fd);
unlink(test_file_path);
@ -124,14 +124,14 @@ EFL_START_TEST(eina_test_xattr_list)
cp_file_path = get_file_path(XATTR_TEST_DIR, filename_cp);
fd = open(test_file_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
fail_if(fd == 0);
ck_assert(fd == 0);
fd1 = open(cp_file_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
fail_if(fd1 == 0);
ck_assert(fd1 == 0);
for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i)
{
ret = eina_xattr_set(test_file_path, attribute[i], data[i], strlen(data[i]), EINA_XATTR_INSERT);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
}
it = eina_xattr_ls(test_file_path);
@ -144,7 +144,7 @@ EFL_START_TEST(eina_test_xattr_list)
break ;
}
}
fail_if(count != sizeof (attribute) / sizeof (attribute[0]));
ck_assert(count != sizeof (attribute) / sizeof (attribute[0]));
eina_iterator_free(it);
count = 0;
@ -159,7 +159,7 @@ EFL_START_TEST(eina_test_xattr_list)
break ;
}
}
fail_if(count != sizeof (data) / sizeof (data[0]));
ck_assert(count != sizeof (data) / sizeof (data[0]));
eina_iterator_free(it);
count = 0;
@ -173,7 +173,7 @@ EFL_START_TEST(eina_test_xattr_list)
break ;
}
}
fail_if(count != sizeof (attribute) / sizeof (attribute[0]));
ck_assert(count != sizeof (attribute) / sizeof (attribute[0]));
eina_iterator_free(it);
count = 0;
@ -188,12 +188,12 @@ EFL_START_TEST(eina_test_xattr_list)
break ;
}
}
fail_if(count != sizeof (data) / sizeof (data[0]));
ck_assert(count != sizeof (data) / sizeof (data[0]));
eina_iterator_free(it);
/* Test case for eina_xattr_copy and eina_xattr_fd_copy */
ret = eina_xattr_copy(test_file_path, cp_file_path);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
count = 0;
it = eina_xattr_value_ls(cp_file_path);
@ -207,17 +207,17 @@ EFL_START_TEST(eina_test_xattr_list)
break ;
}
}
fail_if(count != sizeof (data) / sizeof (data[0]));
ck_assert(count != sizeof (data) / sizeof (data[0]));
eina_iterator_free(it);
for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i)
{
ret = eina_xattr_del(cp_file_path, attribute[i]);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
}
ret = eina_xattr_fd_copy(fd, fd1);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
count = 0;
it = eina_xattr_value_fd_ls(fd1);
@ -231,7 +231,7 @@ EFL_START_TEST(eina_test_xattr_list)
break ;
}
}
fail_if(count != sizeof (data) / sizeof (data[0]));
ck_assert(count != sizeof (data) / sizeof (data[0]));
eina_iterator_free(it);
close(fd);
@ -259,26 +259,26 @@ EFL_START_TEST(eina_test_xattr_types)
test_file_path = get_file_path(XATTR_TEST_DIR, filename);
fd = open(test_file_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
fail_if(fd == 0);
ck_assert(fd == 0);
ret = eina_xattr_string_set(test_file_path, str_attr, str_data, EINA_XATTR_INSERT);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret_str = eina_xattr_string_get(test_file_path, str_attr);
fail_if(ret_str == NULL);
fail_if(strcmp(ret_str, str_data) != 0);
ck_assert(ret_str == NULL);
ck_assert(strcmp(ret_str, str_data) != 0);
free(ret_str);
ret = eina_xattr_int_set(test_file_path, int_attr, int_data, EINA_XATTR_INSERT);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret = eina_xattr_int_get(test_file_path, int_attr, &int_ret);
fail_if(ret != EINA_TRUE);
fail_if(int_data != int_ret);
ck_assert(ret != EINA_TRUE);
ck_assert(int_data != int_ret);
ret = eina_xattr_double_set(test_file_path, double_attr, double_data, EINA_XATTR_INSERT);
fail_if(ret != EINA_TRUE);
ck_assert(ret != EINA_TRUE);
ret = eina_xattr_double_get(test_file_path, double_attr, &double_ret);
fail_if(ret != EINA_TRUE);
fail_if(!EINA_DBL_EQ(double_data, double_ret));
ck_assert(ret != EINA_TRUE);
ck_assert(!EINA_DBL_EQ(double_data, double_ret));
close(fd);
unlink(test_file_path);