Line data Source code
1 : /*
2 : test_svg.c
3 : Created by Danny Goossen, Gioxa Ltd on 26/3/17.
4 :
5 : MIT License
6 :
7 : Copyright (c) 2017 deployctl, Gioxa Ltd.
8 :
9 : Permission is hereby granted, free of charge, to any person obtaining a copy
10 : of this software and associated documentation files (the "Software"), to deal
11 : in the Software without restriction, including without limitation the rights
12 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 : copies of the Software, and to permit persons to whom the Software is
14 : furnished to do so, subject to the following conditions:
15 :
16 : The above copyright notice and this permission notice shall be included in all
17 : copies or substantial portions of the Software.
18 :
19 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 : SOFTWARE.
26 :
27 : */
28 :
29 : #include <check.h>
30 : #include "../src/deployd.h"
31 :
32 :
33 1 : START_TEST(check_normal)
34 : {
35 1 : char * badge_str=NULL;
36 1 : int result=make_svg_badge("test", "1234", &badge_str);
37 :
38 1 : ck_assert_int_eq(result,0);
39 2 : ck_assert_ptr_ne(badge_str ,NULL);
40 2 : ck_assert_int_eq(strlen(badge_str),777);
41 1 : free(badge_str);
42 : }
43 1 : END_TEST
44 :
45 2 : Suite * badge_suite(void)
46 : {
47 : Suite *s;
48 : TCase *tc_core;
49 : //TCase *tc_progress;
50 2 : s = suite_create("test_error");
51 : /* Core test case */
52 2 : tc_core = tcase_create("Core");
53 : //tcase_add_checked_fixture(tc_core, setup, teardown);
54 2 : tcase_add_unchecked_fixture(tc_core, NULL,NULL);
55 2 : tcase_set_timeout(tc_core,15);
56 2 : tcase_add_test(tc_core, check_normal);
57 2 : suite_add_tcase(s, tc_core);
58 2 : return s;
59 : }
60 :
61 :
62 2 : int main(void)
63 : {
64 : int number_failed;
65 : Suite *s;
66 : SRunner *sr;
67 :
68 2 : s = badge_suite();
69 2 : sr = srunner_create(s);
70 2 : srunner_run_all(sr, CK_NORMAL);
71 1 : number_failed = srunner_ntests_failed(sr);
72 1 : srunner_free(sr);
73 1 : return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
74 : }
|