LCOV - code coverage report
Current view: top level - core/test - test.h Hit Total Coverage
Test: ROOT-Sim develop Documentation Coverage Lines: 12 15 80.0 %
Date: 2021-03-02 11:24:52

          Line data    Source code
       1           1 : /**
       2             :  * @file test/test.h
       3             :  *
       4             :  * @brief Test framework header
       5             :  *
       6             :  * The header of the minimal test framework used in the code base tests
       7             :  *
       8             :  * SPDX-FileCopyrightText: 2008-2021 HPDCS Group <rootsim@googlegroups.com>
       9             :  * SPDX-License-Identifier: GPL-3.0-only
      10             :  */
      11             : #pragma once
      12             : 
      13             : #include <stdbool.h>
      14             : #include <stddef.h>
      15             : #include <stdint.h>
      16             : #include <stdio.h>
      17             : 
      18             : /// The exit code of tests when something fails horribly
      19           1 : #define TEST_BAD_FAIL_EXIT_CODE 99
      20             : 
      21             : /// A complete test configuration
      22           1 : struct test_config {
      23             :         /// The test initialization function
      24             :         /** The return value is used as failure exit code if it is non-zero */
      25           1 :         int (*test_init_fnc)(void);
      26             :         /// The test finalization function
      27             :         /** The return value is used as failure exit code if it is non-zero */
      28           1 :         int (*test_fini_fnc)(void);
      29             :         /// The core test function
      30             :         /** The return value is used as failure exit code if it is non-zero. */
      31           1 :         int (*test_fnc)(void);
      32             :         /// @a test_fnc is executed with that many cores
      33           1 :         unsigned threads_count;
      34             :         /// The expected output from the whole sequence of test_printf() calls
      35           1 :         const char *expected_output;
      36             :         /// The expected output size of the full sequence of test_printf() calls
      37           1 :         size_t expected_output_size;
      38             :         /// The command line arguments passed to the wrapped main function
      39           1 :         const char **test_arguments;
      40             : };
      41             : 
      42             : /// The test configuration object, must be defined by the test sources
      43             : extern const struct test_config test_config;
      44             : 
      45           1 : extern int test_printf(const char *restrict fmt, ...);
      46           1 : extern bool test_thread_barrier(void);
      47             : 
      48             : // core.c mock
      49           0 : typedef uint64_t lp_id_t;
      50           0 : typedef unsigned rid_t;
      51           0 : typedef int nid_t;

Generated by: LCOV version 1.14