summaryrefslogtreecommitdiff
path: root/src/tests/elm_suite.c
blob: d3c09236c420d9f03e0dbc9e467ec8591e07e72b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

#include <Elementary.h>
#include "elm_suite.h"

typedef struct _Elementary_Test_Case Elementary_Test_Case;

struct _Elementary_Test_Case
{
   const char *test_case;
   void      (*build)(TCase *tc);
};

static const Elementary_Test_Case etc[] = {
  { "Elementary", elm_test_init },
  { "elm_check", elm_test_check },
  { NULL, NULL }
};

Suite *
elm_suite()
{
   TCase *tc;
   Suite *s;
   int i;

   s = suite_create("Elementary");

   for (i = 0; etc[i].test_case; ++i)
     {
        tc = tcase_create(etc[i].test_case);
        etc[i].build(tc);
        suite_add_tcase(s, tc);
        tcase_set_timeout(tc, 0);
     }

   return s;
}

int
main(int argc __UNUSED__, char **argv __UNUSED__)
{
   int failed_count;
   Suite *s;
   SRunner *sr;

   s = elm_suite();
   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);

   return (failed_count == 0) ? 0 : 255;
}