2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2011-12-15 17:02:43 +00:00
|
|
|
* Copyright (c) 1997-2011, International Business Machines Corporation and
|
2000-01-15 02:00:06 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
|
|
|
/********************************************************************************
|
1999-08-16 21:50:52 +00:00
|
|
|
*
|
|
|
|
* File CINTLTST.H
|
|
|
|
*
|
|
|
|
* Madhu Katragadda Creation
|
|
|
|
* Modification History:
|
|
|
|
* Date Name Description
|
|
|
|
* 07/13/99 helena HPUX 11 CC port.
|
|
|
|
*********************************************************************************
|
|
|
|
|
|
|
|
The main root for C API tests
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CINTLTST
|
|
|
|
#define _CINTLTST
|
|
|
|
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/utypes.h"
|
2004-10-18 03:03:13 +00:00
|
|
|
#include "unicode/putil.h"
|
2000-01-17 22:53:44 +00:00
|
|
|
#include "unicode/ctest.h"
|
2004-12-03 20:22:01 +00:00
|
|
|
#include <stdlib.h>
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-08-16 00:58:53 +00:00
|
|
|
#ifndef U_USE_DEPRECATED_API
|
|
|
|
#define U_USE_DEPRECATED_API 1
|
|
|
|
#endif
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CFUNC void addAllTests(TestNode** root);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2002-07-17 03:56:50 +00:00
|
|
|
/**
|
|
|
|
* Return the path to the icu/source/data/out directory
|
|
|
|
*/
|
2002-07-25 18:32:04 +00:00
|
|
|
U_CFUNC const char* ctest_dataOutDir(void);
|
2002-07-17 03:56:50 +00:00
|
|
|
|
2003-04-24 23:08:42 +00:00
|
|
|
/**
|
|
|
|
* Return the path to the icu/source/data/ directory
|
|
|
|
* for out of source builds too returns the source directory
|
|
|
|
*/
|
|
|
|
U_CFUNC const char* ctest_dataSrcDir(void);
|
|
|
|
|
2002-09-27 00:28:23 +00:00
|
|
|
U_CFUNC UChar* CharsToUChars(const char* chars);
|
2002-09-20 17:54:45 +00:00
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* Convert a const UChar* into a char*
|
|
|
|
* Caller owns storage, but in practice this function
|
|
|
|
* LEAKS so be aware of that.
|
|
|
|
* @param unichars UChars (null terminated) to be converted
|
|
|
|
* @return new char* to the unichars in host format
|
|
|
|
*/
|
|
|
|
|
1999-10-18 22:48:32 +00:00
|
|
|
U_CFUNC char *austrdup(const UChar* unichars);
|
2002-04-02 03:36:54 +00:00
|
|
|
U_CFUNC char *aescstrdup(const UChar* unichars, int32_t length);
|
2000-07-06 23:01:50 +00:00
|
|
|
U_CFUNC void *ctst_malloc(size_t size);
|
2002-07-25 18:32:04 +00:00
|
|
|
U_CFUNC void ctst_freeAll(void);
|
2000-07-06 23:01:50 +00:00
|
|
|
|
2002-02-07 19:37:34 +00:00
|
|
|
U_CFUNC const char* loadTestData(UErrorCode* err);
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* function used to specify the error
|
|
|
|
* converts the errorcode to an error descriptive string(const char*)
|
|
|
|
* @param status the error code
|
|
|
|
*/
|
1999-12-08 23:31:17 +00:00
|
|
|
#define myErrorName(errorCode) u_errorName(errorCode)
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
|
2003-10-07 21:50:15 +00:00
|
|
|
/**
|
|
|
|
* Call this once to get a consistent timezone. Use ctest_resetTimeZone to set it back to the original value.
|
|
|
|
* @param optionalTimeZone Set this to a requested timezone.
|
|
|
|
* Set to NULL to use the standard test timezone (Pacific Time)
|
|
|
|
*/
|
|
|
|
U_CFUNC void ctest_setTimeZone(const char *optionalTimeZone, UErrorCode *status);
|
|
|
|
/**
|
|
|
|
* Call this once get back the original timezone
|
|
|
|
*/
|
|
|
|
U_CFUNC void ctest_resetTimeZone(void);
|
|
|
|
|
2007-12-07 10:49:34 +00:00
|
|
|
/**
|
|
|
|
* Call this once get ICU back to its original state with test arguments.
|
|
|
|
* This function calls u_cleanup.
|
|
|
|
*/
|
|
|
|
U_CFUNC UBool ctest_resetICU(void);
|
|
|
|
|
2004-04-28 05:31:02 +00:00
|
|
|
/**
|
|
|
|
* Assert that the given UErrorCode succeeds, and return TRUE if it does.
|
|
|
|
*/
|
|
|
|
U_CFUNC UBool assertSuccess(const char* msg, UErrorCode* ec);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assert that the UBool is TRUE, and return TRUE if it does.
|
2004-05-19 17:28:20 +00:00
|
|
|
*
|
|
|
|
* NOTE: Use 'int condition' rather than 'UBool condition' so the
|
|
|
|
* compiler doesn't complain about integral conversion of expressions
|
|
|
|
* like 'p != 0'.
|
2004-04-28 05:31:02 +00:00
|
|
|
*/
|
2004-05-19 17:28:20 +00:00
|
|
|
U_CFUNC UBool assertTrue(const char* msg, int condition);
|
2004-04-28 05:31:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Assert that the actualString equals the expectedString, and return
|
|
|
|
* TRUE if it does.
|
|
|
|
*/
|
|
|
|
U_CFUNC UBool assertEquals(const char* msg, const char* expectedString,
|
|
|
|
const char* actualString);
|
2003-10-07 21:50:15 +00:00
|
|
|
|
2005-03-31 00:19:21 +00:00
|
|
|
/**
|
2011-12-15 17:02:43 +00:00
|
|
|
* Returns true if u_getVersion() < major.minor.milli.
|
|
|
|
*/
|
|
|
|
U_CFUNC UBool isICUVersionBefore(int major, int minor, int milli);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if u_getVersion() >= major.minor.milli.
|
2005-03-31 00:19:21 +00:00
|
|
|
*/
|
2011-12-15 17:02:43 +00:00
|
|
|
U_CFUNC UBool isICUVersionAtLeast(int major, int minor, int milli);
|
2005-03-31 00:19:21 +00:00
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#endif
|