aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/tests/eina_test_benchmark.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/tests/eina_test_benchmark.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/eina/src/tests/eina_test_benchmark.c')
-rw-r--r--libraries/eina/src/tests/eina_test_benchmark.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/libraries/eina/src/tests/eina_test_benchmark.c b/libraries/eina/src/tests/eina_test_benchmark.c
new file mode 100644
index 0000000..4352c16
--- /dev/null
+++ b/libraries/eina/src/tests/eina_test_benchmark.c
@@ -0,0 +1,76 @@
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
28static int global_test = 0;
29
30static 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
42START_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}
70END_TEST
71
72void
73eina_test_benchmark(TCase *tc)
74{
75 tcase_add_test(tc, eina_benchmark_simple);
76}