summaryrefslogtreecommitdiff
path: root/src/tests/ecore_con
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2016-02-04 14:12:28 +0100
committerTom Hacohen <tom@stosb.com>2016-02-16 12:41:06 +0000
commitb772a46437ff9d97285f0ec811725395b79e04a7 (patch)
treeb0dc44f074717d4aec4edf30de4920c24557ddc0 /src/tests/ecore_con
parentda98142de67e2ccefa0d8afa37e9fd3411183660 (diff)
Test rework #2: Ecore_Con
Diffstat (limited to 'src/tests/ecore_con')
-rw-r--r--src/tests/ecore_con/ecore_con_suite.c92
-rw-r--r--src/tests/ecore_con/ecore_con_test_ecore_con.c5
-rw-r--r--src/tests/ecore_con/ecore_con_test_ecore_con_eet.c4
-rw-r--r--src/tests/ecore_con/ecore_con_test_ecore_con_url.c9
4 files changed, 17 insertions, 93 deletions
diff --git a/src/tests/ecore_con/ecore_con_suite.c b/src/tests/ecore_con/ecore_con_suite.c
index 331f660..a3ef616 100644
--- a/src/tests/ecore_con/ecore_con_suite.c
+++ b/src/tests/ecore_con/ecore_con_suite.c
@@ -2,106 +2,28 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include "Ecore.h"
9
10#include "ecore_con_suite.h" 5#include "ecore_con_suite.h"
6#include "../efl_check.h"
11 7
12typedef struct _Ecore_Con_Test_Case Ecore_Con_Test_Case; 8static const Efl_Test_Case etc[] = {
13
14struct _Ecore_Con_Test_Case
15{
16 const char *test_case;
17 void (*build)(TCase *tc);
18};
19
20static const Ecore_Con_Test_Case etc[] = {
21 { "Ecore_Con", ecore_con_test_ecore_con }, 9 { "Ecore_Con", ecore_con_test_ecore_con },
22 { "Ecore_Con_Url", ecore_con_test_ecore_con_url }, 10 { "Ecore_Con_Url", ecore_con_test_ecore_con_url },
23 { "Ecore_Con_Eet", ecore_con_test_ecore_con_eet }, 11 { "Ecore_Con_Eet", ecore_con_test_ecore_con_eet },
24 { NULL, NULL } 12 { NULL, NULL }
25}; 13};
26 14
27static void
28_list_tests(void)
29{
30 const Ecore_Con_Test_Case *itr;
31
32 itr = etc;
33 fputs("Available Test Cases:\n", stderr);
34 for (; itr->test_case; itr++)
35 fprintf(stderr, "\t%s\n", itr->test_case);
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 return 0;
47}
48
49static Suite *
50ecore_con_suite_build(int argc, const char **argv)
51{
52 TCase *tc;
53 Suite *s;
54 int i;
55
56 s = suite_create("Ecore_Con");
57
58 for (i = 0; etc[i].test_case; ++i)
59 {
60 if (!_use_test(argc, argv, etc[i].test_case)) continue;
61 tc = tcase_create(etc[i].test_case);
62
63 etc[i].build(tc);
64
65 suite_add_tcase(s, tc);
66 tcase_set_timeout(tc, 0);
67 }
68
69 return s;
70}
71
72int 15int
73main(int argc, char **argv) 16main(int argc, char **argv)
74{ 17{
75 Suite *s; 18 int failed_count;
76 SRunner *sr;
77 int i, failed_count;
78 19
79 for (i = 1; i < argc; i++) 20 if (!_efl_test_option_disp(argc, argv, etc))
80 if ((strcmp(argv[i], "-h") == 0) || 21 return 0;
81 (strcmp(argv[i], "--help") == 0))
82 {
83 fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
84 argv[0]);
85 _list_tests();
86 return 0;
87 }
88 else if ((strcmp(argv[i], "-l") == 0) ||
89 (strcmp(argv[i], "--list") == 0))
90 {
91 _list_tests();
92 return 0;
93 }
94 22
95 putenv("EFL_RUN_IN_TREE=1"); 23 putenv("EFL_RUN_IN_TREE=1");
96 24
97 s = ecore_con_suite_build(argc - 1, (const char **)argv + 1); 25 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
98 sr = srunner_create(s); 26 "Ecore_Con", etc);
99
100 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
101
102 srunner_run_all(sr, CK_ENV);
103 failed_count = srunner_ntests_failed(sr);
104 srunner_free(sr);
105 27
106 return (failed_count == 0) ? 0 : 255; 28 return (failed_count == 0) ? 0 : 255;
107} 29}
diff --git a/src/tests/ecore_con/ecore_con_test_ecore_con.c b/src/tests/ecore_con/ecore_con_test_ecore_con.c
index d7f03e6..33dda2f 100644
--- a/src/tests/ecore_con/ecore_con_test_ecore_con.c
+++ b/src/tests/ecore_con/ecore_con_test_ecore_con.c
@@ -2,12 +2,13 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include "ecore_con_suite.h"
6
7#include <stdio.h> 5#include <stdio.h>
6
8#include <Ecore.h> 7#include <Ecore.h>
9#include <Ecore_Con.h> 8#include <Ecore_Con.h>
10 9
10#include "ecore_con_suite.h"
11
11char sdata[] = "Server_info"; 12char sdata[] = "Server_info";
12char cdata[] = "Client_info"; 13char cdata[] = "Client_info";
13 14
diff --git a/src/tests/ecore_con/ecore_con_test_ecore_con_eet.c b/src/tests/ecore_con/ecore_con_test_ecore_con_eet.c
index e6eca4d..c8801bb 100644
--- a/src/tests/ecore_con/ecore_con_test_ecore_con_eet.c
+++ b/src/tests/ecore_con/ecore_con_test_ecore_con_eet.c
@@ -2,11 +2,11 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include "ecore_con_suite.h"
6
7#include <Eet.h> 5#include <Eet.h>
8#include <Ecore_Con_Eet.h> 6#include <Ecore_Con_Eet.h>
9 7
8#include "ecore_con_suite.h"
9
10#define TEST_STREAM "test_stream" 10#define TEST_STREAM "test_stream"
11#define SRV_MSG "Server Message" 11#define SRV_MSG "Server Message"
12#define CLI_MSG "Client Message" 12#define CLI_MSG "Client Message"
diff --git a/src/tests/ecore_con/ecore_con_test_ecore_con_url.c b/src/tests/ecore_con/ecore_con_test_ecore_con_url.c
index 38fb234..0c1a602 100644
--- a/src/tests/ecore_con/ecore_con_test_ecore_con_url.c
+++ b/src/tests/ecore_con/ecore_con_test_ecore_con_url.c
@@ -2,13 +2,14 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include "ecore_con_suite.h"
6
7#include <stdio.h> 5#include <stdio.h>
6#include <unistd.h>
7
8#include <Eina.h>
8#include <Ecore.h> 9#include <Ecore.h>
9#include <Ecore_Con.h> 10#include <Ecore_Con.h>
10#include <Eina.h> 11
11#include <unistd.h> 12#include "ecore_con_suite.h"
12 13
13#define COOKIEJAR "testcookieXXXXXX.jar" 14#define COOKIEJAR "testcookieXXXXXX.jar"
14#define DEFAULT_LINK "www.google.com" 15#define DEFAULT_LINK "www.google.com"