LCOV - code coverage report
Current view: top level - minipot/tests/unit - unittests.c (source / functions) Hit Total Coverage
Test: sentinel-minipot-2.3.0 Code Coverage Lines: 16 17 94.1 %
Date: 2022-11-27 17:36:11 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Copyright (c) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/)
       2             :  *
       3             :  * Permission is hereby granted, free of charge, to any person obtaining a copy
       4             :  * of this software and associated documentation files (the "Software"), to deal
       5             :  * in the Software without restriction, including without limitation the rights
       6             :  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       7             :  * copies of the Software, and to permit persons to whom the Software is
       8             :  * furnished to do so, subject to the following conditions:
       9             :  *
      10             :  * The above copyright notice and this permission notice shall be included in all
      11             :  * copies or substantial portions of the Software.
      12             :  *
      13             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      14             :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      15             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      16             :  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      17             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      18             :  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      19             :  * SOFTWARE.
      20             :  */
      21             : #include <check.h>
      22             : #include <stdlib.h>
      23             : #include <stdio.h>
      24             : #include <stdbool.h>
      25             : 
      26             : static SRunner *runner = NULL;
      27             : 
      28           2 : void unittests_add_suite(Suite *s) {
      29           2 :         if (runner == NULL)
      30           2 :                 runner = srunner_create(NULL);
      31           2 :         srunner_add_suite(runner, s);
      32           2 : }
      33             : 
      34             : 
      35           2 : int main(void) {
      36           2 :         char *test_output_tap = getenv("TEST_OUTPUT_TAP");
      37           2 :         if (test_output_tap && *test_output_tap != '\0')
      38           2 :                 srunner_set_tap(runner, test_output_tap);
      39           2 :         char *test_output_xml = getenv("TEST_OUTPUT_XML");
      40           2 :         if (test_output_xml && *test_output_xml != '\0')
      41           0 :                 srunner_set_xml(runner, test_output_xml);
      42           2 :         srunner_set_fork_status(runner, CK_FORK); // We have to fork to catch signals
      43             : 
      44           2 :         srunner_run_all(runner, CK_NORMAL);
      45           1 :         int failed = srunner_ntests_failed(runner);
      46             : 
      47           1 :         srunner_free(runner);
      48           1 :         return (bool)failed;
      49             : }

Generated by: LCOV version 1.16