|
Packit |
0b5880 |
/*
|
|
Packit |
0b5880 |
* Check: a unit test framework for C
|
|
Packit |
0b5880 |
* Copyright (C) 2001, 2002 Arien Malec
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
0b5880 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
0b5880 |
* License as published by the Free Software Foundation; either
|
|
Packit |
0b5880 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
0b5880 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
0b5880 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
0b5880 |
* Lesser General Public License for more details.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
0b5880 |
* License along with this library; if not, write to the
|
|
Packit |
0b5880 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
|
Packit |
0b5880 |
* MA 02110-1301, USA.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#ifndef CHECK_CHECK_H
|
|
Packit |
0b5880 |
#define CHECK_CHECK_H
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#ifndef TIMEOUT_TESTS_ENABLED
|
|
Packit |
0b5880 |
#define TIMEOUT_TESTS_ENABLED 1
|
|
Packit |
0b5880 |
#endif
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
/*
|
|
Packit |
0b5880 |
* Certain unit tests are known to leak memory. This
|
|
Packit |
0b5880 |
* #define will prevent those unit tests from being built
|
|
Packit |
0b5880 |
* if the program is to be used against valgrind.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
#ifndef MEMORY_LEAKING_TESTS_ENABLED
|
|
Packit |
0b5880 |
#define MEMORY_LEAKING_TESTS_ENABLED 1
|
|
Packit |
0b5880 |
#endif
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
extern int sub_ntests;
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
void fork_setup (void);
|
|
Packit |
0b5880 |
void fork_teardown (void);
|
|
Packit |
0b5880 |
void setup_fixture(void);
|
|
Packit |
0b5880 |
void teardown_fixture (void);
|
|
Packit |
0b5880 |
void setup (void);
|
|
Packit |
0b5880 |
void cleanup (void);
|
|
Packit |
0b5880 |
Suite *make_sub_suite(void);
|
|
Packit |
0b5880 |
Suite *make_sub2_suite(void);
|
|
Packit |
0b5880 |
Suite *make_master_suite(void);
|
|
Packit |
0b5880 |
Suite *make_list_suite(void);
|
|
Packit |
0b5880 |
Suite *make_msg_suite(void);
|
|
Packit |
0b5880 |
Suite *make_log_suite(void);
|
|
Packit |
0b5880 |
Suite *make_log_internal_suite(void);
|
|
Packit |
0b5880 |
Suite *make_limit_suite(void);
|
|
Packit |
0b5880 |
Suite *make_fork_suite(void);
|
|
Packit |
0b5880 |
Suite *make_fixture_suite(void);
|
|
Packit |
0b5880 |
Suite *make_pack_suite(void);
|
|
Packit |
0b5880 |
Suite *make_exit_suite(void);
|
|
Packit |
0b5880 |
Suite *make_selective_suite(void);
|
|
Packit |
0b5880 |
Suite *make_tag_suite(void);
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
extern int master_tests_lineno[];
|
|
Packit |
0b5880 |
void init_master_tests_lineno(int num_master_tests);
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
/**
|
|
Packit |
0b5880 |
* Record a test name.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* This is used to record the test names of each test in
|
|
Packit |
0b5880 |
* check_check_sub.c. This allows the test name to be written
|
|
Packit |
0b5880 |
* in the master_tests table in check_check_master.c and have
|
|
Packit |
0b5880 |
* it verified at test time. With this data, one can easily
|
|
Packit |
0b5880 |
* determine the name of a failed test.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
void record_test_name(const char* test_name);
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
/**
|
|
Packit |
0b5880 |
* Retrieve the next recorded test which was run, or
|
|
Packit |
0b5880 |
* NULL if no further tests are recorded.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
char* get_next_test_name(FILE * file);
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
/**
|
|
Packit |
0b5880 |
* Record a line number for a test which is to fail.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* This is used to record the failure line numbers for
|
|
Packit |
0b5880 |
* all tests in check_check_sub.c. Simply make this
|
|
Packit |
0b5880 |
* call right before an assert to record the proper
|
|
Packit |
0b5880 |
* line number. The line number is adjusted +1 internally,
|
|
Packit |
0b5880 |
* to account for making this call before the failure.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
void record_failure_line_num(const int line);
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
/**
|
|
Packit |
0b5880 |
* Once the failure file numbers have been recorded
|
|
Packit |
0b5880 |
* to file and the file has been rewind(), this
|
|
Packit |
0b5880 |
* call will extract the next line number from the
|
|
Packit |
0b5880 |
* file.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* If there are no more lines to read, -1 is returned.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
int get_next_failure_line_num(FILE * file);
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#endif /* CHECK_CHECK_H */
|