]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /******************************************************************** |
2 | * COPYRIGHT: | |
374ca955 | 3 | * Copyright (c) 1997-2004, International Business Machines Corporation and |
b75a7d8f A |
4 | * others. All Rights Reserved. |
5 | ********************************************************************/ | |
6 | /******************************************************************************** | |
7 | * | |
8 | * File CINTLTST.H | |
9 | * | |
10 | * Madhu Katragadda Creation | |
11 | * Modification History: | |
12 | * Date Name Description | |
13 | * 07/13/99 helena HPUX 11 CC port. | |
14 | ********************************************************************************* | |
15 | ||
16 | The main root for C API tests | |
17 | */ | |
18 | ||
19 | #ifndef _CINTLTST | |
20 | #define _CINTLTST | |
21 | ||
22 | #include "unicode/utypes.h" | |
374ca955 | 23 | #include "unicode/putil.h" |
b75a7d8f A |
24 | #include "unicode/ctest.h" |
25 | ||
26 | #ifndef U_USE_DEPRECATED_API | |
27 | #define U_USE_DEPRECATED_API 1 | |
28 | #endif | |
29 | ||
30 | U_CFUNC void addAllTests(TestNode** root); | |
31 | ||
32 | /** | |
33 | * Return the path to the icu/source/data/out directory | |
34 | */ | |
35 | U_CFUNC const char* ctest_dataOutDir(void); | |
36 | ||
37 | /** | |
38 | * Return the path to the icu/source/data/ directory | |
39 | * for out of source builds too returns the source directory | |
40 | */ | |
41 | U_CFUNC const char* ctest_dataSrcDir(void); | |
42 | ||
43 | /** | |
44 | *complete a relative path to a full pathname, and convert to platform-specific syntax. | |
45 | * The character seperating directories for the relative path is '|'. | |
46 | * @fullname the full path name | |
47 | * @maxsize the maximum size of the string | |
48 | * @relPath the relative path name | |
49 | */ | |
50 | U_CFUNC void ctest_pathnameInContext(char* fullname, int32_t maxsize, const char* relPath ) ; | |
51 | ||
52 | U_CFUNC UChar* CharsToUChars(const char* chars); | |
53 | ||
54 | /** | |
55 | * Convert a const UChar* into a char* | |
56 | * Caller owns storage, but in practice this function | |
57 | * LEAKS so be aware of that. | |
58 | * @param unichars UChars (null terminated) to be converted | |
59 | * @return new char* to the unichars in host format | |
60 | */ | |
61 | ||
62 | U_CFUNC char *austrdup(const UChar* unichars); | |
63 | U_CFUNC char *aescstrdup(const UChar* unichars, int32_t length); | |
64 | U_CFUNC void *ctst_malloc(size_t size); | |
65 | U_CFUNC void ctst_freeAll(void); | |
66 | ||
67 | U_CFUNC const char* loadTestData(UErrorCode* err); | |
68 | ||
69 | /** | |
70 | * function used to specify the error | |
71 | * converts the errorcode to an error descriptive string(const char*) | |
72 | * @param status the error code | |
73 | */ | |
74 | #define myErrorName(errorCode) u_errorName(errorCode) | |
75 | ||
76 | ||
374ca955 A |
77 | /** |
78 | * Call this once to get a consistent timezone. Use ctest_resetTimeZone to set it back to the original value. | |
79 | * @param optionalTimeZone Set this to a requested timezone. | |
80 | * Set to NULL to use the standard test timezone (Pacific Time) | |
81 | */ | |
82 | U_CFUNC void ctest_setTimeZone(const char *optionalTimeZone, UErrorCode *status); | |
83 | /** | |
84 | * Call this once get back the original timezone | |
85 | */ | |
86 | U_CFUNC void ctest_resetTimeZone(void); | |
87 | ||
88 | /** | |
89 | * Assert that the given UErrorCode succeeds, and return TRUE if it does. | |
90 | */ | |
91 | U_CFUNC UBool assertSuccess(const char* msg, UErrorCode* ec); | |
92 | ||
93 | /** | |
94 | * Assert that the UBool is TRUE, and return TRUE if it does. | |
95 | * | |
96 | * NOTE: Use 'int condition' rather than 'UBool condition' so the | |
97 | * compiler doesn't complain about integral conversion of expressions | |
98 | * like 'p != 0'. | |
99 | */ | |
100 | U_CFUNC UBool assertTrue(const char* msg, int condition); | |
101 | ||
102 | /** | |
103 | * Assert that the actualString equals the expectedString, and return | |
104 | * TRUE if it does. | |
105 | */ | |
106 | U_CFUNC UBool assertEquals(const char* msg, const char* expectedString, | |
107 | const char* actualString); | |
108 | ||
b75a7d8f | 109 | #endif |