Test rework #19: Eolian_Cxx
authorVincent Torri <vincent dot torri at gmail dot com>
Thu, 4 Feb 2016 14:10:11 +0000 (15:10 +0100)
committerTom Hacohen <tom@stosb.com>
Tue, 16 Feb 2016 12:41:06 +0000 (12:41 +0000)
17 files changed:
src/Makefile_Eolian_Cxx.am
src/tests/eolian_cxx/a.c
src/tests/eolian_cxx/b.c
src/tests/eolian_cxx/c.c
src/tests/eolian_cxx/callback.c
src/tests/eolian_cxx/d.c
src/tests/eolian_cxx/eolian_cxx_suite.cc
src/tests/eolian_cxx/eolian_cxx_suite.h [new file with mode: 0644]
src/tests/eolian_cxx/eolian_cxx_test_address_of.cc
src/tests/eolian_cxx/eolian_cxx_test_binding.cc
src/tests/eolian_cxx/eolian_cxx_test_callback.cc
src/tests/eolian_cxx/eolian_cxx_test_generate.cc
src/tests/eolian_cxx/eolian_cxx_test_inheritance.cc
src/tests/eolian_cxx/eolian_cxx_test_parse.cc
src/tests/eolian_cxx/eolian_cxx_test_wrapper.cc
src/tests/eolian_cxx/generic.c
src/tests/eolian_cxx/simple.c

index b310bbe..89111c1 100644 (file)
@@ -74,7 +74,8 @@ tests/eolian_cxx/eolian_cxx_test_wrapper.cc \
 tests/eolian_cxx/simple.c \
 tests/eolian_cxx/generic.c \
 tests/eolian_cxx/eolian_cxx_test_inheritance.cc \
-tests/eolian_cxx/eolian_cxx_test_generate.cc
+tests/eolian_cxx/eolian_cxx_test_generate.cc \
+tests/eolian_cxx/eolian_cxx_suite.h
 
 tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-eolian_cxx_test_wrapper.$(OBJEXT): tests/eolian_cxx/callback.eo.hh tests/eolian_cxx/callback.eo.h
 tests/eolian_cxx/tests_eolian_cxx_eolian_cxx_suite-eolian_cxx_test_callback.$(OBJEXT): tests/eolian_cxx/callback.eo.hh tests/eolian_cxx/callback.eo.h
index 885c9ea..067639f 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -21,4 +20,3 @@ static Eo *_a_eo_base_constructor(Eo *obj EINA_UNUSED, A_Data *pd EINA_UNUSED)
 }
 
 #include "a.eo.c"
-
index f32617b..4efe494 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -22,4 +21,3 @@ static Eo *_b_eo_base_constructor(Eo *obj EINA_UNUSED, B_Data *pd EINA_UNUSED)
 }
 
 #include "b.eo.c"
-
index f113c8f..c95e2a3 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -22,4 +21,3 @@ static Eo *_c_eo_base_constructor(Eo *obj EINA_UNUSED, C_Data *pd EINA_UNUSED)
 }
 
 #include "c.eo.c"
-
index 6261254..4ad49ff 100644 (file)
@@ -1,13 +1,12 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #include <Eo.h>
 #include <Ecore.h>
 
-#include <stdlib.h>
-
 #include "callback.eo.h"
 
 struct _Callback_Data
@@ -57,4 +56,3 @@ static void _callback_test_global_callbacks(Eo *obj EINA_UNUSED, void *pd EINA_U
 }
 
 #include "callback.eo.c"
-
index 8ef24d6..e68a29e 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -24,4 +23,3 @@ static Eo *_d_eo_base_constructor(Eo *obj EINA_UNUSED, D_Data *pd EINA_UNUSED)
 }
 
 #include "d.eo.c"
