efl

Форк
0
/
eina_test_benchmark.c 
76 строк · 1.7 Кб
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 <unistd.h>
24

25
#include "eina_suite.h"
26
#include "eina_benchmark.h"
27

28
static int global_test = 0;
29

30
static void
31
_eina_benchmark_specimens(int request)
32
{
33
   int i;
34
   int a = 0;
35

36
   for (i = 0; i < request; ++i)
37
      a += i;
38

39
   global_test = a;
40
}
41

42
EFL_START_TEST(eina_benchmark_simple)
43
{
44
   Eina_Benchmark *eb;
45
   Eina_Array_Iterator it;
46
   Eina_Array *ea;
47
   char *tmp;
48
   unsigned int i;
49

50
   eb = eina_benchmark_new("benchmark", "test");
51
   fail_if(!eb);
52

53
   eina_benchmark_register(eb, "specimens_check",
54
                           EINA_BENCHMARK(_eina_benchmark_specimens),
55
			   1000, 1100, 100);
56

57
   ea = eina_benchmark_run(eb);
58
   fail_if(!ea);
59

60
   EINA_ARRAY_ITER_NEXT(ea, i, tmp, it)
61
     {
62
        fail_if(!tmp);
63
        fail_if(unlink(tmp));
64
     }
65

66
   fail_if(global_test != 499500);
67

68
   eina_benchmark_free(eb);
69
}
70
EFL_END_TEST
71

72
void
73
eina_test_benchmark(TCase *tc)
74
{
75
   tcase_add_test(tc, eina_benchmark_simple);
76
}
77

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

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

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

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