diff options
Diffstat (limited to 'libraries/eet/src/tests/eet_data_suite.c')
-rw-r--r-- | libraries/eet/src/tests/eet_data_suite.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/libraries/eet/src/tests/eet_data_suite.c b/libraries/eet/src/tests/eet_data_suite.c new file mode 100644 index 0000000..c4d5e50 --- /dev/null +++ b/libraries/eet/src/tests/eet_data_suite.c | |||
@@ -0,0 +1,73 @@ | |||
1 | #include <string.h> | ||
2 | #include <stdio.h> | ||
3 | |||
4 | #include <Eina.h> | ||
5 | |||
6 | #include "eet_suite.h" | ||
7 | |||
8 | static char * | ||
9 | _eet_str_direct_alloc(const char *str) | ||
10 | { | ||
11 | return (char *)str; | ||
12 | } /* _eet_str_direct_alloc */ | ||
13 | |||
14 | static void | ||
15 | _eet_str_direct_free(const char *str) | ||
16 | { | ||
17 | /* FIXME: Use attribute unused */ | ||
18 | (void)str; | ||
19 | } /* _eet_str_direct_free */ | ||
20 | |||
21 | static void | ||
22 | _eet_eina_hash_foreach(void *hash, | ||
23 | Eina_Hash_Foreach cb, | ||
24 | void *fdata) | ||
25 | { | ||
26 | if (hash) | ||
27 | eina_hash_foreach(hash, cb, fdata); | ||
28 | } /* _eet_eina_hash_foreach */ | ||
29 | |||
30 | /* Internal wrapper for eina_hash */ | ||
31 | static Eina_Hash * | ||
32 | _eet_eina_hash_add(Eina_Hash *hash, | ||
33 | const char *key, | ||
34 | const void *data) | ||
35 | { | ||
36 | if (!hash) | ||
37 | hash = eina_hash_string_superfast_new(NULL); | ||
38 | |||
39 | if (!hash) | ||
40 | return NULL; | ||
41 | |||
42 | eina_hash_add(hash, key, data); | ||
43 | return hash; | ||
44 | } /* _eet_eina_hash_add */ | ||
45 | |||
46 | static void | ||
47 | _eet_eina_hash_free(Eina_Hash *hash) | ||
48 | { | ||
49 | if (hash) | ||
50 | eina_hash_free(hash); | ||
51 | } /* _eet_eina_hash_free */ | ||
52 | |||
53 | void | ||
54 | eet_test_setup_eddc(Eet_Data_Descriptor_Class *eddc) | ||
55 | { | ||
56 | eddc->version = EET_DATA_DESCRIPTOR_CLASS_VERSION; | ||
57 | eddc->func.mem_alloc = NULL; | ||
58 | eddc->func.mem_free = NULL; | ||
59 | eddc->func.str_alloc = NULL; | ||
60 | eddc->func.str_free = NULL; | ||
61 | eddc->func.list_next = (void *)eina_list_next; | ||
62 | eddc->func.list_append = (void *)eina_list_append; | ||
63 | eddc->func.list_data = (void *)eina_list_data_get; | ||
64 | eddc->func.list_free = (void *)eina_list_free; | ||
65 | eddc->func.hash_foreach = (void *)_eet_eina_hash_foreach; | ||
66 | eddc->func.hash_add = (void *)_eet_eina_hash_add; | ||
67 | eddc->func.hash_free = (void *)_eet_eina_hash_free; | ||
68 | eddc->func.str_direct_alloc = (void *)_eet_str_direct_alloc; | ||
69 | eddc->func.str_direct_free = (void *)_eet_str_direct_free; | ||
70 | eddc->func.array_alloc = NULL; | ||
71 | eddc->func.array_free = NULL; | ||
72 | } /* eet_test_setup_eddc */ | ||
73 | |||