forked from enlightenment/efl
Test rework #14: ElDbus_Cxx
This commit is contained in:
parent
21746ce8dc
commit
7555493b90
|
@ -48,7 +48,8 @@ TESTS += tests/eldbus_cxx/eldbus_cxx_suite
|
||||||
tests_eldbus_cxx_eldbus_cxx_suite_SOURCES = \
|
tests_eldbus_cxx_eldbus_cxx_suite_SOURCES = \
|
||||||
tests/eldbus_cxx/eldbus_cxx_suite.cc \
|
tests/eldbus_cxx/eldbus_cxx_suite.cc \
|
||||||
tests/eldbus_cxx/eldbus_cxx_test_eldbus_connect.cc \
|
tests/eldbus_cxx/eldbus_cxx_test_eldbus_connect.cc \
|
||||||
tests/eldbus_cxx/eldbus_cxx_test_eldbus_client.cc
|
tests/eldbus_cxx/eldbus_cxx_test_eldbus_client.cc \
|
||||||
|
tests/eldbus_cxx/eldbus_cxx_suite.h
|
||||||
|
|
||||||
tests_eldbus_cxx_eldbus_cxx_suite_CPPFLAGS = \
|
tests_eldbus_cxx_eldbus_cxx_suite_CPPFLAGS = \
|
||||||
-I$(top_builddir)/src/bindings/eina_cxx \
|
-I$(top_builddir)/src/bindings/eina_cxx \
|
||||||
|
|
|
@ -1,112 +1,27 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eina.h>
|
#include "eldbus_cxx_suite.h"
|
||||||
#include "Eldbus.hh"
|
#include "../efl_check.h"
|
||||||
|
|
||||||
#include <cassert>
|
static const Efl_Test_Case etc[] = {
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include <check.h>
|
|
||||||
|
|
||||||
void eldbus_test_connection(TCase* tc);
|
|
||||||
void eldbus_test_client(TCase* tc);
|
|
||||||
|
|
||||||
typedef struct _Eldbus_Test_Case Eldbus_Test_Case;
|
|
||||||
struct _Eldbus_Test_Case
|
|
||||||
{
|
|
||||||
const char *test_case;
|
|
||||||
void (*build)(TCase *tc);
|
|
||||||
};
|
|
||||||
|
|
||||||
static const Eldbus_Test_Case etc[] = {
|
|
||||||
{ "connection", eldbus_test_connection },
|
{ "connection", eldbus_test_connection },
|
||||||
{ "client", eldbus_test_client },
|
{ "client", eldbus_test_client },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
_list_tests(void)
|
|
||||||
{
|
|
||||||
const Eldbus_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;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Suite *
|
|
||||||
eldbus_build_suite(int argc, const char **argv)
|
|
||||||
{
|
|
||||||
TCase *tc;
|
|
||||||
Suite *s;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
s = suite_create("Eldbus");
|
|
||||||
|
|
||||||
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[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
Suite *s;
|
int failed_count;
|
||||||
SRunner *sr;
|
|
||||||
int i, failed_count;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
if (!_efl_test_option_disp(argc, argv, etc))
|
||||||
if ((strcmp(argv[i], "-h") == 0) ||
|
return 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"));
|
putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
|
||||||
|
|
||||||
s = eldbus_build_suite(argc - 1, (const char **)argv + 1);
|
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
|
||||||
sr = srunner_create(s);
|
"Eldbus C++", etc);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
return (failed_count == 0) ? 0 : 255;
|
return (failed_count == 0) ? 0 : 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#ifndef _ELDBUS_CXX_SUITE_H
|
||||||
|
#define _ELDBUS_CXX_SUITE_H
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <check.h>
|
||||||
|
|
||||||
|
void eldbus_test_connection(TCase* tc);
|
||||||
|
void eldbus_test_client(TCase* tc);
|
||||||
|
|
||||||
|
#endif /* _ELDBUS_CXX_SUITE_H */
|
|
@ -1,18 +1,15 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Eldbus.hh"
|
|
||||||
#include "Ecore.hh"
|
|
||||||
|
|
||||||
#include <eldbus_freedesktop.hh>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <check.h>
|
#include <Ecore.hh>
|
||||||
|
#include <Eldbus.hh>
|
||||||
|
#include <eldbus_freedesktop.hh>
|
||||||
|
|
||||||
|
#include "eldbus_cxx_suite.h"
|
||||||
|
|
||||||
const char g_bus[] = "org.Enlightenment";
|
const char g_bus[] = "org.Enlightenment";
|
||||||
const char g_path[] = "/org/enlightenment";
|
const char g_path[] = "/org/enlightenment";
|
||||||
|
@ -396,7 +393,7 @@ START_TEST(eldbus_cxx_client)
|
||||||
("SendStringAndBool"
|
("SendStringAndBool"
|
||||||
, -1
|
, -1
|
||||||
, std::bind
|
, std::bind
|
||||||
([expected_string, expected_bool]
|
([expected_string, expected_bool]
|
||||||
(std::error_code const& ec, edb::const_message const& msg, std::string i, bool b)
|
(std::error_code const& ec, edb::const_message const& msg, std::string i, bool b)
|
||||||
{
|
{
|
||||||
if(!ec)
|
if(!ec)
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Eldbus.hh"
|
|
||||||
#include "Ecore.hh"
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <check.h>
|
#include <Ecore.hh>
|
||||||
|
#include <Eldbus.hh>
|
||||||
|
|
||||||
|
#include "eldbus_cxx_suite.h"
|
||||||
|
|
||||||
START_TEST(eldbus_cxx_session_connection)
|
START_TEST(eldbus_cxx_session_connection)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue