4 * @brief Interface of tester_t.
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
31 typedef struct test_t test_t
;
33 typedef struct tester_t tester_t
;
36 * @brief Representing a specified test.
42 * Testfunction called for this test.
44 * @param tester associated tester_t object
46 void (*test_function
) (tester_t
* tester
);
54 * A tester class to perform tests.
61 * @brief Tests all testcases in array tests with specific tester_t object.
63 * @param tester tester_t object
64 * @param tests pointer to an array of test_t-pointers.
65 * The last item has to be NULL.
66 * @return SUCCESS in any case
68 status_t (*perform_tests
) (tester_t
*tester
,test_t
**tests
);
71 * @brief Run a specific test case.
73 * @param this tester_t object
74 * @param test pointer to a test_t object which will be performed
75 * @return SUCCESS in any case
77 status_t (*perform_test
) (tester_t
*tester
, test_t
*test
);
80 * Is called in a testcase to check a specific situation for TRUE.
82 * Log-Values to the tester output are protected from multiple access.
84 * @warning This function should only be called in a test_function.
86 * @param this tester_t object
87 * @param to_be_true assert which has to be TRUE
88 * @param assert_name name of the assertion
90 void (*assert_true
) (tester_t
*tester
, bool to_be_true
, char *assert_name
);
93 * Is called in a testcase to check a specific situation for FALSE.
95 * Log-Values to the tester output are protected from multiple access.
97 * @warning This function should only be called in a test_function.
99 * @param this tester_t object
100 * @param to_be_false assert which has to be FALSE
101 * @param assert_name name of the assertion
103 void (*assert_false
) (tester_t
*tester
, bool to_be_false
, char *assert_name
);
106 * @brief Destroys a tester_t object
108 * @param tester tester_t object
109 * @return SUCCESS in any case
111 status_t (*destroy
) (tester_t
*tester
);
115 * @brief Creates a tester_t object used to perform tests with.
117 * @param output test output is written to this output.
118 * @param display_succeeded_asserts has to be TRUE, if all asserts should be displayed,
123 * - NULL if out of ressources
127 tester_t
*tester_create(FILE *output
, bool display_succeeded_asserts
);