-
index 7f80439..f925b09 100644 (file)
@@ -1,24 +1,11 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <check.h>
-#include <cassert>
-
-void eolian_cxx_test_parse(TCase* tc);
-void eolian_cxx_test_wrapper(TCase* tc);
-void eolian_cxx_test_generate(TCase* tc);
-void eolian_cxx_test_callback(TCase* tc);
-void eolian_cxx_test_address_of(TCase* tc);
-void eolian_cxx_test_inheritance(TCase* tc);
-void eolian_cxx_test_binding(TCase* tc);
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
-typedef struct _Eolian_Cxx_Test_Case Eolian_Cxx_Test_Case;
-struct _Eolian_Cxx_Test_Case
-{
-   const char *test_case;
-   void (*build)(TCase *tc);
-};
+#include "eolian_cxx_suite.h"
+#include "../efl_check.h"
 
-static const Eolian_Cxx_Test_Case etc[] = {
+static const Efl_Test_Case etc[] = {
   { "Eolian-Cxx Parsing", eolian_cxx_test_parse },
   { "Eolian-Cxx Wrapper", eolian_cxx_test_wrapper },
   { "Eolian-Cxx Generation", eolian_cxx_test_generate },
@@ -29,87 +16,18 @@ static const Eolian_Cxx_Test_Case etc[] = {
   { NULL, NULL }
 };
 
-static void
-_list_tests(void)
-{
-  const Eolian_Cxx_Test_Case *itr;
-
-   itr = etc;
-   fputs("Available Test Cases:\n", stderr);
-   for (; itr->test_case; itr++)
-     fprintf(stderr, "\t%s\n", itr->test_case);
-}
-
-static bool
-_use_test(int argc, const char **argv, const char *test_case)
-{
-   if (argc < 1)
-     return 1;
-
-   for (; argc > 0; argc--, argv++)
-     if (strcmp(test_case, *argv) == 0)
-       return 1;
-   return 0;
-}
-
-Suite *
-eolian_cxx_build_suite(int argc, const char **argv)
+int
+main(int argc, char* argv[])
 {
-   TCase *tc;
-   Suite *s;
-   int i;
+   int failed_count;
 
-   s = suite_create("Eolian C++");
-
-   for (i = 0; etc[i].test_case; ++i)
-     {
-        if (!_use_test(argc, argv, etc[i].test_case))
-           continue;
-
-        tc = tcase_create(etc[i].test_case);
-#ifndef _WIN32
-        tcase_set_timeout(tc, 0);
-#endif
-
-        etc[i].build(tc);
-        suite_add_tcase(s, tc);
-     }
-
-   return s;
-}
-
-int main(int argc, char* argv[])
-{
-   Suite *s;
-   SRunner *sr;
-   int i, failed_count;
-
-   for (i = 1; i < argc; i++)
-      if ((strcmp(argv[i], "-h") == 0) ||
-          (strcmp(argv[i], "--help") == 0))
-        {
-           fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
-                   argv[0]);
-           _list_tests();
-           return 0;
-        }
-      else if ((strcmp(argv[i], "-l") == 0) ||
-               (strcmp(argv[i], "--list") == 0))
-        {
-           _list_tests();
-           return 0;
-        }
+   if (!_efl_test_option_disp(argc, argv, etc))
+     return 0;
 
    putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
 
-   s = eolian_cxx_build_suite(argc - 1, (const char **)argv + 1);
-   sr = srunner_create(s);
-
-   srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
-
-   srunner_run_all(sr, CK_ENV);
-   failed_count = srunner_ntests_failed(sr);
-   srunner_free(sr);
+   failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
+                                           "Eolian C++", etc);
 
    return (failed_count == 0) ? 0 : 255;
 }
