]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/cintltst/cintltst.h
ICU-57166.0.1.tar.gz
[apple/icu.git] / icuSources / test / cintltst / cintltst.h
index e750424b895df7313a2368a3c0ad60c8abdf7169..d1d4ee53a642ec322e757f9e4e476f8518cfba26 100644 (file)
@@ -1,6 +1,6 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2005, International Business Machines Corporation and
+ * Copyright (c) 1997-2013, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
 /********************************************************************************
@@ -22,6 +22,12 @@ The main root for C API tests
 #include "unicode/utypes.h"
 #include "unicode/putil.h"
 #include "unicode/ctest.h"
+
+#if U_NO_DEFAULT_INCLUDE_UTF_HEADERS
+/* deprecated  - make tests pass with U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
+#include "unicode/utf_old.h" 
+#endif
+
 #include <stdlib.h>
 
 #ifndef U_USE_DEPRECATED_API
@@ -41,21 +47,43 @@ U_CFUNC const char* ctest_dataOutDir(void);
  */
 U_CFUNC const char* ctest_dataSrcDir(void);
 
+/**
+ * Convert a char string into a UChar string, with unescaping
+ * The result buffer has been malloc()'ed (not ctst_malloc) and needs to be free()'ed by the caller.
+ */
 U_CFUNC UChar* CharsToUChars(const char* chars);
 
 /**
  * Convert a const UChar* into a char*
- * Caller owns storage, but in practice this function
- * LEAKS so be aware of that.
+ * Result is allocated with ctst_malloc and will be freed at the end of the test.
  * @param unichars UChars (null terminated) to be converted
  * @return new char* to the unichars in host format
  */
  
 U_CFUNC char *austrdup(const UChar* unichars);
+
+/**
+ * Convert a const UChar* into an escaped char*
+ * Result is allocated with ctst_malloc and will be freed at the end of the test.
+ * @param unichars UChars to be converted
+ * @param length length of chars
+ * @return new char* to the unichars in host format
+ */
 U_CFUNC char *aescstrdup(const UChar* unichars, int32_t length);
+
+/**
+ * Special memory allocation function for test use. At the end of cintltst, 
+ * or every few thousand allocations, memory allocated by this function will be freed.
+ * Do not manually free memory returned by this function, and do not retain a pointer
+ * outside of a single instruction scope (i.e. long enough to display the value).
+ * @see #ctst_freeAll
+ */
 U_CFUNC void *ctst_malloc(size_t size);
-U_CFUNC void ctst_freeAll(void);
 
+/**
+ * Return the path to cintltst's data ( icu/source/data/testdata ) directory. 
+ * Return value is allocated by ctst_malloc and should not be deleted.
+ */
 U_CFUNC const char* loadTestData(UErrorCode* err);
 
 /**
@@ -77,11 +105,23 @@ U_CFUNC void ctest_setTimeZone(const char *optionalTimeZone, UErrorCode *status)
  */
 U_CFUNC void ctest_resetTimeZone(void);
 
+/**
+ * Call this once get ICU back to its original state with test arguments.
+ * This function calls u_cleanup.
+ */
+U_CFUNC UBool ctest_resetICU(void);
+
 /**
  * Assert that the given UErrorCode succeeds, and return TRUE if it does.
  */
 U_CFUNC UBool assertSuccess(const char* msg, UErrorCode* ec);
 
+/**
+ * Assert that the given UErrorCode succeeds, and return TRUE if it does.
+ * Give data error if UErrorCode fails and possibleDataError is TRUE.
+ */
+U_CFUNC UBool assertSuccessCheck(const char* msg, UErrorCode* ec, UBool possibleDataError);
+
 /**
  * Assert that the UBool is TRUE, and return TRUE if it does.
  *
@@ -98,11 +138,9 @@ U_CFUNC UBool assertTrue(const char* msg, int condition);
 U_CFUNC UBool assertEquals(const char* msg, const char* expectedString,
                            const char* actualString);
 
-/**
- * Time bomb - allows temporary behavior that expires at a given
- *             release
- *
+/*
+ * note - isICUVersionBefore and isICUVersionAtLeast have been removed.
+ * use log_knownIssue() instead.
  */
-U_CFUNC UBool isICUVersionAtLeast(const UVersionInfo x);
 
 #endif