LCOV - code coverage report
Current view: top level - tests - test_error.c (source / functions) Hit Total Coverage
Test: oc-runner-0.0.51.5.29c69 Code Coverage Lines: 55 55 100.0 %
Date: 2018-10-15 12:44:38 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  test_error.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 :   ck_assert_int_eq(getdebug(),0);
      36           2 :   ck_assert_int_eq(getverbose(),0);
      37           1 :   info("test1");
      38           1 :   debug("test2");
      39           1 :   alert("test3");
      40           1 :   error("test4");
      41           1 :   sock_error("test4");
      42           1 :   sock_error_no("test5",1);
      43           1 :   info("test1");
      44           1 :   debug("test2");
      45           1 :   alert("test3");
      46           1 :   error("test4");
      47           1 :   sock_error("test4");
      48           1 :   sock_error_no("test5",1);
      49             : }
      50           1 : END_TEST
      51           1 : START_TEST(check_verbose)
      52             : {
      53           1 :   setverbose();
      54           1 :   ck_assert_int_eq(getverbose(),1);
      55           1 :   info("test1");
      56           1 :   debug("test2");
      57           1 :   alert("test3");
      58           1 :   error("test4");
      59           1 :   sock_error("test4");
      60           1 :   sock_error_no("test5",1);
      61           1 :   clrverbose();
      62           2 :   ck_assert_int_eq(getverbose(),0);
      63             : }
      64           1 : END_TEST
      65             : 
      66           1 : START_TEST(check_debug)
      67             : {
      68           1 :   setdebug();
      69           1 :   ck_assert_int_eq(getdebug(),1);
      70           1 :   info("test1");
      71           1 :   debug("test2");
      72           1 :   alert("test3");
      73           1 :   error("test4");
      74           1 :   sock_error("test4");
      75           1 :   sock_error_no("test5",1);
      76             : }
      77           1 : END_TEST
      78             : 
      79           4 : Suite * socket_suite(void)
      80             : {
      81             :    Suite *s;
      82             :    TCase *tc_core;
      83             :    //TCase *tc_progress;
      84           4 :    s = suite_create("test_error");
      85             :    /* Core test case */
      86           4 :    tc_core = tcase_create("Core");
      87             :    //tcase_add_checked_fixture(tc_core, setup, teardown);
      88           4 :    tcase_add_unchecked_fixture(tc_core, NULL,NULL);
      89           4 :    tcase_set_timeout(tc_core,15);
      90           4 :    tcase_add_test(tc_core, check_normal);
      91           4 :    tcase_add_test(tc_core, check_verbose);
      92           4 :   tcase_add_test(tc_core, check_debug);
      93           4 :    suite_add_tcase(s, tc_core);
      94           4 :    return s;
      95             : }
      96             : 
      97             : 
      98           4 : int main(void)
      99             : {
     100             :    int number_failed;
     101             :    Suite *s;
     102             :    SRunner *sr;
     103             : 
     104           4 :    s = socket_suite();
     105           4 :    sr = srunner_create(s);
     106           4 :    srunner_run_all(sr, CK_NORMAL);
     107           1 :    number_failed = srunner_ntests_failed(sr);
     108           1 :    srunner_free(sr);
     109           1 :    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
     110             : }

Generated by: LCOV version 1.13