summaryrefslogtreecommitdiff
path: root/src/tests/ector
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:14:56 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-03 16:14:56 +0200
commit5e75d607c61189756b73b9c61c842ba1596a0d6b (patch)
treef43d3cfd9372eb809ace9126b3ec0b593e951e81 /src/tests/ector
parent411bb5b64ed57b24f11b89416f242ddecd68f0cc (diff)
ector: initial introduction.
Idea for this library is to become a retained mode drawing library that use Eo/Eolian for its API and take a lot of the good design from Enesim by Jorge Zapata and Jose Gonzalez (http://enesim.org/).
Diffstat (limited to 'src/tests/ector')
-rw-r--r--src/tests/ector/cxx_compile_test.cxx34
-rw-r--r--src/tests/ector/ector_suite.c113
-rw-r--r--src/tests/ector/ector_suite.h8
-rw-r--r--src/tests/ector/ector_test_init.c38
4 files changed, 193 insertions, 0 deletions
diff --git a/src/tests/ector/cxx_compile_test.cxx b/src/tests/ector/cxx_compile_test.cxx
new file mode 100644
index 0000000..091757a
--- /dev/null
+++ b/src/tests/ector/cxx_compile_test.cxx
@@ -0,0 +1,34 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2012 ProFUSION embedded systems
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 "Ector.h"
24
25#include <iostream>
26using namespace std;
27
28int main()
29{
30 ector_init();
31 cout << "Ector compiles with C++!";
32 ector_shutdown();
33 return 0;
34}
diff --git a/src/tests/ector/ector_suite.c b/src/tests/ector/ector_suite.c
new file mode 100644
index 0000000..fbae22c
--- /dev/null
+++ b/src/tests/ector/ector_suite.c
@@ -0,0 +1,113 @@
1/* ECTOR - EFL retained mode drawing library
2 * Copyright (C) 2014 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 /* ifdef HAVE_CONFIG_H */
22
23#include <stdio.h>
24#include <string.h>
25
26#include <check.h>
27
28#include "Eina.h"
29
30#include "ector_suite.h"
31
32typedef struct _Ector_Test_Case Ector_Test_Case;
33struct _Ector_Test_Case
34{
35 const char *test_case;
36 void (*build)(TCase *tc);
37};
38
39static const Ector_Test_Case etc[] = {
40 { "init", ector_test_init },
41 { NULL, NULL }
42};
43
44static void
45_list_tests(void)
46{
47 const Ector_Test_Case *itr = etc;
48 fputs("Available Test Cases:\n", stderr);
49 for (; itr->test_case; itr++)
50 fprintf(stderr, "\t%s\n", itr->test_case);
51}
52
53static Eina_Bool
54_use_test(int argc, const char **argv, const char *test_case)
55{
56 if (argc < 1)
57 return 1;
58
59 for (; argc > 0; argc--, argv++)
60 if (strcmp(test_case, *argv) == 0)
61 return 1;
62
63 return 0;
64}
65
66int
67main(int argc, char *argv[])
68{
69 TCase *tc;
70 Suite *s;
71 SRunner *sr;
72 int failed_count, i;
73
74 for (i = 1; i < argc; i++)
75 if ((strcmp(argv[i], "-h") == 0) ||
76 (strcmp(argv[i], "--help") == 0))
77 {
78 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
79 argv[0]);
80 _list_tests();
81 return 0;
82 }
83 else if ((strcmp(argv[i], "-l") == 0) ||
84 (strcmp(argv[i], "--list") == 0))
85 {
86 _list_tests();
87 return 0;
88 }
89
90 putenv("EFL_RUN_IN_TREE=1");
91
92 s = suite_create("Ector");
93
94 for (i = 0; etc[i].test_case; ++i)
95 {
96 if (!_use_test(argc - 1, (const char **) argv + 1, etc[i].test_case))
97 continue;
98
99 tc = tcase_create(etc[i].test_case);
100 tcase_set_timeout(tc, 0);
101
102 etc[i].build(tc);
103 suite_add_tcase(s, tc);
104 }
105
106 sr = srunner_create(s);
107 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
108 srunner_run_all(sr, CK_ENV);
109 failed_count = srunner_ntests_failed(sr);
110 srunner_free(sr);
111
112 return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
113}
diff --git a/src/tests/ector/ector_suite.h b/src/tests/ector/ector_suite.h
new file mode 100644
index 0000000..176a838
--- /dev/null
+++ b/src/tests/ector/ector_suite.h
@@ -0,0 +1,8 @@
1#ifndef ECTOR_SUITE_H
2#define ECTOR_SUITE_H
3
4#include <check.h>
5
6void ector_test_init(TCase *tc);
7
8#endif
diff --git a/src/tests/ector/ector_test_init.c b/src/tests/ector/ector_test_init.c
new file mode 100644
index 0000000..1c36e40
--- /dev/null
+++ b/src/tests/ector/ector_test_init.c
@@ -0,0 +1,38 @@
1/* ECTOR - EFL retained mode drawing library
2 * Copyright (C) 2014 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 "ector_suite.h"
24
25#include "Ector.h"
26
27START_TEST(ector_init_simple)
28{
29 fail_if(ector_init() != 1);
30 fail_if(ector_shutdown() != 0);
31}
32END_TEST
33
34void
35ector_test_init(TCase *tc)
36{
37 tcase_add_test(tc, ector_init_simple);
38}