Test rework #11: Eina_Cxx

This commit is contained in:
Vincent Torri 2016-02-04 14:49:18 +01:00 committed by Tom Hacohen
parent 1b143f233e
commit dce4a966ad
15 changed files with 94 additions and 195 deletions

View File

@ -60,7 +60,8 @@ tests/eina_cxx/eina_cxx_test_accessor.cc \
tests/eina_cxx/eina_cxx_test_thread.cc \
tests/eina_cxx/eina_cxx_test_optional.cc \
tests/eina_cxx/eina_cxx_test_value.cc \
tests/eina_cxx/simple.c
tests/eina_cxx/simple.c \
tests/eina_cxx/eina_cxx_suite.h
tests/eina_cxx/tests_eina_cxx_eina_cxx_suite-eina_cxx_test_accessor.$(OBJEXT): tests/eina_cxx/simple.eo.hh tests/eina_cxx/simple.eo.h
tests/eina_cxx/tests_eina_cxx_eina_cxx_suite-eina_cxx_test_ptrarray.$(OBJEXT): tests/eina_cxx/simple.eo.hh tests/eina_cxx/simple.eo.h

View File

@ -1,36 +1,11 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include "eina_cxx_suite.h"
#include "../efl_check.h"
#include <cassert>
#include <algorithm>
#include <check.h>
void eina_test_inlist(TCase* tc);
void eina_test_inarray(TCase* tc);
void eina_test_ptrlist(TCase* tc);
void eina_test_ptrarray(TCase* tc);
void eina_test_iterator(TCase* tc);
void eina_test_stringshare(TCase* tc);
void eina_test_error(TCase* tc);
void eina_test_accessor(TCase* tc);
void eina_test_thread(TCase* tc);
void eina_test_optional(TCase* tc);
void eina_test_value(TCase* tc);
void eina_test_log(TCase* tc);
typedef struct _Eina_Test_Case Eina_Test_Case;
struct _Eina_Test_Case
{
const char *test_case;
void (*build)(TCase *tc);
};
static const Eina_Test_Case etc[] = {
static const Efl_Test_Case etc[] = {
{ "Ptr_List", eina_test_ptrlist },
{ "Ptr_Array", eina_test_ptrarray },
{ "Inlist", eina_test_inlist },
@ -46,88 +21,18 @@ static const Eina_Test_Case etc[] = {
{ NULL, NULL }
};
static void
_list_tests(void)
int
main(int argc, char* argv[])
{
const Eina_Test_Case *itr = etc;
fputs("Available Test Cases:\n", stderr);
for (; itr->test_case; itr++)
fprintf(stderr, "\t%s\n", itr->test_case);
}
static Eina_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;
int failed_count;
if (!_efl_test_option_disp(argc, argv, etc))
return 0;
}
Suite *
eina_build_suite(int argc, const char **argv)
{
TCase *tc;
Suite *s;
int i;
s = suite_create("Eina 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;
}
putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
s = eina_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);
eina_shutdown();
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
"Eina C++", etc);
return (failed_count == 0) ? 0 : 255;
}

View File

@ -0,0 +1,22 @@
#ifndef _EINA_CXX_SUITE_H
#define _EINA_CXX_SUITE_H
#include <cassert>
#include <algorithm>
#include <check.h>
void eina_test_inlist(TCase* tc);
void eina_test_inarray(TCase* tc);
void eina_test_ptrlist(TCase* tc);
void eina_test_ptrarray(TCase* tc);
void eina_test_iterator(TCase* tc);
void eina_test_stringshare(TCase* tc);
void eina_test_error(TCase* tc);
void eina_test_accessor(TCase* tc);
void eina_test_thread(TCase* tc);
void eina_test_optional(TCase* tc);
void eina_test_value(TCase* tc);
void eina_test_log(TCase* tc);
#endif /* _EINA_CXX_SUITE_H */

View File

@ -1,14 +1,11 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include "Eo.hh"
#include <Eina.hh>
#include <Eo.hh>
#include <algorithm>
#include <check.h>
#include "eina_cxx_suite.h"
extern "C" {
#include "simple.eo.h"

View File

@ -1,11 +1,10 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <Eina.hh>
#include <check.h>
#include "eina_cxx_suite.h"
Eina_Error my_error, my_error_2;

View File

@ -1,16 +1,13 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <algorithm>
#include <functional>
#include <iostream>
#include <check.h>
#include <Eina.hh>
#include "eina_cxx_suite.h"
START_TEST(eina_cxx_inarray_pod_push_back)
{

View File

@ -1,14 +1,12 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <algorithm>
#include <functional>
#include <check.h>
#include <Eina.hh>
#include "eina_cxx_suite.h"
struct Eina_Test_Inlist
{

View File

@ -1,13 +1,10 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <Eina.hh>
#include <algorithm>
#include <check.h>
#include "eina_cxx_suite.h"
START_TEST(eina_cxx_iterator_equal)
{

View File

@ -1,13 +1,10 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <Eina.hh>
#include <algorithm>
#include <check.h>
#include "eina_cxx_suite.h"
bool expensive_called = false;

View File

@ -1,16 +1,13 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <algorithm>
#include <check.h>
#include <iostream>
#include <Eina.hh>
#include "eina_cxx_suite.h"
std::size_t nonpod_constructed = 0u
, nonpod_destructed = 0u;

View File

@ -1,16 +1,13 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include "Eo.hh"
#include <Eina.hh>
#include <eina_array.hh>
#include <Eo.hh>
#include <algorithm>
#include "eina_cxx_suite.h"
#include <check.h>
extern "C" {
#include "simple.eo.h"
}

View File

@ -1,17 +1,14 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include "Eo.hh"
#include <eina_list.hh>
#include <algorithm>
#include <iostream>
#include <check.h>
#include <Eina.hh>
#include <eina_list.hh>
#include <Eo.hh>
#include "eina_cxx_suite.h"
extern "C" {
#include "simple.eo.h"

View File

@ -3,12 +3,11 @@
# include <config.h>
#endif
#include "Eina.hh"
#include <algorithm>
#include <functional>
#include <check.h>
#include <Eina.hh>
#include "eina_cxx_suite.h"
START_TEST(eina_cxx_stringshare_constructors)
{

View File

@ -1,13 +1,10 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <Eina.hh>
#include <algorithm>
#include <check.h>
#include "eina_cxx_suite.h"
bool no_args = false
, args_1 = false

View File

@ -1,11 +1,10 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "Eina.hh"
#include <Eina.hh>
#include <check.h>
#include "eina_cxx_suite.h"
START_TEST(eina_cxx_value_constructors)
{