forked from unicode-org/icu
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcintltst.h
More file actions
174 lines (145 loc) · 5.45 KB
/
cintltst.h
File metadata and controls
174 lines (145 loc) · 5.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2013, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/********************************************************************************
*
* 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
#include "unicode/utypes.h"
#include "unicode/putil.h"
#include "unicode/ctest.h"
#include <stdlib.h>
#ifndef U_USE_DEPRECATED_API
#define U_USE_DEPRECATED_API 1
#endif
U_CFUNC void addAllTests(TestNode** root);
/**
* Return the path to the icu/source/data/out directory
*/
U_CFUNC const char* ctest_dataOutDir(void);
/**
* 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);
/**
* 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*
* 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);
/**
* Return the path to cintltst's data ( icu/source/data/testdata ) directory.
* The path may be in the out/ directory.
* Return value is allocated by ctst_malloc and should not be deleted.
*/
U_CFUNC const char* loadTestData(UErrorCode* err);
/*
* Returns the path to the icu/source/test/testdata directory.
* The path is always the source directory.
* Return value is static and should not be deleted.
*/
U_CFUNC const char* loadSourceTestData(UErrorCode* err);
/**
* function used to specify the error
* converts the errorcode to an error descriptive string(const char*)
* @param status the error code
*/
#define myErrorName(errorCode) u_errorName(errorCode)
/**
* 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);
/**
* 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.
*
* NOTE: Use 'int condition' rather than 'UBool condition' so the
* compiler doesn't complain about integral conversion of expressions
* like 'p != 0'.
*/
U_CFUNC UBool assertTrue(const char* msg, int condition);
/**
* 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);
/**
* Assert that the actualString equals the expectedString, and return
* true if it does.
*/
U_CFUNC UBool assertUEquals(const char* msg, const UChar* expectedString,
const UChar* actualString);
/**
* Assert that two 64-bit integers are equal, returning true if they are.
*/
U_CFUNC UBool assertIntEquals(const char* msg, int64_t expected, int64_t actual);
/**
* Assert that the addresses of the two pointers are the same, returning
* true if they are equal.
*/
U_CFUNC UBool assertPtrEquals(const char* msg, const void* expected, const void* actual);
/**
* Assert that two doubles are equal, returning true if they are.
*/
U_CFUNC UBool assertDoubleEquals(const char *msg, double expected, double actual);
/*
* note - isICUVersionBefore and isICUVersionAtLeast have been removed.
* use log_knownIssue() instead.
*/
#endif