forked from enlightenment/efl
parent
2de7c52bd1
commit
93b28743c5
|
@ -142,7 +142,7 @@ main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = eina_build_suite(argc - 1, argv + 1);
|
s = eina_build_suite(argc - 1, (const char **)argv + 1);
|
||||||
sr = srunner_create(s);
|
sr = srunner_create(s);
|
||||||
|
|
||||||
_mempool_init();
|
_mempool_init();
|
||||||
|
|
|
@ -40,14 +40,20 @@ START_TEST(eina_counter_simple)
|
||||||
eina_counter_start(cnt);
|
eina_counter_start(cnt);
|
||||||
|
|
||||||
for (i = 0; i < 100000; ++i)
|
for (i = 0; i < 100000; ++i)
|
||||||
malloc(sizeof(long int));
|
{
|
||||||
|
void *tmp = malloc(sizeof(long int));
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
eina_counter_stop(cnt, i);
|
eina_counter_stop(cnt, i);
|
||||||
|
|
||||||
eina_counter_start(cnt);
|
eina_counter_start(cnt);
|
||||||
|
|
||||||
for (i = 0; i < 200000; ++i)
|
for (i = 0; i < 200000; ++i)
|
||||||
malloc(sizeof(long int));
|
{
|
||||||
|
void *tmp = malloc(sizeof(long int));
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
eina_counter_stop(cnt, i);
|
eina_counter_stop(cnt, i);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "eina_suite.h"
|
#include "eina_suite.h"
|
||||||
#include "Eina.h"
|
#include "Eina.h"
|
||||||
|
#include "eina_safety_checks.h"
|
||||||
|
|
||||||
typedef struct _Eina_Test_Inlist Eina_Test_Inlist;
|
typedef struct _Eina_Test_Inlist Eina_Test_Inlist;
|
||||||
struct _Eina_Test_Inlist
|
struct _Eina_Test_Inlist
|
||||||
|
@ -96,8 +97,16 @@ START_TEST(eina_inlist_simple)
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_inlist_remove(NULL, EINA_INLIST_GET(tmp));
|
#ifdef EINA_SAFETY_CHECKS
|
||||||
|
{
|
||||||
|
Eina_Inlist *tmp2 = eina_inlist_remove(NULL, EINA_INLIST_GET(tmp));
|
||||||
|
fail_if(tmp2 != NULL);
|
||||||
|
fail_if(eina_error_get() != EINA_ERROR_SAFETY_FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
lst = eina_inlist_remove(lst, NULL);
|
lst = eina_inlist_remove(lst, NULL);
|
||||||
|
fail_if(eina_error_get() != EINA_ERROR_SAFETY_FAILED);
|
||||||
|
#endif
|
||||||
|
|
||||||
tmp = (Eina_Test_Inlist*) lst;
|
tmp = (Eina_Test_Inlist*) lst;
|
||||||
lst = eina_inlist_demote(lst, lst);
|
lst = eina_inlist_demote(lst, lst);
|
||||||
|
|
|
@ -10,10 +10,8 @@
|
||||||
#define MAX_ROWS 10
|
#define MAX_ROWS 10
|
||||||
#define MAX_COLS 10
|
#define MAX_COLS 10
|
||||||
|
|
||||||
static void eina_matrixsparse_free_cell_cb(void *user_data, void *cell_data)
|
static void eina_matrixsparse_free_cell_cb(void *user_data __UNUSED__, void *cell_data __UNUSED__)
|
||||||
{
|
{
|
||||||
long *value = cell_data;
|
|
||||||
long **data = user_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matrixsparse_initialize(Eina_Matrixsparse *matrix, long data[MAX_ROWS][MAX_COLS], unsigned long nrows, unsigned long ncols)
|
static void matrixsparse_initialize(Eina_Matrixsparse *matrix, long data[MAX_ROWS][MAX_COLS], unsigned long nrows, unsigned long ncols)
|
||||||
|
@ -30,7 +28,7 @@ static void matrixsparse_initialize(Eina_Matrixsparse *matrix, long data[MAX_ROW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void matrixsparse_check(Eina_Matrixsparse *matrix, long data[MAX_ROWS][MAX_COLS], unsigned long nrows, unsigned long ncols)
|
static void matrixsparse_check(Eina_Matrixsparse *matrix, long data[MAX_ROWS][MAX_COLS], unsigned long nrows __UNUSED__, unsigned long ncols __UNUSED__)
|
||||||
{
|
{
|
||||||
unsigned long i, j;
|
unsigned long i, j;
|
||||||
long *test1;
|
long *test1;
|
||||||
|
@ -58,7 +56,7 @@ START_TEST(eina_test_simple)
|
||||||
Eina_Bool r;
|
Eina_Bool r;
|
||||||
long *test1, value, value2, value3, value4;
|
long *test1, value, value2, value3, value4;
|
||||||
unsigned long i, j;
|
unsigned long i, j;
|
||||||
unsigned long nrows, ncols, row, col;
|
unsigned long row, col;
|
||||||
|
|
||||||
long data[MAX_ROWS][MAX_COLS];
|
long data[MAX_ROWS][MAX_COLS];
|
||||||
|
|
||||||
|
@ -148,7 +146,7 @@ START_TEST(eina_test_simple)
|
||||||
r = eina_matrixsparse_data_idx_set(matrix, 1, 9, &data[1][9]);
|
r = eina_matrixsparse_data_idx_set(matrix, 1, 9, &data[1][9]);
|
||||||
fail_if(r == EINA_FALSE);
|
fail_if(r == EINA_FALSE);
|
||||||
|
|
||||||
r = eina_matrixsparse_data_idx_replace(matrix, 4, 3, &value, &test1);
|
r = eina_matrixsparse_data_idx_replace(matrix, 4, 3, &value, (void**)&test1);
|
||||||
fail_if(r == EINA_FALSE);
|
fail_if(r == EINA_FALSE);
|
||||||
fail_if(test1 == NULL);
|
fail_if(test1 == NULL);
|
||||||
fail_if(*test1 != data[4][3]);
|
fail_if(*test1 != data[4][3]);
|
||||||
|
@ -157,7 +155,7 @@ START_TEST(eina_test_simple)
|
||||||
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 3);
|
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 3);
|
||||||
fail_if(test1 == NULL || *test1 != value);
|
fail_if(test1 == NULL || *test1 != value);
|
||||||
|
|
||||||
r = eina_matrixsparse_cell_data_replace(cell, &value2, &test1);
|
r = eina_matrixsparse_cell_data_replace(cell, &value2, (void**)&test1);
|
||||||
fail_if(r == EINA_FALSE);
|
fail_if(r == EINA_FALSE);
|
||||||
fail_if(test1 == NULL);
|
fail_if(test1 == NULL);
|
||||||
fail_if(*test1 != data[3][5]);
|
fail_if(*test1 != data[3][5]);
|
||||||
|
@ -177,7 +175,7 @@ START_TEST(eina_test_simple)
|
||||||
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 2);
|
test1 = eina_matrixsparse_data_idx_get(matrix, 4, 2);
|
||||||
fail_if(test1 == NULL || *test1 != value3);
|
fail_if(test1 == NULL || *test1 != value3);
|
||||||
|
|
||||||
r = eina_matrixsparse_data_idx_replace(matrix, 6, 5, &value4, &test1);
|
r = eina_matrixsparse_data_idx_replace(matrix, 6, 5, &value4, (void**)&test1);
|
||||||
fail_if(r == EINA_FALSE || test1 != NULL);
|
fail_if(r == EINA_FALSE || test1 != NULL);
|
||||||
data[6][5] = value4;
|
data[6][5] = value4;
|
||||||
|
|
||||||
|
@ -262,9 +260,7 @@ END_TEST
|
||||||
START_TEST(eina_test_resize)
|
START_TEST(eina_test_resize)
|
||||||
{
|
{
|
||||||
Eina_Matrixsparse *matrix = NULL;
|
Eina_Matrixsparse *matrix = NULL;
|
||||||
Eina_Matrixsparse_Cell *cell = NULL;
|
|
||||||
Eina_Bool r;
|
Eina_Bool r;
|
||||||
long *test1;
|
|
||||||
unsigned long i, j;
|
unsigned long i, j;
|
||||||
unsigned long nrows, ncols;
|
unsigned long nrows, ncols;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "eina_suite.h"
|
#include "eina_suite.h"
|
||||||
#include "Eina.h"
|
#include "Eina.h"
|
||||||
|
|
||||||
static Eina_Bool list_cb(Eina_Module *m, void *data)
|
static Eina_Bool list_cb(Eina_Module *m, void *data __UNUSED__)
|
||||||
{
|
{
|
||||||
int *sym;
|
int *sym;
|
||||||
const char *file;
|
const char *file;
|
||||||
|
|
|
@ -149,14 +149,23 @@ START_TEST(eina_stringshare_collision)
|
||||||
{
|
{
|
||||||
eina_convert_itoa(rand(), buffer);
|
eina_convert_itoa(rand(), buffer);
|
||||||
eina_array_push(ea, (void*) eina_stringshare_add(buffer));
|
eina_array_push(ea, (void*) eina_stringshare_add(buffer));
|
||||||
if (rand() > RAND_MAX / 2) eina_stringshare_add(buffer);
|
if (rand() > RAND_MAX / 2)
|
||||||
|
{
|
||||||
|
const char *r = eina_stringshare_add(buffer);
|
||||||
|
fail_if(r == NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 10000; ++i)
|
for (i = 0; i < 10000; ++i)
|
||||||
{
|
{
|
||||||
|
const char *r;
|
||||||
|
|
||||||
eina_convert_itoa(60000 - i, buffer);
|
eina_convert_itoa(60000 - i, buffer);
|
||||||
eina_array_push(ea, (void*) eina_stringshare_add(buffer));
|
eina_array_push(ea, (void*) eina_stringshare_add(buffer));
|
||||||
eina_stringshare_add(buffer);
|
r = eina_stringshare_add(buffer);
|
||||||
|
fail_if(r == NULL);
|
||||||
|
r = eina_stringshare_add(buffer);
|
||||||
|
fail_if(r == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 200; ++i)
|
for (i = 0; i < 200; ++i)
|
||||||
|
|
Loading…
Reference in New Issue