summaryrefslogtreecommitdiff
path: root/src/tests/eet_cxx/eet_cxx_suite.cc
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2016-02-04 14:32:36 +0100
committerTom Hacohen <tom@stosb.com>2016-02-16 12:41:06 +0000
commit0b84e7593fd6d9fcbdba12f33133c33b96dafa7d (patch)
tree68a306adc63baf27c3802b03c7e74fba8c7cf8be /src/tests/eet_cxx/eet_cxx_suite.cc
parent8cc995cca849033e00d0f51dff0a0d6cba46b717 (diff)
Test rework #6: Eet_Cxx
Diffstat (limited to 'src/tests/eet_cxx/eet_cxx_suite.cc')
-rw-r--r--src/tests/eet_cxx/eet_cxx_suite.cc102
1 files changed, 9 insertions, 93 deletions
diff --git a/src/tests/eet_cxx/eet_cxx_suite.cc b/src/tests/eet_cxx/eet_cxx_suite.cc
index b1f66e6..4733af7 100644
--- a/src/tests/eet_cxx/eet_cxx_suite.cc
+++ b/src/tests/eet_cxx/eet_cxx_suite.cc
@@ -1,110 +1,26 @@
1
2#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
3# include <config.h> 2# include <config.h>
4#endif 3#endif
5 4
6#include "Eet.hh" 5#include "eet_cxx_suite.h"
7#include <Eina.h> 6#include "../efl_check.h"
8
9#include <cassert>
10#include <algorithm>
11
12#include <check.h>
13
14void eet_test_descriptors(TCase* tc);
15
16typedef struct _Eet_Test_Case Eet_Test_Case;
17struct _Eet_Test_Case
18{
19 const char *test_case;
20 void (*build)(TCase *tc);
21};
22 7
23static const Eet_Test_Case etc[] = { 8static const Efl_Test_Case etc[] = {
24 { "Descriptors", eet_test_descriptors }, 9 { "Descriptors", eet_cxx_test_descriptors },
25 { NULL, NULL } 10 { NULL, NULL }
26}; 11};
27 12
28static void
29_list_tests(void)
30{
31 const Eet_Test_Case *itr = etc;
32 fputs("Available Test Cases:\n", stderr);
33 for (; itr->test_case; itr++)
34 fprintf(stderr, "\t%s\n", itr->test_case);
35}
36
37static Eina_Bool
38_use_test(int argc, const char **argv, const char *test_case)
39{
40 if (argc < 1)
41 return 1;
42
43 for (; argc > 0; argc--, argv++)
44 if (strcmp(test_case, *argv) == 0)
45 return 1;
46
47 return 0;
48}
49
50Suite *
51eet_build_suite(int argc, const char **argv)
52{
53 TCase *tc;
54 Suite *s;
55 int i;
56
57 s = suite_create("Eet C++");
58
59 for (i = 0; etc[i].test_case; ++i)
60 {
61 if (!_use_test(argc, argv, etc[i].test_case))
62 continue;
63
64 tc = tcase_create(etc[i].test_case);
65#ifndef _WIN32
66 tcase_set_timeout(tc, 0);
67#endif
68
69 etc[i].build(tc);
70 suite_add_tcase(s, tc);
71 }
72
73 return s;
74}
75
76int main(int argc, char* argv[]) 13int main(int argc, char* argv[])
77{ 14{
78 Suite *s; 15 int failed_count;
79 SRunner *sr;
80 int i, failed_count;
81 16
82 for (i = 1; i < argc; i++) 17 if (!_efl_test_option_disp(argc, argv, etc))
83 if ((strcmp(argv[i], "-h") == 0) || 18 return 0;
84 (strcmp(argv[i], "--help") == 0))
85 {
86 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
87 argv[0]);
88 _list_tests();
89 return 0;
90 }
91 else if ((strcmp(argv[i], "-l") == 0) ||
92 (strcmp(argv[i], "--list") == 0))
93 {
94 _list_tests();
95 return 0;
96 }
97 19
98 putenv(const_cast<char*>("EFL_RUN_IN_TREE=1")); 20 putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
99 21
100 s = eet_build_suite(argc - 1, (const char **)argv + 1); 22 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
101 sr = srunner_create(s); 23 "Eet C++", etc);
102
103 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
104
105 srunner_run_all(sr, CK_ENV);
106 failed_count = srunner_ntests_failed(sr);
107 srunner_free(sr);
108 24
109 return (failed_count == 0) ? 0 : 255; 25 return (failed_count == 0) ? 0 : 255;
110} 26}