-
#ifdef HAVE_CONFIG_H
# include <config.h>
-#endif
+#endif /* ifdef HAVE_CONFIG_H */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#ifdef EFL_HAVE_POSIX_THREADS
+#include <Eina.h>
+
+#ifdef EINA_HAVE_THREADS
+#if ((!defined(_WIN32_WCE)) && (!defined(_WIN32)))
# include <pthread.h>
+# define _EET_INCLUDED_PTHREAD
#endif
+#endif /* ifdef EINA_HAVE_THREADS */
#include <check.h>
-#include <Eina.h>
-
#include "eet_suite.h"
+#define CERT_DIR "src/tests/" TESTS_SRC_DIR
+
START_TEST(eet_test_init)
{
int ret;
ret = eet_init();
- fail_if(ret != 1);
+ fail_if(ret != 1);
ret = eet_shutdown();
- fail_if(ret != 0);
+ fail_if(ret != 0);
}
END_TEST
typedef struct _Eet_Test_Basic_Type Eet_Test_Basic_Type;
struct _Eet_Test_Basic_Type
{
- char c;
- short s;
- int i;
- long long l;
- char *str;
- char *istr;
- float f1;
- float f2;
- double d;
- unsigned char uc;
- unsigned short us;
- unsigned int ui;
- unsigned long long ul;
+ char c;
+ short s;
+ int i;
+ long long l;
+ char *str;
+ char *istr;
+ float f1;
+ float f2;
+ double d;
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long long ul;
Eet_Test_Basic_Type *empty;
Eet_Test_Basic_Type *with;
};
-#define EET_TEST_CHAR 0x42
-#define EET_TEST_SHORT 0x4224
-#define EET_TEST_INT 0x42211224
-#define EET_TEST_LONG_LONG 0x84CB42211224BC48
-#define EET_TEST_STRING "my little test with escape \\\""
-#define EET_TEST_KEY1 "key1"
-#define EET_TEST_KEY2 "key2"
-#define EET_TEST_FLOAT 123.45689
-#define EET_TEST_FLOAT2 1.0
-#define EET_TEST_FLOAT3 0.25
-#define EET_TEST_FLOAT4 0.0001234
-#define EET_TEST_DOUBLE 123456789.9876543210
-#define EET_TEST_DOUBLE2 1.0
-#define EET_TEST_DOUBLE3 0.25
-#define EET_TEST_FILE_KEY1 "keys/data/1"
-#define EET_TEST_FILE_KEY2 "keys/data/2"
+#define EET_TEST_CHAR 0x42
+#define EET_TEST_SHORT 0x4224
+#define EET_TEST_INT 0x42211224
+#define EET_TEST_LONG_LONG 0x84CB42211224BC48
+#define EET_TEST_STRING "my little test with escape \\\""
+#define EET_TEST_KEY1 "key1"
+#define EET_TEST_KEY2 "key2"
+#define EET_TEST_FLOAT 123.45689
+#define EET_TEST_FLOAT2 1.0
+#define EET_TEST_FLOAT3 0.25
+#define EET_TEST_FLOAT4 0.0001234
+#define EET_TEST_DOUBLE 123456789.9876543210
+#define EET_TEST_DOUBLE2 1.0
+#define EET_TEST_DOUBLE3 0.25
+#define EET_TEST_FILE_KEY1 "keys/data/1"
+#define EET_TEST_FILE_KEY2 "keys/data/2"
#define EET_TEST_FILE_IMAGE "keys/images/"
typedef struct _Eet_Test_Image Eet_Test_Image;
{
unsigned int w;
unsigned int h;
- int alpha;
+ int alpha;
unsigned int color[64];
};
};
static void
-_eet_test_basic_set(Eet_Test_Basic_Type *res, int i)
+_eet_test_basic_set(Eet_Test_Basic_Type *res,
+ int i)
{
res->c = EET_TEST_CHAR;
res->s = EET_TEST_SHORT;
tmp->empty = NULL;
tmp->with = NULL;
}
-}
+} /* _eet_test_basic_set */
static void
-_eet_test_basic_check(Eet_Test_Basic_Type *result, int i)
+_eet_test_basic_check(Eet_Test_Basic_Type *result,
+ int i)
{
float tmp;
- fail_if(result->c != EET_TEST_CHAR);
- fail_if(result->s != EET_TEST_SHORT);
- fail_if(result->i != EET_TEST_INT + i);
- fail_if(result->l != (long long)EET_TEST_LONG_LONG);
- fail_if(strcmp(result->str, EET_TEST_STRING) != 0);
- fail_if(strcmp(result->istr, EET_TEST_STRING) != 0);
- fail_if(result->uc != EET_TEST_CHAR);
- fail_if(result->us != EET_TEST_SHORT);
- fail_if(result->ui != EET_TEST_INT);
- fail_if(result->ul != EET_TEST_LONG_LONG);
+ fail_if(result->c != EET_TEST_CHAR);
+ fail_if(result->s != EET_TEST_SHORT);
+ fail_if(result->i != EET_TEST_INT + i);
+ fail_if(result->l != (long long)EET_TEST_LONG_LONG);
+ fail_if(strcmp(result->str, EET_TEST_STRING) != 0);
+ fail_if(strcmp(result->istr, EET_TEST_STRING) != 0);
+ fail_if(result->uc != EET_TEST_CHAR);
+ fail_if(result->us != EET_TEST_SHORT);
+ fail_if(result->ui != EET_TEST_INT);
+ fail_if(result->ul != EET_TEST_LONG_LONG);
tmp = (result->f1 + EET_TEST_FLOAT);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
- fail_if(tmp > 0.005);
+ fail_if(tmp > 0.005);
tmp = (result->f2 - EET_TEST_FLOAT4);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
- fail_if(tmp > 0.005);
+ fail_if(tmp > 0.005);
tmp = (result->d + EET_TEST_DOUBLE);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
- fail_if(tmp > 0.00005);
+ fail_if(tmp > 0.00005);
- fail_if(result->empty != NULL);
+ fail_if(result->empty != NULL);
if (i == 0)
{
- Eet_Test_Basic_Type *tmp;
-
- tmp = result->with;
- fail_if(tmp == NULL);
-
- fail_if(tmp->c != EET_TEST_CHAR);
- fail_if(tmp->s != EET_TEST_SHORT);
- fail_if(tmp->i != EET_TEST_INT + i + 1);
- fail_if(tmp->l != (long long)EET_TEST_LONG_LONG);
- fail_if(strcmp(tmp->str, EET_TEST_STRING) != 0);
- fail_if(strcmp(tmp->istr, EET_TEST_STRING) != 0);
- fail_if(tmp->uc != EET_TEST_CHAR);
- fail_if(tmp->us != EET_TEST_SHORT);
- fail_if(tmp->ui != EET_TEST_INT);
- fail_if(tmp->ul != EET_TEST_LONG_LONG);
+ Eet_Test_Basic_Type *tmp2;
+
+ tmp2 = result->with;
+ fail_if(tmp2 == NULL);
+
+ fail_if(tmp2->c != EET_TEST_CHAR);
+ fail_if(tmp2->s != EET_TEST_SHORT);
+ fail_if(tmp2->i != EET_TEST_INT + i + 1);
+ fail_if(tmp2->l != (long long)EET_TEST_LONG_LONG);
+ fail_if(strcmp(tmp2->str, EET_TEST_STRING) != 0);
+ fail_if(strcmp(tmp2->istr, EET_TEST_STRING) != 0);
+ fail_if(tmp2->uc != EET_TEST_CHAR);
+ fail_if(tmp2->us != EET_TEST_SHORT);
+ fail_if(tmp2->ui != EET_TEST_INT);
+ fail_if(tmp2->ul != EET_TEST_LONG_LONG);
}
else
- fail_if(result->with != NULL);
-}
+ fail_if(result->with != NULL);
+} /* _eet_test_basic_check */
static void
_eet_build_basic_descriptor(Eet_Data_Descriptor *edd)
EET_T_ULONG_LONG);
EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "empty", empty, edd);
- EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "with", with, edd);
-}
+ EET_DATA_DESCRIPTOR_ADD_SUB(edd, Eet_Test_Basic_Type, "with", with, edd);
+} /* _eet_build_basic_descriptor */
- START_TEST(eet_test_basic_data_type_encoding_decoding)
+START_TEST(eet_test_basic_data_type_encoding_decoding)
{
Eet_Data_Descriptor *edd;
Eet_Test_Basic_Type *result;
typedef struct _Eet_Test_Ex_Type Eet_Test_Ex_Type;
struct _Eet_Test_Ex_Type
{
- char c;
- short s;
- int i;
- unsigned long long l;
- char *str;
- char *istr;
- float f1;
- float f2;
- float f3;
- float f4;
- double d1;
- double d2;
- double d3;
- double d4;
- Eina_List *list;
- Eina_Hash *hash;
- Eina_List *ilist;
- Eina_List *slist;
- Eina_Hash *ihash;
- Eina_Hash *shash;
- Eet_Test_Basic_Type sarray1[10];
- unsigned int sarray2[5];
- unsigned int varray1_count;
- unsigned int *varray1;
- unsigned int varray2_count;
+ char c;
+ short s;
+ int i;
+ unsigned long long l;
+ char *str;
+ char *istr;
+ float f1;
+ float f2;
+ float f3;
+ float f4;
+ double d1;
+ double d2;
+ double d3;
+ double d4;
+ Eina_List *list;
+ Eina_Hash *hash;
+ Eina_List *ilist;
+ Eina_List *slist;
+ Eina_Hash *ihash;
+ Eina_Hash *shash;
+ Eet_Test_Basic_Type sarray1[10];
+ unsigned int sarray2[5];
+ unsigned int varray1_count;
+ unsigned int *varray1;
+ unsigned int varray2_count;
Eet_Test_Basic_Type *varray2;
- unsigned char uc;
- unsigned short us;
- unsigned int ui;
- unsigned long long ul;
- char *charray[10];
+ unsigned char uc;
+ unsigned short us;
+ unsigned int ui;
+ unsigned long long ul;
+ char *charray[10];
};
static int i42 = 42;
static int i7 = 7;
-
static void
_eet_build_ex_descriptor(Eet_Data_Descriptor *edd)
{
sizeof(etbt.charray[0]), NULL, NULL);
EET_DATA_DESCRIPTOR_ADD_LIST(edd, Eet_Test_Ex_Type, "list", list, edd);
EET_DATA_DESCRIPTOR_ADD_HASH(edd, Eet_Test_Ex_Type, "hash", hash, edd);
- eet_data_descriptor_element_add(edd, "ilist", EET_T_INT, EET_G_LIST,
+ eet_data_descriptor_element_add(edd, "ilist", EET_T_INT, EET_G_LIST,
(char *)(&(etbt.ilist)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
- eet_data_descriptor_element_add(edd, "ihash", EET_T_INT, EET_G_HASH,
+ eet_data_descriptor_element_add(edd, "ihash", EET_T_INT, EET_G_HASH,
(char *)(&(etbt.ihash)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
eet_data_descriptor_element_add(edd, "slist", EET_T_STRING, EET_G_LIST,
eet_data_descriptor_element_add(edd, "shash", EET_T_STRING, EET_G_HASH,
(char *)(&(etbt.shash)) - (char *)(&(etbt)),
0, /* 0, */ NULL, NULL);
-}
+} /* _eet_build_ex_descriptor */
static Eet_Test_Ex_Type *
-_eet_test_ex_set(Eet_Test_Ex_Type *res, int offset)
+_eet_test_ex_set(Eet_Test_Ex_Type *res,
+ int offset)
{
unsigned int i;
if (!res)
- res = malloc( sizeof(Eet_Test_Ex_Type));
+ res = malloc(sizeof(Eet_Test_Ex_Type));
if (!res)
- return NULL;
+ return NULL;
res->c = EET_TEST_CHAR + offset;
res->s = EET_TEST_SHORT + offset;
res->slist = NULL;
res->shash = NULL;
for (i = 0; i < sizeof(res->charray) / sizeof(res->charray[0]); ++i)
- res->charray[i] = NULL;
+ res->charray[i] = NULL;
res->varray2 = malloc(sizeof (Eet_Test_Basic_Type) * 10);
res->varray1 = malloc(sizeof (int) * 5);
res->ul = EET_TEST_LONG_LONG + offset;
return res;
-}
+} /* _eet_test_ex_set */
static int
-_eet_test_ex_check(Eet_Test_Ex_Type *stuff, int offset)
+_eet_test_ex_check(Eet_Test_Ex_Type *stuff,
+ int offset)
{
double tmp;
unsigned int i;
if (!stuff)
- return 1;
+ return 1;
if (stuff->c != EET_TEST_CHAR + offset)
- return 1;
+ return 1;
if (stuff->s != EET_TEST_SHORT + offset)
- return 1;
+ return 1;
if (stuff->i != EET_TEST_INT + offset)
- return 1;
+ return 1;
if (stuff->l != EET_TEST_LONG_LONG + offset)
- return 1;
+ return 1;
if (strcmp(stuff->str, EET_TEST_STRING) != 0)
- return 1;
+ return 1;
if (strcmp(stuff->istr, EET_TEST_STRING) != 0)
- return 1;
+ return 1;
tmp = stuff->f1 - (EET_TEST_FLOAT + offset);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
if (tmp > 0.005)
- return 1;
+ return 1;
tmp = stuff->d1 - (EET_TEST_DOUBLE + offset);
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
if (tmp > 0.00005)
- return 1;
+ return 1;
if (stuff->f2 != -(EET_TEST_FLOAT2 + offset))
- return 1;
+ return 1;
if (stuff->d2 != -(EET_TEST_DOUBLE2 + offset))
- return 1;
+ return 1;
if (stuff->f3 != EET_TEST_FLOAT3 + offset)
- return 1;
+ return 1;
if (stuff->d3 != EET_TEST_DOUBLE3 + offset)
- return 1;
+ return 1;
if (stuff->f4 != EET_TEST_FLOAT2 + offset)
- return 1;
+ return 1;
if (stuff->d4 != EET_TEST_DOUBLE2 + offset)
- return 1;
+ return 1;
if (stuff->uc != EET_TEST_CHAR + offset)
- return 1;
+ return 1;
if (stuff->us != EET_TEST_SHORT + offset)
- return 1;
+ return 1;
if (stuff->ui != (unsigned int)EET_TEST_INT + offset)
- return 1;
+ return 1;
if (stuff->ul != EET_TEST_LONG_LONG + offset)
- return 1;
+ return 1;
if (stuff->varray1_count != 5)
- return 1;
+ return 1;
if (stuff->varray2_count != 10)
- return 1;
+ return 1;
for (i = 0; i < 5; ++i)
- if (stuff->sarray2[i] != i * 42 + 1 && stuff->varray1[i] != i * 42 + 1)
- return 1;
+ if (stuff->sarray2[i] != i * 42 + 1 && stuff->varray1[i] != i * 42 + 1)
+ return 1;
for (i = 0; i < 10; ++i)
{
}
return 0;
-}
+} /* _eet_test_ex_check */
static Eina_Bool
-func(__UNUSED__ const Eina_Hash *hash, const void *key, void *data, void *fdata)
+func(__UNUSED__ const Eina_Hash *hash,
+ const void *key,
+ void *data,
+ void *fdata)
{
int *res = fdata;
if (strcmp(key, EET_TEST_KEY1) != 0
&& strcmp(key, EET_TEST_KEY2) != 0)
- *res = 1;
+ *res = 1;
if (_eet_test_ex_check(data, 2))
- *res = 1;
+ *res = 1;
return EINA_TRUE;
-}
+} /* func */
static Eina_Bool
func7(__UNUSED__ const Eina_Hash *hash,
- __UNUSED__ const void *key,
- void *data,
- void *fdata)
+ __UNUSED__ const void *key,
+ void *data,
+ void *fdata)
{
int *res = fdata;
int *val;
val = data;
if (!val)
- *res = 1;
+ *res = 1;
if (*val != 7)
- *res = 1;
+ *res = 1;
return EINA_TRUE;
-}
+} /* func7 */
START_TEST(eet_test_data_type_encoding_decoding)
{
_eet_test_ex_set(&etbt, 0);
etbt.list = eina_list_prepend(etbt.list, _eet_test_ex_set(NULL, 1));
etbt.hash = eina_hash_string_superfast_new(NULL);
- eina_hash_add(etbt.hash, EET_TEST_KEY1, _eet_test_ex_set(NULL, 2));
+ eina_hash_add(etbt.hash, EET_TEST_KEY1, _eet_test_ex_set(NULL, 2));
etbt.ilist = eina_list_prepend(etbt.ilist, &i42);
etbt.ihash = eina_hash_string_superfast_new(NULL);
eina_hash_add(etbt.ihash, EET_TEST_KEY1, &i7);
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
END_TEST
static void
-append_string(void *data, const char *str)
+append_string(void *data,
+ const char *str)
{
char **string = data;
int length;
if (!data)
- return;
+ return;
length = *string ? strlen(*string) : 0;
*string = realloc(*string, strlen(str) + length + 1);
memcpy((*string) + length, str, strlen(str) + 1);
-}
+} /* append_string */
START_TEST(eet_test_data_type_dump_undump)
{
fail_if(!string1);
transfert2 = eet_data_text_undump(string1, string1 ? strlen(
- string1) : 0, &size2);
+ string1) : 0, &size2);
fail_if(!transfert2 && size2 <= 0);
string2 = NULL;
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
eet_shutdown();
}
END_TEST
-
START_TEST(eet_file_simple_write)
{
const char *buffer = "Here is a string of data to save !";
fail_if(unlink(file) != 0);
eet_shutdown();
-}
-END_TEST
+} /* START_TEST */
+END_TEST
START_TEST(eet_file_data_test)
{
Eet_Data_Descriptor *edd;
fail_if(!eet_data_write(ef, edd, EET_TEST_FILE_KEY1, &etbt, 0));
+ result = eet_data_read(ef, edd, EET_TEST_FILE_KEY1);
+ fail_if(!result);
+
+ /* Test the resulting data. */
+ fail_if(_eet_test_ex_check(result, 0) != 0);
+
eet_close(ef);
/* Read back the data. */
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
- fail_if(test != 0);
+ fail_if(test != 0);
list = eet_list(ef, "keys/*", &size);
- fail_if(eet_num_entries(ef) != 2);
- fail_if(size != 2);
- fail_if(!(strcmp(list[0],
+ fail_if(eet_num_entries(ef) != 2);
+ fail_if(size != 2);
+ fail_if(!(strcmp(list[0],
EET_TEST_FILE_KEY1) == 0 &&
- strcmp(list[1], EET_TEST_FILE_KEY2) == 0)
+ strcmp(list[1], EET_TEST_FILE_KEY2) == 0)
&& !(strcmp(list[0],
EET_TEST_FILE_KEY2) == 0 &&
strcmp(list[1], EET_TEST_FILE_KEY1) == 0));
- free(list);
+ free(list);
fail_if(eet_delete(ef, NULL) != 0);
fail_if(eet_delete(NULL, EET_TEST_FILE_KEY1) != 0);
fail_if(unlink(file) != 0);
eet_shutdown();
-}
-END_TEST
+} /* START_TEST */
+END_TEST
START_TEST(eet_file_data_dump_test)
{
Eet_Data_Descriptor *edd;
memset(&etbt.charray, 0, sizeof(etbt.charray));
etbt.charray[0] = "test";
- eet_eina_file_data_descriptor_class_set(&eddc, "Eet_Test_Ex_Type",
+ eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
+ "Eet_Test_Ex_Type",
sizeof(Eet_Test_Ex_Type));
edd = eet_data_descriptor_file_new(&eddc);
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
fail_if(test != 0);
fail_if(unlink(file) != 0);
eet_shutdown();
-}
-END_TEST
+} /* START_TEST */
+END_TEST
START_TEST(eet_image)
{
Eet_File *ef;
unsigned int w;
unsigned int h;
+ eet_init();
+
fail_if(!(file = tmpnam(file)));
/* Save the encoded data in a file. */
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
#define IM0 0x00112233
free(data);
eet_shutdown();
-}
-END_TEST
+} /* START_TEST */
+END_TEST
START_TEST(eet_identity_simple)
{
const char *buffer = "Here is a string of data to save !";
eet_init();
fail_if(!(file = tmpnam(file)));
- fail_if(chdir("src/tests"));
+ /* Hack to fix issue in buildbot. */
+ int chret = chdir(CERT_DIR);
+ if (chret)
+ {
+ static char CWD[1024];
+ getcwd(CWD, 1024);
+ perror(NULL);
+ printf("TAsn: '%s' '%s'\n", CWD, CERT_DIR);
+ }
+ fail_if(chret);
fail_if(!(noread = fopen("/dev/null", "w")));
/* Sign an eet file. */
fail_if(unlink(file) != 0);
eet_shutdown();
-}
-END_TEST
+} /* START_TEST */
+END_TEST
START_TEST(eet_identity_open_simple)
{
Eet_Key *k = NULL;
eet_init();
- fail_if(chdir("src/tests"));
+ fail_if(chdir(CERT_DIR));
k = eet_identity_open("cert.pem", "key.pem", NULL);
- fail_if(!k);
+ fail_if(!k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
eet_shutdown();
-}
-END_TEST
+} /* START_TEST */
+END_TEST
START_TEST(eet_identity_open_pkcs8)
{
Eet_Key *k = NULL;
eet_init();
- fail_if(chdir("src/tests"));
+ fail_if(chdir(CERT_DIR));
k = eet_identity_open("cert.pem", "key_enc_none.pem", NULL);
- fail_if(!k);
+ fail_if(!k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
-static int pass_get(char *pass,
- int size,
- __UNUSED__ int rwflags,
- __UNUSED__ void *u)
+static int
+pass_get(char *pass,
+ int size,
+ __UNUSED__ int rwflags,
+ __UNUSED__ void *u)
{
memset(pass, 0, size);
if ((int)strlen("password") > size)
- return 0;
+ return 0;
snprintf(pass, size, "%s", "password");
return strlen(pass);
-}
+} /* pass_get */
-static int badpass_get(char *pass,
- int size,
- __UNUSED__ int rwflags,
- __UNUSED__ void *u)
+static int
+badpass_get(char *pass,
+ int size,
+ __UNUSED__ int rwflags,
+ __UNUSED__ void *u)
{
memset(pass, 0, size);
if ((int)strlen("bad password") > size)
- return 0;
+ return 0;
snprintf(pass, size, "%s", "bad password");
return strlen(pass);
-}
-
+} /* badpass_get */
START_TEST(eet_identity_open_pkcs8_enc)
{
eet_init();
- fail_if(chdir("src/tests"));
+ fail_if(chdir(CERT_DIR));
k = eet_identity_open("cert.pem", "key_enc.pem", NULL);
- fail_if(k);
+ fail_if(k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
k = eet_identity_open("cert.pem", "key_enc.pem", &badpass_get);
fail_if(k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
k = eet_identity_open("cert.pem", "key_enc.pem", &pass_get);
fail_if(!k);
if (k)
- eet_identity_close(k);
+ eet_identity_close(k);
eet_shutdown();
}
END_TEST
-
START_TEST(eet_cipher_decipher_simple)
{
const char *buffer = "Here is a string of data to save !";
eet_init();
fail_if(!(file = tmpnam(file)));
- fail_if(chdir("src/tests"));
+ fail_if(chdir(CERT_DIR));
/* Crypt an eet file. */
ef = eet_open(file, EET_FILE_MODE_WRITE);
/* Decrypt an eet file. */
ef = eet_open(file, EET_FILE_MODE_READ);
- fail_if(!ef);
+ fail_if(!ef);
test = eet_read_cipher(ef, "keys/tests", &size, key_bad);
if (size == (int)strlen(buffer) + 1)
- fail_if(memcmp(test, buffer, strlen(buffer) + 1) == 0);
+ fail_if(memcmp(test, buffer, strlen(buffer) + 1) == 0);
- eet_close(ef);
+ eet_close(ef);
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
-#ifdef EFL_HAVE_THREADS
+#ifdef EINA_HAVE_THREADS
static Eina_Bool open_worker_stop;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
static void *
open_close_worker(void *path)
{
Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
if (ef == NULL)
- pthread_exit("eet_open() failed");
+ pthread_exit("eet_open() failed");
else
{
Eet_Error err_code = eet_close(ef);
if (err_code != EET_ERROR_NONE)
- pthread_exit("eet_close() failed");
+ pthread_exit("eet_close() failed");
}
}
- pthread_exit(NULL);
-}
+ pthread_exit(NULL);
+} /* open_close_worker */
-# else
+# else /* ifdef _EET_INCLUDED_PTHREAD */
static unsigned int __stdcall
open_close_worker(void *path)
{
Eet_File *ef = eet_open((char const *)path, EET_FILE_MODE_READ);
if (ef == NULL)
- _endthreadex(-1);
+ _endthreadex(-1);
else
{
Eet_Error err_code = eet_close(ef);
if (err_code != EET_ERROR_NONE)
- _endthreadex(-2);
+ _endthreadex(-2);
}
}
- _endthreadex(0);
-}
+ _endthreadex(0);
+} /* open_close_worker */
-# endif
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
START_TEST(eet_cache_concurrency)
{
Eet_File *ef;
void *thread_ret;
unsigned int n;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
pthread_t thread;
-# else
+# else /* ifdef _EET_INCLUDED_PTHREAD */
uintptr_t thread;
unsigned int thread_id;
DWORD ret;
-# endif
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
eet_init();
+ eina_threads_init();
/* create a file to test with */
fail_if(!(file = tmpnam(file)));
/* start a thread that repeatedly opens and closes a file */
open_worker_stop = 0;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
pthread_create(&thread, NULL, open_close_worker, file);
-# else
+# else /* ifdef _EET_INCLUDED_PTHREAD */
thread = _beginthreadex(NULL, 0, open_close_worker, file, 0, &thread_id);
-# endif
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
/* clear the cache repeatedly in this thread */
for (n = 0; n < 50000; ++n)
{
/* join the other thread, and fail if it returned an error message */
open_worker_stop = 1;
-# ifdef EFL_HAVE_POSIX_THREADS
+# ifdef _EET_INCLUDED_PTHREAD
fail_if(pthread_join(thread, &thread_ret) != 0);
fail_unless(thread_ret == NULL, (char const *)thread_ret);
-# else
+# else /* ifdef _EET_INCLUDED_PTHREAD */
ret = WaitForSingleObject((HANDLE)thread, INFINITE);
fail_if(ret != WAIT_OBJECT_0);
fail_if(GetExitCodeThread((HANDLE)thread, &ret) == FALSE);
fail_if(ret != 0);
-# endif
+# endif /* ifdef _EET_INCLUDED_PTHREAD */
fail_if(unlink(file) != 0);
+
+ eina_threads_shutdown();
eet_shutdown();
}
END_TEST
-#endif /* EFL_HAVE_THREADS */
+#endif /* EINA_HAVE_THREADS */
typedef struct _Eet_Connection_Data Eet_Connection_Data;
struct _Eet_Connection_Data
{
- Eet_Connection *conn;
+ Eet_Connection *conn;
Eet_Data_Descriptor *edd;
- Eina_Bool test;
+ Eina_Bool test;
};
static Eina_Bool
-_eet_connection_read(const void *eet_data, size_t size, void *user_data)
+_eet_connection_read(const void *eet_data,
+ size_t size,
+ void *user_data)
{
Eet_Connection_Data *dt = user_data;
Eet_Test_Ex_Type *result;
test = 0;
if (result->hash)
- eina_hash_foreach(result->hash, func, &test);
+ eina_hash_foreach(result->hash, func, &test);
fail_if(test != 0);
if (result->ihash)
- eina_hash_foreach(result->ihash, func7, &test);
+ eina_hash_foreach(result->ihash, func7, &test);
- fail_if(test != 0);
+ fail_if(test != 0);
if (!dt->test)
{
}
return EINA_TRUE;
-}
+} /* _eet_connection_read */
static Eina_Bool
-_eet_connection_write(const void *data, size_t size, void *user_data)
+_eet_connection_write(const void *data,
+ size_t size,
+ void *user_data)
{
Eet_Connection_Data *dt = user_data;
int still;
{
int step = size / 3;
- eet_connection_received(dt->conn, data, step);
+ eet_connection_received(dt->conn, data, step);
eet_connection_received(dt->conn, (char *)data + step, step);
size -= 2 * step;
still = eet_connection_received(dt->conn, (char *)data + 2 * step, size);
}
else
- still = eet_connection_received(dt->conn, data, size);
+ still = eet_connection_received(dt->conn, data, size);
fail_if(still);
return EINA_TRUE;
-}
+} /* _eet_connection_write */
START_TEST(eet_connection_check)
{
memset(&etbt.charray, 0, sizeof(etbt.charray));
etbt.charray[0] = "test";
- eet_eina_file_data_descriptor_class_set(&eddc, "Eet_Test_Ex_Type",
+ eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc),
+ "Eet_Test_Ex_Type",
sizeof(Eet_Test_Ex_Type));
edd = eet_data_descriptor_file_new(&eddc);
{
Eina_F32p32 fp32;
Eina_F16p16 fp16;
- Eina_F8p24 fp8;
+ Eina_F8p24 fp8;
Eina_F32p32 f1;
Eina_F32p32 f0;
};
{
double fp32;
double fp16;
- float fp8;
+ float fp8;
double f1;
double f0;
};
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp32", fp32, EET_T_F32P32);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp16", fp16, EET_T_F16P16);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
- eet_eina_stream_data_descriptor_class_set(&eddc, "Eet_5FP", sizeof (Eet_5DBL));
+ eet_eina_stream_data_descriptor_class_set(&eddc, sizeof (eddc), "Eet_5FP", sizeof (Eet_5DBL));
edd_5DBL = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp32", fp32, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp16", fp16, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
origin.fp32 = eina_f32p32_double_from(1.125);
origin.fp16 = eina_f16p16_int_from(2000);
eet_shutdown();
}
END_TEST
-
START_TEST(eet_file_fp)
{
char *file = strdup("/tmp/eet_suite_testXXXXXX");
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp32", fp32, EET_T_F32P32);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp16", fp16, EET_T_F16P16);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "fp8", fp8, EET_T_F8P24);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f1", f1, EET_T_F32P32);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5FP, Eet_5FP, "f0", f0, EET_T_F32P32);
- eet_eina_file_data_descriptor_class_set(&eddc, "Eet_5FP", sizeof (Eet_5DBL));
+ eet_eina_file_data_descriptor_class_set(&eddc, sizeof (eddc), "Eet_5FP", sizeof (Eet_5DBL));
edd_5DBL = eet_data_descriptor_file_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp32", fp32, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp16", fp16, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
- EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "fp8", fp8, EET_T_FLOAT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f1", f1, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(edd_5DBL, Eet_5DBL, "f0", f0, EET_T_DOUBLE);
origin.fp32 = eina_f32p32_double_from(1.125);
origin.fp16 = eina_f16p16_int_from(2000);
fail_if(unlink(file) != 0);
eet_shutdown();
-}
+} /* START_TEST */
+
END_TEST
-typedef struct _Eet_Union_Test Eet_Union_Test;
-typedef struct _Eet_Variant_Test Eet_Variant_Test;
-typedef struct _Eet_Variant_Type Eet_Variant_Type;
+typedef struct _Eet_Union_Test Eet_Union_Test;
+typedef struct _Eet_Variant_Test Eet_Variant_Test;
+typedef struct _Eet_Variant_Type Eet_Variant_Type;
typedef struct _Eet_Inherit_Test1 Eet_Inherit_Test1;
typedef struct _Eet_Inherit_Test2 Eet_Inherit_Test2;
typedef struct _Eet_Inherit_Test3 Eet_Inherit_Test3;
-typedef struct _Eet_St1 Eet_St1;
-typedef struct _Eet_St2 Eet_St2;
-typedef struct _Eet_St3 Eet_St3;
-typedef struct _Eet_List Eet_List;
+typedef struct _Eet_St1 Eet_St1;
+typedef struct _Eet_St2 Eet_St2;
+typedef struct _Eet_St3 Eet_St3;
+typedef struct _Eet_List Eet_List;
typedef enum _Eet_Union
{
struct
{
- Eet_Union u;
+ Eet_Union u;
const char *name;
} eet_mapping[] = {
{ EET_ST1, "ST1" },
struct _Eet_St1
{
double val1;
- int stuff;
- char *s1;
+ int stuff;
+ char *s1;
};
struct _Eet_St2
{
- Eina_Bool b1;
+ Eina_Bool b1;
unsigned long long v1;
};
struct _Eet_Variant_Type
{
const char *type;
- Eina_Bool unknow : 1;
+ Eina_Bool unknow : 1;
};
struct _Eet_Variant_Test
{
Eet_Variant_Type t;
- void *data;
- Eina_List *data_list;
+ void *data;
+ Eina_List *data_list;
};
struct _Eet_Inherit_Test1
{
Eet_Union type;
- Eet_St1 st1;
+ Eet_St1 st1;
};
struct _Eet_Inherit_Test2
{
Eet_Union type;
- Eet_St2 st2;
+ Eet_St2 st2;
};
struct _Eet_Inherit_Test3
{
Eet_Union type;
- Eet_St3 st3;
+ Eet_St3 st3;
};
struct _Eet_List
};
static const char *
-_eet_union_type_get(const void *data, Eina_Bool *unknow)
+_eet_union_type_get(const void *data,
+ Eina_Bool *unknow)
{
const Eet_Union *u = data;
int i;
if (unknow)
- *unknow = EINA_FALSE;
+ *unknow = EINA_FALSE;
for (i = 0; eet_mapping[i].name != NULL; ++i)
- if (*u == eet_mapping[i].u)
- return eet_mapping[i].name;
+ if (*u == eet_mapping[i].u)
+ return eet_mapping[i].name;
if (unknow)
- *unknow = EINA_TRUE;
+ *unknow = EINA_TRUE;
return NULL;
-}
+} /* _eet_union_type_get */
static Eina_Bool
-_eet_union_type_set(const char *type, void *data, Eina_Bool unknow)
+_eet_union_type_set(const char *type,
+ void *data,
+ Eina_Bool unknow)
{
Eet_Union *u = data;
int i;
if (unknow)
- return EINA_FALSE;
+ return EINA_FALSE;
for (i = 0; eet_mapping[i].name != NULL; ++i)
- if (strcmp(eet_mapping[i].name, type) == 0)
- {
- *u = eet_mapping[i].u;
- return EINA_TRUE;
- }
+ if (strcmp(eet_mapping[i].name, type) == 0)
+ {
+ *u = eet_mapping[i].u;
+ return EINA_TRUE;
+ }
return EINA_FALSE;
-}
+} /* _eet_union_type_set */
static const char *
-_eet_variant_type_get(const void *data, Eina_Bool *unknow)
+_eet_variant_type_get(const void *data,
+ Eina_Bool *unknow)
{
const Eet_Variant_Type *type = data;
int i;
if (unknow)
- *unknow = type->unknow;
+ *unknow = type->unknow;
for (i = 0; eet_mapping[i].name != NULL; ++i)
- if (strcmp(type->type, eet_mapping[i].name) == 0)
- return eet_mapping[i].name;
+ if (strcmp(type->type, eet_mapping[i].name) == 0)
+ return eet_mapping[i].name;
if (unknow)
- *unknow = EINA_FALSE;
+ *unknow = EINA_FALSE;
return type->type;
-}
+} /* _eet_variant_type_get */
static Eina_Bool
-_eet_variant_type_set(const char *type, void *data, Eina_Bool unknow)
+_eet_variant_type_set(const char *type,
+ void *data,
+ Eina_Bool unknow)
{
Eet_Variant_Type *vt = data;
vt->type = type;
vt->unknow = unknow;
return EINA_TRUE;
-}
+} /* _eet_variant_type_set */
static Eet_Data_Descriptor *
_eet_st1_dd(void)
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Eet_St1);
res = eet_data_descriptor_stream_new(&eddc);
- EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "val1", val1, EET_T_DOUBLE);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "val1", val1, EET_T_DOUBLE);
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "stuff", stuff, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "s1", s1, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St1, "s1", s1, EET_T_STRING);
return res;
-}
+} /* _eet_st1_dd */
static void
-_eet_st1_set(Eet_St1 *st1, int i)
+_eet_st1_set(Eet_St1 *st1,
+ int i)
{
st1->val1 = EET_TEST_DOUBLE;
st1->stuff = EET_TEST_INT + i;
st1->s1 = EET_TEST_STRING;
-}
+} /* _eet_st1_set */
static void
-_eet_st1_cmp(Eet_St1 *st1, int i)
+_eet_st1_cmp(Eet_St1 *st1,
+ int i)
{
double tmp;
tmp = st1->val1 - EET_TEST_DOUBLE;
if (tmp < 0)
- tmp = -tmp;
+ tmp = -tmp;
fail_if(tmp > 0.005);
fail_if(st1->stuff != EET_TEST_INT + i);
fail_if(strcmp(st1->s1, EET_TEST_STRING));
-}
+} /* _eet_st1_cmp */
static Eet_Data_Descriptor *
_eet_st2_dd(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St2, "v1", v1, EET_T_ULONG_LONG);
return res;
-}
+} /* _eet_st2_dd */
static void
-_eet_st2_set(Eet_St2 *st2, int i)
+_eet_st2_set(Eet_St2 *st2,
+ int i)
{
st2->b1 = EINA_TRUE;
st2->v1 = EET_TEST_LONG_LONG + i;
-}
+} /* _eet_st2_set */
static void
-_eet_st2_cmp(Eet_St2 *st2, int i)
+_eet_st2_cmp(Eet_St2 *st2,
+ int i)
{
fail_if(!st2->b1);
fail_if(st2->v1 != EET_TEST_LONG_LONG + i);
-}
+} /* _eet_st2_cmp */
static Eet_Data_Descriptor *
_eet_st3_dd(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(res, Eet_St3, "boby", boby, EET_T_INT);
return res;
-}
+} /* _eet_st3_dd */
static void
-_eet_st3_set(Eet_St3 *st3, int i)
+_eet_st3_set(Eet_St3 *st3,
+ int i)
{
st3->boby = EET_TEST_INT + i;
-}
+} /* _eet_st3_set */
static void
-_eet_st3_cmp(Eet_St3 *st3, int i)
+_eet_st3_cmp(Eet_St3 *st3,
+ int i)
{
fail_if(st3->boby != EET_TEST_INT + i);
-}
+} /* _eet_st3_cmp */
START_TEST(eet_test_union)
{
l = calloc(1, sizeof (Eet_List));
-#define EUT_NEW(Type_Index) \
- eut = calloc(1, sizeof (Eet_Union_Test)); \
- eut->type = EET_ST ## Type_Index; \
- _eet_st ## Type_Index ## _set(&(eut->u.st ## Type_Index), i);
+#define EUT_NEW(Type_Index) \
+ eut = calloc(1, sizeof (Eet_Union_Test)); \
+ eut->type = EET_ST ## Type_Index; \
+ _eet_st ## Type_Index ## _set(&(eut->u.st ## Type_Index), i);
for (i = 0; i < 3; ++i)
{
fail_if(eina_list_count(l->list) != 9);
-#define EUT_CMP(Type_Index) \
- eut = eina_list_nth(l->list, i * 3 + Type_Index - 1); \
- fail_if(eut->type != EET_ST ## Type_Index); \
- _eet_st ## Type_Index ## _cmp(&(eut->u.st ## Type_Index), i);
+#define EUT_CMP(Type_Index) \
+ eut = eina_list_nth(l->list, i * 3 + Type_Index - 1); \
+ fail_if(eut->type != EET_ST ## Type_Index); \
+ _eet_st ## Type_Index ## _cmp(&(eut->u.st ## Type_Index), i);
for (i = 0; i < 3; ++i)
{
EUT_CMP(3);
}
- eet_shutdown();
+ eet_shutdown();
eina_shutdown();
}
END_TEST
-
START_TEST(eet_test_variant)
{
Eet_Variant_Test *evt;
l = calloc(1, sizeof (Eet_List));
-#define EVT_NEW(Type_Index) \
- evt = calloc(1, sizeof (Eet_Variant_Test)); \
- evt->t.type = eet_mapping[Type_Index - 1].name; \
- st ## Type_Index = calloc(1, sizeof (Eet_St ## Type_Index)); \
- _eet_st ## Type_Index ## _set(st ## Type_Index, i); \
- evt->data = st ## Type_Index;
+#define EVT_NEW(Type_Index) \
+ evt = calloc(1, sizeof (Eet_Variant_Test)); \
+ evt->t.type = eet_mapping[Type_Index - 1].name; \
+ st ## Type_Index = calloc(1, sizeof (Eet_St ## Type_Index)); \
+ _eet_st ## Type_Index ## _set(st ## Type_Index, i); \
+ evt->data = st ## Type_Index;
for (i = 0; i < 3; ++i)
{
fail_if(eina_list_count(l->list) != 9);
-#define EVT_CMP(Type_Index) \
- evt = eina_list_nth(l->list, i * 3 + Type_Index - 1); \
- fail_if(strcmp(evt->t.type, eet_mapping[Type_Index - 1].name) != 0); \
- _eet_st ## Type_Index ## _cmp(evt->data, i);
+#define EVT_CMP(Type_Index) \
+ evt = eina_list_nth(l->list, i * 3 + Type_Index - 1); \
+ fail_if(strcmp(evt->t.type, eet_mapping[Type_Index - 1].name) != 0); \
+ _eet_st ## Type_Index ## _cmp(evt->data, i);
for (i = 0; i < 3; ++i)
{
EVT_CMP(3);
}
- eet_shutdown();
+ eet_shutdown();
eina_shutdown();
-}
+} /* START_TEST */
+
END_TEST
Suite *
tcase_add_test(tc, eet_identity_open_pkcs8);
tcase_add_test(tc, eet_identity_open_pkcs8_enc);
suite_add_tcase(s, tc);
-#endif
+#endif /* ifdef HAVE_SIGNATURE */
#ifdef HAVE_CIPHER
tc = tcase_create("Eet Cipher");
tcase_add_test(tc, eet_cipher_decipher_simple);
suite_add_tcase(s, tc);
-#endif
+#endif /* ifdef HAVE_CIPHER */
-#ifdef EFL_HAVE_THREADS
+#ifdef EINA_HAVE_THREADS
tc = tcase_create("Eet Cache");
tcase_add_test(tc, eet_cache_concurrency);
suite_add_tcase(s, tc);
-#endif
+#endif /* ifdef EFL_HAVE_THREADS */
tc = tcase_create("Eet Connection");
tcase_add_test(tc, eet_connection_check);
suite_add_tcase(s, tc);
return s;
-}
+} /* eet_suite */
int
main(void)
s = eet_suite();
sr = srunner_create(s);
- srunner_run_all(sr, CK_NORMAL);
+ srunner_run_all(sr, CK_ENV);
failed_count = srunner_ntests_failed(sr);
srunner_free(sr);
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+} /* main */
+