Commit f8ef72e8 authored by jds2's avatar jds2

- modified dtd and xsl files to support inactive suites/tests.

- instrumented entire framework/interfaces for gettext
    (not activated yet, just instrumented source).


git-svn-id: http://svn.code.sf.net/p/cunit/code/trunk@101 f00e6729-6848-4c17-8bfb-678c97c00071
parent 58a586f1
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
/* /*
* Contains Interface for console Run tests. * Contains Interface for curses Run tests.
* *
* Aug 2001 Initial implementation. (AK) * Aug 2001 Initial implementation. (AK)
* *
......
/* /*
* CUnit - A Unit testing framework library for C. * CUnit - A Unit testing framework library for C.
* Copyright (C) 2001 Anil Kumar * Copyright (C) 2001 Anil Kumar
* Copyright (C) 2004,2005,2006 Anil Kumar, Jerry St.Clair * Copyright (C) 2004-2006 Anil Kumar, Jerry St.Clair
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
/* /*
* Contains ASSERT Macro definitions. * ASSERT Macro definitions and general CUnit configuration definitions.
* *
* 09/Aug/2001 ASSERT definitions. (AK) * 09/Aug/2001 ASSERT definitions. (AK)
* *
...@@ -83,7 +83,15 @@ ...@@ -83,7 +83,15 @@
#define CU_UNREFERENCED_PARAMETER(x) (void)x #define CU_UNREFERENCED_PARAMETER(x) (void)x
#endif #endif
#ifdef WIN32 #ifndef CU_MAX
# define CU_MAX(a,b) (((a) >= (b)) ? (a) : (b))
#endif
#ifndef CU_MIN
# define CU_MIN(a,b) (((a) >= (b)) ? (b) : (a))
#endif
#if defined(WIN32) || defined(_WIN32) || defined(_WIN32_)
# ifdef CU_DLL # ifdef CU_DLL
# ifdef CU_BUILD_DLL # ifdef CU_BUILD_DLL
# define CU_EXPORT __declspec(dllexport) # define CU_EXPORT __declspec(dllexport)
...@@ -93,9 +101,13 @@ ...@@ -93,9 +101,13 @@
# else # else
# define CU_EXPORT # define CU_EXPORT
# endif # endif
# ifdef _MSC_VER
# define snprintf _snprintf
# define itoa _itoa
# endif
#else #else
# define CU_EXPORT # define CU_EXPORT
#endif #endif /* WIN32 */
#include "CUError.h" #include "CUError.h"
#include "TestDB.h" /* not needed here - included for user convenience */ #include "TestDB.h" /* not needed here - included for user convenience */
......
/*
* CUnit - A Unit testing framework library for C.
* Copyright (C) 2006 Jerry St.Clair
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Internationalization support
*
* 05-May-2006 Initial implementation. (JDS)
*/
/** @file
* Internal CUnit header supporting internationalization of
* CUnit framework & interfaces.
*/
/** @addtogroup Framework
* @{
*/
#ifndef CUNIT_CUNIT_INTL_H_SEEN
#define CUNIT_CUNIT_INTL_H_SEEN
/* activate these when source preparation is complete
#include <libintl.h>
#ifndef _
# define _(String) gettext (String)
#endif
#ifndef gettext_noop
# define gettext_noop(String) String
#endif
#ifndef N_
# define N_(String) gettext_noop (String)
#endif
*/
/* deactivate these when source preparation is complete */
#undef _
#define _(String) (String)
#undef N_
#define N_(String) String
#undef textdomain
#define textdomain(Domain)
#undef bindtextdomain
#define bindtextdomain(Package, Directory)
#endif /* CUNIT_CUNIT_INTL_H_SEEN */
/** @} */
...@@ -281,7 +281,7 @@ CU_pSuite CU_add_suite(const char *strName, ...@@ -281,7 +281,7 @@ CU_pSuite CU_add_suite(const char *strName,
* initialized before calling this function (checked by assertion). * initialized before calling this function (checked by assertion).
* pInit and pClean may be NULL, in which case no corresponding * pInit and pClean may be NULL, in which case no corresponding
* initialization of cleanup function will be called when the suite * initialization of cleanup function will be called when the suite
* is run.<br /><br /> * is run. strName may be empty ("") but may not be NULL.<br /><br />
* *
* The return value is a pointer to the newly-created suite, or * The return value is a pointer to the newly-created suite, or
* NULL if there was a problem with the suite creation or addition. * NULL if there was a problem with the suite creation or addition.
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
* 23-Apr-2006 Moved doxygen comments into header. * 23-Apr-2006 Moved doxygen comments into header.
* Added type marker to CU_FailureRecord. * Added type marker to CU_FailureRecord.
* Added support for tracking inactive suites/tests. (JDS) * Added support for tracking inactive suites/tests. (JDS)
*
* 08-May-2006 Moved CU_print_run_results() functionality from
* console/basic test complete handler. (JDS)
*/ */
/** @file /** @file
...@@ -315,6 +318,20 @@ CU_EXPORT CU_pRunSummary CU_get_run_summary(void); ...@@ -315,6 +318,20 @@ CU_EXPORT CU_pRunSummary CU_get_run_summary(void);
* initiates a run using CU_run_all_tests(), CU_run_suite(), or CU_run_test(). * initiates a run using CU_run_all_tests(), CU_run_suite(), or CU_run_test().
*/ */
CU_EXPORT void CU_print_run_results(FILE *file);
/**<
* Prints a summary of the current run to file.
* The run summary presents data for the suites, tests, and assertions
* encountered during the run. The data presented include the number
* of registered, run, passed, failed, and inactive entities for each.
* This function can be called at any time, although the test registry
* must have been initialized and file may not be NULL (both checked by
* assertion).
*
* @param file Pointer to stream to receive the printed summary.
*/
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Functions for internal & testing use. * Functions for internal & testing use.
*--------------------------------------------------------------------*/ *--------------------------------------------------------------------*/
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
* 5-Sep-2004 Added internal test interface. (JDS) * 5-Sep-2004 Added internal test interface. (JDS)
* *
* 17-Apr-2006 Added CU_translated_strlen(). * 17-Apr-2006 Added CU_translated_strlen() and CU_number_width().
* Removed CUNIT_MAX_STRING_LENGTH - dangerous since not enforced. * Removed CUNIT_MAX_STRING_LENGTH - dangerous since not enforced.
* Fixed off-by-1 error in CU_translate_special_characters(), * Fixed off-by-1 error in CU_translate_special_characters(),
* modifying implementation & results in some cases. User can * modifying implementation & results in some cases. User can
...@@ -74,7 +74,7 @@ CU_EXPORT size_t CU_translate_special_characters(const char *szSrc, char *szDest ...@@ -74,7 +74,7 @@ CU_EXPORT size_t CU_translate_special_characters(const char *szSrc, char *szDest
* in an unspecified manner. It is the caller's responsibility to make * in an unspecified manner. It is the caller's responsibility to make
* sure there is sufficient room in szDest to hold the converted string. * sure there is sufficient room in szDest to hold the converted string.
* CU_translated_strlen() may be used to calculate the length of buffer * CU_translated_strlen() may be used to calculate the length of buffer
* required (remembering to add 1 for the terminating \0). * required (remember to add 1 for the terminating \0).
* *
* @param szSrc Source string to convert (non-NULL). * @param szSrc Source string to convert (non-NULL).
* @param szDest Location to hold the converted string (non-NULL). * @param szDest Location to hold the converted string (non-NULL).
...@@ -107,22 +107,28 @@ CU_EXPORT int CU_compare_strings(const char *szSrc, const char *szDest); ...@@ -107,22 +107,28 @@ CU_EXPORT int CU_compare_strings(const char *szSrc, const char *szDest);
CU_EXPORT void CU_trim_left(char *szString); CU_EXPORT void CU_trim_left(char *szString);
/**< /**<
* Trim leading whitespace from the specified string. * Trims leading whitespace from the specified string.
* @param szString The string to trim. * @param szString The string to trim.
*/ */
CU_EXPORT void CU_trim_right(char *szString); CU_EXPORT void CU_trim_right(char *szString);
/**< /**<
* Trim trailing whitespace from the specified string. * Trims trailing whitespace from the specified string.
* @param szString The string to trim. * @param szString The string to trim.
*/ */
CU_EXPORT void CU_trim(char *szString); CU_EXPORT void CU_trim(char *szString);
/**< /**<
* Trim leading and trailing whitespace from the specified string. * Trims leading and trailing whitespace from the specified string.
* @param szString The string to trim. * @param szString The string to trim.
*/ */
CU_EXPORT size_t CU_number_width(int number);
/**<
* Calulates the number of places required to display
* number in decimal.
*/
#ifdef CUNIT_BUILD_TESTS #ifdef CUNIT_BUILD_TESTS
void test_cunit_Util(void); void test_cunit_Util(void);
#endif #endif
......
This diff is collapsed.
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* 8-Jan-2005 Fixed reporting bug (bug report cunit-Bugs-1093861). (JDS) * 8-Jan-2005 Fixed reporting bug (bug report cunit-Bugs-1093861). (JDS)
* *
* 30-Apr-2005 Added notification of suite cleanup failure. (JDS) * 30-Apr-2005 Added notification of suite cleanup failure. (JDS)
*
* 02-May-2006 Added internationalization hooks. (JDS)
*/ */
/** @file /** @file
...@@ -45,6 +47,7 @@ ...@@ -45,6 +47,7 @@
#include "Util.h" #include "Util.h"
#include "TestRun.h" #include "TestRun.h"
#include "Basic.h" #include "Basic.h"
#include "CUnit_intl.h"
/*================================================================= /*=================================================================
* Global/Static Definitions * Global/Static Definitions
...@@ -77,7 +80,7 @@ CU_ErrorCode CU_basic_run_tests(void) ...@@ -77,7 +80,7 @@ CU_ErrorCode CU_basic_run_tests(void)
if (NULL == CU_get_registry()) { if (NULL == CU_get_registry()) {
if (CU_BRM_SILENT != f_run_mode) if (CU_BRM_SILENT != f_run_mode)
fprintf(stderr, "\n\nFATAL ERROR - Test registry is not initialized.\n"); fprintf(stderr, "\n\n%s\n", _("FATAL ERROR - Test registry is not initialized."));
error = CUE_NOREGISTRY; error = CUE_NOREGISTRY;
} }
else if (CUE_SUCCESS == (error = basic_initialize())) else if (CUE_SUCCESS == (error = basic_initialize()))
...@@ -156,8 +159,10 @@ static CU_ErrorCode basic_initialize(void) ...@@ -156,8 +159,10 @@ static CU_ErrorCode basic_initialize(void)
CU_set_error(CUE_SUCCESS); CU_set_error(CUE_SUCCESS);
if (CU_BRM_SILENT != f_run_mode) if (CU_BRM_SILENT != f_run_mode)
fprintf(stdout, "\n\n CUnit - A Unit testing framework for C - Version " CU_VERSION fprintf(stdout, "\n\n %s" CU_VERSION
"\n http://cunit.sourceforge.net/\n\n"); "\n %s\n\n",
_("CUnit - A unit testing framework for C - Version "),
_("http://cunit.sourceforge.net/"));
CU_set_test_start_handler(basic_test_start_message_handler); CU_set_test_start_handler(basic_test_start_message_handler);
CU_set_test_complete_handler(basic_test_complete_message_handler); CU_set_test_complete_handler(basic_test_complete_message_handler);
...@@ -230,13 +235,15 @@ static void basic_test_start_message_handler(const CU_pTest pTest, const CU_pSui ...@@ -230,13 +235,15 @@ static void basic_test_start_message_handler(const CU_pTest pTest, const CU_pSui
assert(NULL != pTest); assert(NULL != pTest);
if (CU_BRM_VERBOSE == f_run_mode) { if (CU_BRM_VERBOSE == f_run_mode) {
assert(NULL != pTest->pName);
if ((NULL == f_pRunningSuite) || (f_pRunningSuite != pSuite)) { if ((NULL == f_pRunningSuite) || (f_pRunningSuite != pSuite)) {
fprintf(stdout, "\nSuite: %s", (NULL != pSuite->pName) ? pSuite->pName : ""); assert(NULL != pSuite->pName);
fprintf(stdout, "\n Test: %s ... ", (NULL != pTest->pName) ? pTest->pName : ""); fprintf(stdout, "\n%s: %s", _("Suite"), pSuite->pName);
fprintf(stdout, "\n %s: %s ...", _("Test"), pTest->pName);
f_pRunningSuite = pSuite; f_pRunningSuite = pSuite;
} }
else { else {
fprintf(stdout, "\n Test: %s ... ", (NULL != pTest->pName) ? pTest->pName : ""); fprintf(stdout, "\n %s: %s ...", _("Test"), pTest->pName);
} }
} }
} }
...@@ -259,18 +266,18 @@ static void basic_test_complete_message_handler(const CU_pTest pTest, ...@@ -259,18 +266,18 @@ static void basic_test_complete_message_handler(const CU_pTest pTest,
if (NULL == pFailure) { if (NULL == pFailure) {
if (CU_BRM_VERBOSE == f_run_mode) { if (CU_BRM_VERBOSE == f_run_mode) {
fprintf(stdout, "passed"); fprintf(stdout, _("passed"));
} }
} }
else { else {
switch (f_run_mode) { switch (f_run_mode) {
case CU_BRM_VERBOSE: case CU_BRM_VERBOSE:
fprintf(stdout, "FAILED"); fprintf(stdout, _("FAILED"));
break; break;
case CU_BRM_NORMAL: case CU_BRM_NORMAL:
fprintf(stdout, "\nSuite %s, Test %s had failures:", assert(NULL != pSuite->pName);
(NULL != pSuite->pName) ? pSuite->pName : "", assert(NULL != pTest->pName);
(NULL != pTest->pName) ? pTest->pName : ""); fprintf(stdout, _("\nSuite %s, Test %s had failures:"), pSuite->pName, pTest->pName);
break; break;
default: /* gcc wants all enums covered. ok. */ default: /* gcc wants all enums covered. ok. */
break; break;
...@@ -292,32 +299,8 @@ static void basic_test_complete_message_handler(const CU_pTest pTest, ...@@ -292,32 +299,8 @@ static void basic_test_complete_message_handler(const CU_pTest pTest,
*/ */
static void basic_all_tests_complete_message_handler(const CU_pFailureRecord pFailure) static void basic_all_tests_complete_message_handler(const CU_pFailureRecord pFailure)
{ {
CU_pRunSummary pRunSummary = CU_get_run_summary();
CU_pTestRegistry pRegistry = CU_get_registry();
CU_UNREFERENCED_PARAMETER(pFailure); /* not used in basic interface */ CU_UNREFERENCED_PARAMETER(pFailure); /* not used in basic interface */
CU_print_run_results(stdout);
assert(NULL != pRunSummary);
assert(NULL != pRegistry);
if (CU_BRM_SILENT != f_run_mode)
fprintf(stdout,"\n\n--Run Summary: Type Total Ran Passed Failed Inactive"
"\n suites %8u%8u n/a%8u%8u"
"\n tests %8u%8u%8u%8u%8u"
"\n asserts%8u%8u%8u%8u n/a\n",
pRegistry->uiNumberOfSuites,
pRunSummary->nSuitesRun,
pRunSummary->nSuitesFailed,
pRunSummary->nSuitesInactive,
pRegistry->uiNumberOfTests,
pRunSummary->nTestsRun,
pRunSummary->nTestsRun - pRunSummary->nTestsFailed,
pRunSummary->nTestsFailed,
pRunSummary->nTestsInactive,
pRunSummary->nAsserts,
pRunSummary->nAsserts,
pRunSummary->nAsserts - pRunSummary->nAssertsFailed,
pRunSummary->nAssertsFailed);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
...@@ -327,11 +310,10 @@ static void basic_all_tests_complete_message_handler(const CU_pFailureRecord pFa ...@@ -327,11 +310,10 @@ static void basic_all_tests_complete_message_handler(const CU_pFailureRecord pFa
static void basic_suite_init_failure_message_handler(const CU_pSuite pSuite) static void basic_suite_init_failure_message_handler(const CU_pSuite pSuite)
{ {
assert(NULL != pSuite); assert(NULL != pSuite);
assert(NULL != pSuite->pName);
if (CU_BRM_SILENT != f_run_mode) if (CU_BRM_SILENT != f_run_mode)
fprintf(stdout, fprintf(stdout, _("\nWARNING - Suite initialization failed for '%s'."), pSuite->pName);
"\nWARNING - Suite initialization failed for %s.",
(NULL != pSuite->pName) ? pSuite->pName : "");
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
...@@ -341,11 +323,10 @@ static void basic_suite_init_failure_message_handler(const CU_pSuite pSuite) ...@@ -341,11 +323,10 @@ static void basic_suite_init_failure_message_handler(const CU_pSuite pSuite)
static void basic_suite_cleanup_failure_message_handler(const CU_pSuite pSuite) static void basic_suite_cleanup_failure_message_handler(const CU_pSuite pSuite)
{ {
assert(NULL != pSuite); assert(NULL != pSuite);
assert(NULL != pSuite->pName);
if (CU_BRM_SILENT != f_run_mode) if (CU_BRM_SILENT != f_run_mode)
fprintf(stdout, fprintf(stdout, _("\nWARNING - Suite cleanup failed for '%s'."), pSuite->pName);
"\nWARNING - Suite cleanup failed for %s.",
(NULL != pSuite->pName) ? pSuite->pName : "");
} }
/** @} */ /** @} */
This diff is collapsed.
This diff is collapsed.
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
* *
* 16-Jul-2004 Created access functions for error code, error action * 16-Jul-2004 Created access functions for error code, error action
* functions, messages for new error codes. (JDS) * functions, messages for new error codes. (JDS)
*
* 02-May-2006 Added internationalization hooks. (JDS)
*/ */
/** @file /** @file
...@@ -35,6 +37,7 @@ ...@@ -35,6 +37,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "CUnit_intl.h"
#include "CUError.h" #include "CUError.h"
/*================================================================= /*=================================================================
...@@ -61,7 +64,7 @@ void CU_set_error(CU_ErrorCode error) ...@@ -61,7 +64,7 @@ void CU_set_error(CU_ErrorCode error)
{ {
if ((error != CUE_SUCCESS) && (g_error_action == CUEA_ABORT)) { if ((error != CUE_SUCCESS) && (g_error_action == CUEA_ABORT)) {
#ifndef CUNIT_DO_NOT_DEFINE_UNLESS_BUILDING_TESTS #ifndef CUNIT_DO_NOT_DEFINE_UNLESS_BUILDING_TESTS
fprintf(stderr, "\nAborting due to error #%d: %s\n", fprintf(stderr, _("\nAborting due to error #%d: %s\n"),
(int)error, (int)error,
get_error_desc(error)); get_error_desc(error));
exit((int)error); exit((int)error);
...@@ -114,8 +117,8 @@ static const char* get_error_desc(CU_ErrorCode iError) ...@@ -114,8 +117,8 @@ static const char* get_error_desc(CU_ErrorCode iError)
int iMaxIndex; int iMaxIndex;
static const char* ErrorDescription[] = { static const char* ErrorDescription[] = {
"No Error", /* CUE_SUCCESS - 0 */ N_("No Error."), /* CUE_SUCCESS - 0 */
"Memory allocation failed.", /* CUE_NOMEMORY - 1 */ N_("Memory allocation failed."), /* CUE_NOMEMORY - 1 */
"", "",
"", "",
"", "",
...@@ -124,8 +127,8 @@ static const char* get_error_desc(CU_ErrorCode iError) ...@@ -124,8 +127,8 @@ static const char* get_error_desc(CU_ErrorCode iError)
"", "",
"", "",
"", "",
"Test registry does not exist.", /* CUE_NOREGISTRY - 10 */ N_("Test registry does not exist."), /* CUE_NOREGISTRY - 10 */
"Registry already exists.", /* CUE_REGISTRY_EXISTS - 11 */ N_("Registry already exists."), /* CUE_REGISTRY_EXISTS - 11 */
"", "",
"", "",
"", "",
...@@ -134,42 +137,42 @@ static const char* get_error_desc(CU_ErrorCode iError) ...@@ -134,42 +137,42 @@ static const char* get_error_desc(CU_ErrorCode iError)
"", "",
"", "",
"", "",
"NULL suite not allowed.", /* CUE_NOSUITE - 20 */ N_("NULL suite not allowed."), /* CUE_NOSUITE - 20 */
"Suite name cannot be NULL.", /* CUE_NO_SUITENAME - 21 */ N_("Suite name cannot be NULL."), /* CUE_NO_SUITENAME - 21 */
"Suite initialization function failed.", /* CUE_SINIT_FAILED - 22 */ N_("Suite initialization function failed."), /* CUE_SINIT_FAILED - 22 */
"Suite cleanup function failed.", /* CUE_SCLEAN_FAILED - 23 */ N_("Suite cleanup function failed."), /* CUE_SCLEAN_FAILED - 23 */
"Suite having name already registered.", /* CUE_DUP_SUITE - 24 */ N_("Suite having name already registered."), /* CUE_DUP_SUITE - 24 */
"Requested suite is not active.", /* CUE_SUITE_INACTIVE - 25 */ N_("Requested suite is not active."), /* CUE_SUITE_INACTIVE - 25 */
"", "",
"", "",
"", "",
"", "",
"NULL test or test function not allowed.",/* CUE_NOTEST - 30 */ N_("NULL test or test function not allowed."),/* CUE_NOTEST - 30 */
"Test name cannot be NULL.", /* CUE_NO_TESTNAME - 31 */ N_("Test name cannot be NULL."), /* CUE_NO_TESTNAME - 31 */
"Test having this name already in suite.",/* CUE_DUP_TEST - 32 */ N_("Test having this name already in suite."),/* CUE_DUP_TEST - 32 */
"Test not registered in specified suite.",/* CUE_TEST_NOT_IN_SUITE - 33 */ N_("Test not registered in specified suite."),/* CUE_TEST_NOT_IN_SUITE - 33 */
"Requested test is not active", /* CUE_TEST_INACTIVE - 34 */ N_("Requested test is not active"), /* CUE_TEST_INACTIVE - 34 */
"", "",
"", "",
"", "",
"", "",
"", "",
"Error opening file.", /* CUE_FOPEN_FAILED - 40 */ N_("Error opening file."), /* CUE_FOPEN_FAILED - 40 */
"Error closing file.", /* CUE_FCLOSE_FAILED - 41 */ N_("Error closing file."), /* CUE_FCLOSE_FAILED - 41 */
"Bad file name.", /* CUE_BAD_FILENAME - 42 */ N_("Bad file name."), /* CUE_BAD_FILENAME - 42 */
"Error during write to file.", /* CUE_WRITE_ERROR - 43 */ N_("Error during write to file."), /* CUE_WRITE_ERROR - 43 */
"Undefined Error" N_("Undefined Error")
}; };
iMaxIndex = (int)(sizeof(ErrorDescription)/sizeof(char *) - 1); iMaxIndex = (int)(sizeof(ErrorDescription)/sizeof(char *) - 1);
if ((int)iError < 0) { if ((int)iError < 0) {
return ErrorDescription[0]; return _(ErrorDescription[0]);
} }
else if ((int)iError > iMaxIndex) { else if ((int)iError > iMaxIndex) {
return ErrorDescription[iMaxIndex]; return _(ErrorDescription[iMaxIndex]);
} }
else { else {
return ErrorDescription[(int)iError]; return _(ErrorDescription[(int)iError]);
} }
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
* *
* 24-Apr-2005 Changed type of allocated sizes to size_t to avoid * 24-Apr-2005 Changed type of allocated sizes to size_t to avoid
* signed-unsigned mismatch. (JDS) * signed-unsigned mismatch. (JDS)
*
* 02-May-2006 Added internationalization hooks. (JDS)
*/ */
/** @file /** @file
...@@ -52,6 +54,7 @@ ...@@ -52,6 +54,7 @@
#include "CUnit.h" #include "CUnit.h"
#include "MyMem.h" #include "MyMem.h"
#include "CUNit_intl.h"
#ifdef MEMTRACE #ifdef MEMTRACE
...@@ -154,7 +157,7 @@ static PMEMORY_EVENT add_memory_event(PMEMORY_NODE pMemoryNode, ...@@ -154,7 +157,7 @@ static PMEMORY_EVENT add_memory_event(PMEMORY_NODE pMemoryNode,
assert (NULL != pMemoryNode); assert (NULL != pMemoryNode);
/* create and set up the new event */ /* create and set up the new event */
pMemoryEvent = malloc(sizeof(MEMORY_EVENT)); pMemoryEvent = (PMEMORY_EVENT)malloc(sizeof(MEMORY_EVENT));
assert(NULL != pMemoryEvent); assert(NULL != pMemoryEvent);
pMemoryEvent->Size = size; pMemoryEvent->Size = size;
...@@ -333,7 +336,7 @@ void CU_dump_memory_usage(const char* szFilename) ...@@ -333,7 +336,7 @@ void CU_dump_memory_usage(const char* szFilename)
} }
if (NULL == (pFile = fopen(szDumpFileName, "w"))) { if (NULL == (pFile = fopen(szDumpFileName, "w"))) {
fprintf(stderr, "Failed to open file \"%s\" : %s", szDumpFileName, strerror(errno)); fprintf(stderr, _("Failed to open file \"%s\" : %s"), szDumpFileName, strerror(errno));
return; return;
} }
......
...@@ -21,27 +21,29 @@ ...@@ -21,27 +21,29 @@
/* /*
* Implementation of Registry/TestGroup/Testcase management Routines. * Implementation of Registry/TestGroup/Testcase management Routines.
* *
* Aug 2001 Initial implementation (AK) * Aug 2001 Initial implementation (AK)
* *
* 09/Aug/2001 Added startup initialize/cleanup registry functions. (AK) * 09/Aug/2001 Added startup initialize/cleanup registry functions. (AK)
* *
* 29/Aug/2001 Added Test and Group Add functions. (AK) * 29/Aug/2001 Added Test and Group Add functions. (AK)
* *
* 02/Oct/2001 Added Proper Error codes and Messages on the failure conditions. (AK) * 02/Oct/2001 Added Proper Error codes and Messages on the failure conditions. (AK)
* *
* 13/Oct/2001 Added Code to Check for the Duplicate Group name and test name. (AK) * 13/Oct/2001 Added Code to Check for the Duplicate Group name and test name. (AK)
* *
* 15-Jul-2004 Added doxygen comments, new interface, added assertions to * 15-Jul-2004 Added doxygen comments, new interface, added assertions to
* internal functions, moved error handling code to CUError.c, * internal functions, moved error handling code to CUError.c,
* added assertions to make sure no modification of registry * added assertions to make sure no modification of registry
* during a run, bug fixes, changed CU_set_registry() so that it * during a run, bug fixes, changed CU_set_registry() so that it
* doesn't require cleaning the existing registry. (JDS) * doesn't require cleaning the existing registry. (JDS)
* *
* 24-Apr-2006 Removed constraint that suites/tests be uniquely named. * 24-Apr-2006 Removed constraint that suites/tests be uniquely named.
* Added ability to turn individual tests/suites on or off. * Added ability to turn individual tests/suites on or off.
* Added lookup functions for suites/tests based on index. * Added lookup functions for suites/tests based on index.
* Moved doxygen comments for public API here to header. * Moved doxygen comments for public API here to header.
* Modified internal unit tests to include these changes. (JDS) * Modified internal unit tests to include these changes. (JDS)
*
* 02-May-2006 Added internationalization hooks. (JDS)
*/ */
/** @file /** @file
...@@ -62,6 +64,7 @@ ...@@ -62,6 +64,7 @@
#include "TestDB.h" #include "TestDB.h"
#include "TestRun.h" #include "TestRun.h"
#include "Util.h" #include "Util.h"
#include "CUnit_intl.h"
/*================================================================= /*=================================================================
* Global/Static Definitions * Global/Static Definitions
......