aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/tests/eina_test_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/tests/eina_test_module.c')
-rw-r--r--libraries/eina/src/tests/eina_test_module.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/libraries/eina/src/tests/eina_test_module.c b/libraries/eina/src/tests/eina_test_module.c
new file mode 100644
index 0000000..56bdca7
--- /dev/null
+++ b/libraries/eina/src/tests/eina_test_module.c
@@ -0,0 +1,70 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2008 Cedric Bail
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#include <stdio.h>
24
25#include "eina_suite.h"
26#include "Eina.h"
27
28static Eina_Bool list_cb(Eina_Module *m, void *data __UNUSED__)
29{
30 int *sym;
31 const char *file;
32
33 /* the reference count */
34 eina_module_load(m);
35 /* get */
36 sym = eina_module_symbol_get(m, "dummy_symbol");
37 fail_if(!sym);
38 fail_if(*sym != 0xbad);
39 file = eina_module_file_get(m);
40 fail_if(!file);
41 eina_module_unload(m);
42
43 return EINA_TRUE;
44}
45
46
47START_TEST(eina_module_load_unload)
48{
49 Eina_Array *_modules;
50
51 eina_init();
52 _modules = eina_module_list_get(NULL,
53 PACKAGE_BUILD_DIR "/src/tests/",
54 EINA_TRUE,
55 &list_cb,
56 NULL);
57 fail_if(!_modules);
58 eina_module_list_load(_modules);
59 eina_module_list_unload(_modules);
60 eina_module_list_free(_modules);
61 /* TODO delete the list */
62 eina_shutdown();
63}
64END_TEST
65
66void
67eina_test_module(TCase *tc)
68{
69 tcase_add_test(tc, eina_module_load_unload);
70}