diff --git a/src/tests/eolian_cxx/eolian_cxx_suite.h b/src/tests/eolian_cxx/eolian_cxx_suite.h
new file mode 100644 (file)
index 0000000..73e6dc2
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef _EOLIAN_CXX_SUITE_H
+#define _EOLIAN_CXX_SUITE_H
+
+#include <check.h>
+
+void eolian_cxx_test_parse(TCase* tc);
+void eolian_cxx_test_wrapper(TCase* tc);
+void eolian_cxx_test_generate(TCase* tc);
+void eolian_cxx_test_callback(TCase* tc);
+void eolian_cxx_test_address_of(TCase* tc);
+void eolian_cxx_test_inheritance(TCase* tc);
+void eolian_cxx_test_binding(TCase* tc);
+
+#endif /* _EOLIAN_CXX_SUITE_H */
index c76fa5f..9a1283b 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -8,7 +7,7 @@
 #include <c.eo.hh>
 #include <d.eo.hh>
 
-#include <check.h>
+#include "eolian_cxx_suite.h"
 
 START_TEST(eolian_cxx_test_addess_of_conversions)
 {
index a6d8ebb..4a189bb 100644 (file)
@@ -1,13 +1,10 @@
-
-// test EFL++ generated bindings
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
 #include <generic.eo.hh>
 
-#include <check.h>
+#include "eolian_cxx_suite.h"
 
 START_TEST(eolian_cxx_test_binding_constructor_only_required)
 {
index 42caa4a..6ffaf50 100644 (file)
@@ -1,19 +1,18 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#include <iostream>
+#include <vector>
+#include <algorithm>
+#include <functional>
+
 #include <Eo.h>
 #include <Ecore.h>
 
 #include <callback.eo.hh>
 
-#include <check.h>
-
-#include <iostream>
-#include <vector>
-#include <algorithm>
-#include <functional>
+#include "eolian_cxx_suite.h"
 
 void foo(void*) {}
 
@@ -106,7 +105,7 @@ START_TEST(eolian_cxx_test_callback_event_del)
               ));
        ++called4;
      }));
-  
+
   fail_if(called1 != 2);
   fail_if(called2 != 2);
   fail_if(called3 != 2);
index d9770ad..acb32dd 100644 (file)
@@ -1,12 +1,12 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#include <cassert>
+
 #include <Eolian_Cxx.hh>
 
-#include <check.h>
-#include <cassert>
+#include "eolian_cxx_suite.h"
 
 START_TEST(eolian_cxx_test_generate_complex_types)
 {
index 1337135..9804a80 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -8,7 +7,7 @@
 
 #include <simple.eo.hh>
 
-#include <check.h>
+#include "eolian_cxx_suite.h"
 
 struct bar
 : efl::eo::inherit<bar, simple>
index 3fd283f..48d4146 100644 (file)
@@ -1,10 +1,14 @@
-
-#include <Eolian_Cxx.hh>
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
 #include <cassert>
-#include <check.h>
 #include <tuple>
 
+#include <Eolian_Cxx.hh>
+
+#include "eolian_cxx_suite.h"
+
 START_TEST(eolian_cxx_test_parse_complex_types)
 {
    efl::eolian::eolian_init init;
index a2ab990..bf794a7 100644 (file)
@@ -1,6 +1,3 @@
-
-// Test Eolian-Cxx wrappers
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
@@ -10,7 +7,7 @@
 
 #include <callback.eo.hh>
 
-#include <check.h>
+#include "eolian_cxx_suite.h"
 
 START_TEST(eolian_cxx_test_wrapper_size)
 {
index 97f6b98..81edb67 100644 (file)
@@ -1,4 +1,3 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
index 1009b37..79d4d80 100644 (file)
@@ -1,13 +1,12 @@
-
 #ifdef HAVE_CONFIG_H
 # include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #include <Eo.h>
 #include <Ecore.h>
 
-#include <stdlib.h>
-
 #include "simple.eo.h"
 
 #define MY_CLASS SIMPLE_CLASS
@@ -35,4 +34,3 @@ static Eina_Bool _simple_name_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, con
 }
 
 #include "simple.eo.c"
-