efl

Форк
0
/
eina_test_module.c 
89 строк · 2.4 Кб
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.h>
26

27
#include "eina_suite.h"
28

29
static Eina_Bool list_cb(Eina_Module *m, void *data EINA_UNUSED)
30
{
31
   int *sym;
32
   const char *file;
33

34
   /* the reference count */
35
   fail_if(!eina_module_load(m));
36
   /* get */
37
   sym = eina_module_symbol_get(m, "dummy_symbol");
38
   fail_if(!sym);
39
   fail_if(*sym != 0xbad);
40
   file = eina_module_file_get(m);
41
   fail_if(!file);
42
   fail_if(eina_module_unload(m));
43

44
   return EINA_TRUE;
45
}
46

47

48
EFL_START_TEST(eina_module_load_unload)
49
{
50
   Eina_Array *_modules;
51
   unsigned int i;
52
   Eina_Array_Iterator it;
53
   Eina_Module *module;	
54
   
55
   _modules = eina_module_list_get(NULL,
56
                                   PACKAGE_BUILD_DIR "/src/tests/eina",
57
                                   EINA_TRUE,
58
                                   &list_cb,
59
                                   NULL);
60
   fail_if(!_modules);
61
   eina_module_list_load(_modules);
62
   eina_module_list_unload(_modules);
63
   eina_module_list_free(_modules);
64
   EINA_ARRAY_ITER_NEXT(_modules, i, module, it)
65
     free(module);
66
   eina_array_free(_modules);
67
}
68
EFL_END_TEST
69

70
EFL_START_TEST(eina_module_find_test)
71
{
72
   Eina_Array *_modules;
73

74
   _modules = eina_module_list_get(NULL,
75
                                   PACKAGE_BUILD_DIR "/src/tests/eina",
76
                                   EINA_TRUE,
77
                                   &list_cb,
78
                                   NULL);
79
   fail_if(!_modules);
80
   fail_if(eina_module_find(_modules, NULL) != NULL);
81
}
82
EFL_END_TEST
83

84
void
85
eina_test_module(TCase *tc)
86
{
87
   tcase_add_test(tc, eina_module_load_unload);
88
   tcase_add_test(tc, eina_module_find_test);
89
}
90

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.