Commit 5bd29787 authored by jds2's avatar jds2

Add 'CU_' prefix to remaining defines in CUnit/Headers/CUnit.h. This includes...

Add 'CU_' prefix to remaining defines in CUnit/Headers/CUnit.h.  This includes CU_BOOL, CU_TRUE, CU_FALSE, CU_MAX_TEST_NAME_LENGTH, and CU_MAX_SUITE_NAME_LENGTH.  Sources tagged with 'rel-2-0-2-before-CU_BOOL' before committing these changes.


git-svn-id: http://svn.code.sf.net/p/cunit/code/trunk@80 f00e6729-6848-4c17-8bfb-678c97c00071
parent 32540388
This diff is collapsed.
......@@ -171,16 +171,16 @@ CU_pRunSummary CU_get_run_summary(void);
/* Functions for internal & testing use. */
CU_pSuite CU_get_current_suite(void);
CU_pTest CU_get_current_test(void);
BOOL CU_is_test_running(void);
CU_BOOL CU_is_test_running(void);
void CU_clear_previous_results(void);
/* Assertion implementation function. */
BOOL CU_assertImplementation(BOOL bValue,
unsigned int uiLine,
char strCondition[],
char strFile[],
char strFunction[],
BOOL bFatal);
CU_BOOL CU_assertImplementation(CU_BOOL bValue,
unsigned int uiLine,
char strCondition[],
char strFile[],
char strFunction[],
CU_BOOL bFatal);
#ifdef USE_DEPRECATED_CUNIT_NAMES
typedef CU_FailureRecord _TestResult; /**< @deprecated Use CU_FailureRecord. */
......
......@@ -73,7 +73,7 @@ static char f_szTestListFileName[FILENAME_MAX] = ""; /**< Current output
static char f_szTestResultFileName[FILENAME_MAX] = ""; /**< Current output file name for the test results file. */
static FILE* f_pTestResultFile = NULL; /**< FILE pointer the test results file. */
static BOOL f_bWriting_CUNIT_RUN_SUITE = FALSE; /**< Flag for keeping track of when a closing xml tag is required. */
static CU_BOOL f_bWriting_CUNIT_RUN_SUITE = CU_FALSE; /**< Flag for keeping track of when a closing xml tag is required. */
static CU_ErrorCode automated_list_all_tests(CU_pTestRegistry pRegistry, const char* szFilename);
......@@ -120,7 +120,7 @@ void CU_automated_run_tests(void)
CU_set_suite_init_failure_handler(automated_suite_init_failure_message_handler);
CU_set_suite_cleanup_failure_handler(automated_suite_cleanup_failure_message_handler);
f_bWriting_CUNIT_RUN_SUITE = FALSE;
f_bWriting_CUNIT_RUN_SUITE = CU_FALSE;
automated_run_all_tests(pRegistry);
}
......@@ -247,7 +247,7 @@ static void automated_test_start_message_handler(const CU_pTest pTest, const CU_
" <SUITE_NAME> %s </SUITE_NAME> \n",
pSuite->pName);
f_bWriting_CUNIT_RUN_SUITE = TRUE;
f_bWriting_CUNIT_RUN_SUITE = CU_TRUE;
f_pRunningSuite = pSuite;
}
}
......@@ -384,7 +384,7 @@ static void automated_suite_init_failure_message_handler(const CU_pSuite pSuite)
fprintf(f_pTestResultFile,
" </CUNIT_RUN_SUITE_SUCCESS> \n"
" </CUNIT_RUN_SUITE> \n");
f_bWriting_CUNIT_RUN_SUITE = FALSE;
f_bWriting_CUNIT_RUN_SUITE = CU_FALSE;
}
fprintf(f_pTestResultFile,
......@@ -410,7 +410,7 @@ static void automated_suite_cleanup_failure_message_handler(const CU_pSuite pSui
fprintf(f_pTestResultFile,
" </CUNIT_RUN_SUITE_SUCCESS> \n"
" </CUNIT_RUN_SUITE> \n");
f_bWriting_CUNIT_RUN_SUITE = FALSE;
f_bWriting_CUNIT_RUN_SUITE = CU_FALSE;
}
fprintf(f_pTestResultFile,
......
......@@ -300,10 +300,10 @@ static CU_ErrorCode console_run_single_test(CU_pSuite pSuite, CU_pTest pTest)
*/
static CU_ErrorCode select_test(CU_pSuite pSuite, CU_pTest* ppTest)
{
char szTestName[MAX_TEST_NAME_LENGTH];
char szTestName[CU_MAX_TEST_NAME_LENGTH];
fprintf(stdout,"\nEnter Test Name : ");
fgets(szTestName, MAX_TEST_NAME_LENGTH, stdin);
fgets(szTestName, CU_MAX_TEST_NAME_LENGTH, stdin);
sscanf(szTestName, "%[^\n]s", szTestName);
*ppTest = CU_get_test_by_name(szTestName, pSuite);
......@@ -327,12 +327,12 @@ static CU_ErrorCode select_test(CU_pSuite pSuite, CU_pTest* ppTest)
*/
static CU_ErrorCode select_suite(CU_pTestRegistry pRegistry, CU_pSuite* ppSuite)
{
char szSuiteName[MAX_SUITE_NAME_LENGTH];
char szSuiteName[CU_MAX_SUITE_NAME_LENGTH];
assert(pRegistry);
fprintf(stdout,"\n\nEnter Suite Name : ");
fgets(szSuiteName, MAX_SUITE_NAME_LENGTH, stdin);
fgets(szSuiteName, CU_MAX_SUITE_NAME_LENGTH, stdin);
sscanf(szSuiteName, "%[^\n]s", szSuiteName);
*ppSuite = CU_get_suite_by_name(szSuiteName, pRegistry);
......
......@@ -297,7 +297,7 @@ static bool initialize_windows(void)
curs_set(0);
noecho();
cbreak();
keypad(application_windows.pMainWin, TRUE);
keypad(application_windows.pMainWin, CU_TRUE);
init_pair(CLEAR_COLOR, COLOR_WHITE, COLOR_BLACK);
init_pair(TITLE_COLOR, COLOR_WHITE, COLOR_BLACK);
init_pair(PROGRESS_BACKGROUND_COLOR, COLOR_BLACK, COLOR_WHITE);
......@@ -342,7 +342,7 @@ static void uninitialize_windows(void)
curs_set(1);
echo();
nocbreak();
keypad(application_windows.pMainWin, FALSE);
keypad(application_windows.pMainWin, CU_FALSE);
if (details_pad.pPad)
delwin(details_pad.pPad);
......@@ -455,7 +455,7 @@ static void refresh_details_window(void)
box(application_windows.pDetailsWin, ACS_VLINE, ACS_HLINE);
mvwprintw(application_windows.pDetailsWin, 0,
f_nLeft + (f_nWidth - strlen(szDetailsTitle))/2, "%s", szDetailsTitle);
scrollok(application_windows.pDetailsWin, TRUE);
scrollok(application_windows.pDetailsWin, CU_TRUE);
wrefresh(application_windows.pDetailsWin);
if (details_pad.pPad) {
......
......@@ -71,9 +71,9 @@ static const char* f_szDefaultDumpFileName = "CUnit-Memory-Dump.xml";
#ifdef CUNIT_BUILD_TESTS
/** For testing use (only) to simulate memory exhaustion -
* if FALSE, allocation requests will always fail and return NULL.
* if CU_FALSE, allocation requests will always fail and return NULL.
*/
static BOOL f_bTestCunitMallocActive = TRUE;
static CU_BOOL f_bTestCunitMallocActive = CU_TRUE;
#endif
/** Structure holding the details of a memory allocation/deallocation event. */
......@@ -401,7 +401,7 @@ void CU_dump_memory_usage(const char* szFilename)
*/
void test_cunit_deactivate_malloc(void)
{
f_bTestCunitMallocActive = FALSE;
f_bTestCunitMallocActive = CU_FALSE;
}
/** Activate CUnit memory allocation
......@@ -411,7 +411,7 @@ void test_cunit_deactivate_malloc(void)
*/
void test_cunit_activate_malloc(void)
{
f_bTestCunitMallocActive = TRUE;
f_bTestCunitMallocActive = CU_TRUE;
}
/** Retrieve the number of memory events recorded for a given pointer. */
......
This diff is collapsed.
This diff is collapsed.
......@@ -129,10 +129,13 @@ void test_cunit_report_results(void)
((double)clock() - (double)f_start_time)/(double)CLOCKS_PER_SEC);
}
BOOL test_cunit_assert_impl(BOOL value, const char* condition, const char* file, unsigned int line)
CU_BOOL test_cunit_assert_impl(CU_BOOL value,
const char* condition,
const char* file,
unsigned int line)
{
test_cunit_add_test();
if (FALSE == value) {
if (CU_FALSE == value) {
test_cunit_add_failure();
printf("\nTEST FAILED: File '%s', Line %d, Condition '%s.'\n",
file, line, condition);
......
......@@ -69,12 +69,15 @@ unsigned int test_cunit_test_count(void); /**< Retrieve the number of tests
unsigned int test_cunit_failure_count(void); /**< Retrieve the number of failed tests. */
/** Implementation of test assertion. */
BOOL test_cunit_assert_impl(BOOL value, const char* condition, const char* file, unsigned int line);
CU_BOOL test_cunit_assert_impl(CU_BOOL value,
const char* condition,
const char* file,
unsigned int line);
/** Test a logical condition.
* Use of this macro allows clients to register a tested
* assertion with automatic recordkeeping and reporting
* of failures and run counts. The return value is a BOOL
* of failures and run counts. The return value is a CU_BOOL
* having the same value as the logical condition tested.
* As such, it may be used in logial expressions itself.
*/
......@@ -88,7 +91,7 @@ BOOL test_cunit_assert_impl(BOOL value, const char* condition, const char* file,
#define TEST_FATAL(x) if (!test_cunit_assert_impl((x), #x, __FILE__, __LINE__)) return
/** Record a failure. */
#define FAIL(x) test_cunit_assert_impl(FALSE, #x, __FILE__, __LINE__)
#define FAIL(x) test_cunit_assert_impl(CU_FALSE, #x, __FILE__, __LINE__)
#ifdef __cplusplus
}
......
......@@ -27,21 +27,21 @@
int main(int argc, char* argv[])
{
BOOL Run = FALSE ;
CU_BOOL Run = CU_FALSE ;
setvbuf(stdout, NULL, _IONBF, 0);
if (argc > 1) {
if (!strcmp("-i", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_IGNORE);
}
else if (!strcmp("-f", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_FAIL);
}
else if (!strcmp("-A", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_ABORT);
}
else if (!strcmp("-e", argv[1])) {
......@@ -57,11 +57,11 @@ int main(int argc, char* argv[])
}
}
else {
Run = TRUE;
Run = CU_TRUE;
CU_set_error_action(CUEA_IGNORE);
}
if (TRUE == Run) {
if (CU_TRUE == Run) {
if (CU_initialize_registry()) {
printf("\nInitialization of Test Registry failed.");
}
......
......@@ -26,21 +26,21 @@
int main(int argc, char* argv[])
{
BOOL Run = FALSE ;
CU_BOOL Run = CU_FALSE ;
setvbuf(stdout, NULL, _IONBF, 0);
if (argc > 1) {
if (!strcmp("-i", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_IGNORE);
}
else if (!strcmp("-f", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_FAIL);
}
else if (!strcmp("-A", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_ABORT);
}
else if (!strcmp("-e", argv[1])) {
......@@ -56,11 +56,11 @@ int main(int argc, char* argv[])
}
}
else {
Run = TRUE;
Run = CU_TRUE;
CU_set_error_action(CUEA_IGNORE);
}
if (TRUE == Run) {
if (CU_TRUE == Run) {
if (CU_initialize_registry()) {
printf("\nInitialization of Test Registry failed.");
}
......
......@@ -21,26 +21,26 @@
#include <stdlib.h>
#include <string.h>
#include "CUCurses.h"
#include "CUCurses.h"
#include "ExampleTests.h"
int main(int argc, char* argv[])
{
BOOL Run = FALSE ;
CU_BOOL Run = CU_FALSE ;
setvbuf(stdout, NULL, _IONBF, 0);
if (argc > 1) {
if (!strcmp("-i", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_IGNORE);
}
else if (!strcmp("-f", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_FAIL);
}
else if (!strcmp("-A", argv[1])) {
Run = TRUE ;
Run = CU_TRUE ;
CU_set_error_action(CUEA_ABORT);
}
else if (!strcmp("-e", argv[1])) {
......@@ -56,11 +56,11 @@ int main(int argc, char* argv[])
}
}
else {
Run = TRUE;
Run = CU_TRUE;
CU_set_error_action(CUEA_IGNORE);
}
if (TRUE == Run) {
if (CU_TRUE == Run) {
if (CU_initialize_registry()) {
printf("\nInitialization of Test Registry failed.");
}
......
......@@ -73,20 +73,20 @@ static void testFail(void)
static void testAssertTrue(void)
{
CU_ASSERT_TRUE(TRUE);
CU_ASSERT_TRUE(!FALSE);
CU_ASSERT_TRUE(CU_TRUE);
CU_ASSERT_TRUE(!CU_FALSE);
CU_ASSERT_TRUE(!TRUE);
CU_ASSERT_TRUE(FALSE);
CU_ASSERT_TRUE(!CU_TRUE);
CU_ASSERT_TRUE(CU_FALSE);
}
static void testAssertFalse(void)
{
CU_ASSERT_FALSE(FALSE);
CU_ASSERT_FALSE(!TRUE);
CU_ASSERT_FALSE(CU_FALSE);
CU_ASSERT_FALSE(!CU_TRUE);
CU_ASSERT_FALSE(!FALSE);
CU_ASSERT_FALSE(TRUE);
CU_ASSERT_FALSE(!CU_FALSE);
CU_ASSERT_FALSE(CU_TRUE);
}
static void testAssertEqual(void)
......@@ -223,8 +223,8 @@ static void testAssertDoubleNotEqual(void)
static void testAbort(void)
{
CU_TEST_FATAL(TRUE);
CU_TEST_FATAL(FALSE);
CU_TEST_FATAL(CU_TRUE);
CU_TEST_FATAL(CU_FALSE);
fprintf(stderr, "\nFatal assertion failed to abort test in testAbortIndirect1\n");
exit(1);
}
......@@ -238,7 +238,7 @@ static void testAbortIndirect(void)
static void testFatal(void)
{
CU_TEST_FATAL(TRUE);
CU_TEST_FATAL(CU_TRUE);
testAbortIndirect();
fprintf(stderr, "\nFatal assertion failed to abort test in testFatal\n");
exit(1);
......
......@@ -97,7 +97,7 @@ test is run.
CUnit provides a set of assertions for testing logical conditions. The
success or failure of these assertions is tracked by the framework,
and can be viewed when a test run is complete. Each assertion tests a
single logical condition, and fails if the condition evaluates to FALSE.
single logical condition, and fails if the condition evaluates to CU_FALSE.
Upon failure, the test continues unless the user chooses the 'xxx_FATAL'
version of an assertion. In that case, the test function returns
immediately.
......@@ -107,7 +107,7 @@ success or failure of these assertions is tracked by the framework,
and can be viewed when a test run is complete.
.P
Each assertion tests a single logical condition, and fails if the
condition evaluates to FALSE. Upon failure, the test function
condition evaluates to CU_FALSE. Upon failure, the test function
continues unless the user chooses the 'xxx_FATAL' version of an
assertion. In that case, the test function is aborted and returns
immediately.
......@@ -138,7 +138,7 @@ The assertions defined by CUnit are:
.br
.B CU_TEST_FATAL(int expression)
.RS 5
Assert that expression is TRUE (non-zero).
Assert that expression is CU_TRUE (non-zero).
.RE
.P
......@@ -146,7 +146,7 @@ Assert that expression is TRUE (non-zero).
.br
.B CU_ASSERT_TRUE_FATAL(value)
.RS 5
Assert that value is TRUE (non-zero).
Assert that value is CU_TRUE (non-zero).
.RE
.P
......@@ -154,7 +154,7 @@ Assert that value is TRUE (non-zero).
.br
.B CU_ASSERT_FALSE_FATAL(value)
.RS 5
Assert that value is FALSE (zero).
Assert that value is CU_FALSE (zero).
.RE
.P
......@@ -591,7 +591,7 @@ Prints a summary of all failures to stdout. Does not depend on the run mode.
.SS "Interactive Console Interface"
The console interface is interactive. All the client needs to do is initiate
the
the
console session, and the user controls the test run interactively. This
include
selection & running of suites and tests, and viewing test results.
......@@ -600,7 +600,7 @@ selection & running of suites and tests, and viewing test results.
.TP 5
.B "void CU_console_run_tests(void)"
Initiate an interactive test run in the console.
.SS "Interactive Curses Interface"
The curses interface is interactive. All the client needs to do is initiate
the
......
......@@ -51,7 +51,7 @@ success or failure of these assertions is tracked by the framework,
and can be viewed when a test run is complete.
<P />
Each assertion tests a single logical condition, and fails if the
condition evaluates to <CODE>FALSE</CODE>. Upon failure, the test
condition evaluates to <CODE>CU_FALSE</CODE>. Upon failure, the test
function continues unless the user chooses the 'xxx_FATAL' version
of an assertion. In that case, the test function is aborted and
returns immediately. <B>FATAL versions of assertions should be used
......@@ -99,7 +99,7 @@ The assertions defined by CUnit are:
<CITE><B>CU_TEST_FATAL</B>(int expression)</CITE>
</CODE>
</TD>
<TD>Assert that <I>expression</I> is <CODE>TRUE</CODE> (non-zero)</TD>
<TD>Assert that <I>expression</I> is <CODE>CU_TRUE</CODE> (non-zero)</TD>
</TR>
<TR VALIGN="top">
<TD>
......@@ -108,7 +108,7 @@ The assertions defined by CUnit are:
<CITE><B>CU_ASSERT_TRUE_FATAL</B>(value)</CITE>
</CODE>
</TD>
<TD>Assert that <I>value</I> is <CODE>TRUE (non-zero)</TD>
<TD>Assert that <I>value</I> is <CODE>CU_TRUE (non-zero)</TD>
</TR>
<TR VALIGN="top">
<TD>
......@@ -117,7 +117,7 @@ The assertions defined by CUnit are:
<CITE><B>CU_ASSERT_FALSE_FATAL</B>(value)</CITE>
</CODE>
</TD>
<TD>Assert that <I>value</I> is <CODE>FALSE</CODE> (zero)</TD>
<TD>Assert that <I>value</I> is <CODE>CU_FALSE</CODE> (zero)</TD>
</TR>
<TR VALIGN="top">
<TD>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment