/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2011, International Business Machines Corporation and
+ * Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
#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
*/
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);
/**