]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/cintltst/cformtst.c
1 /********************************************************************
3 * Copyright (c) 1997-2016, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************/
6 /********************************************************************************
10 * Modification History:
12 * Madhu Katragadda Creation
13 *********************************************************************************
16 /* FormatTest is a medium top level test for everything in the C FORMAT API */
18 #include "unicode/utypes.h"
20 #if !UCONFIG_NO_FORMATTING
25 void addCalTest(TestNode
**);
26 void addDateForTest(TestNode
**);
27 void addDateTimePatternGeneratorTest(TestNode
**);
28 void addDateIntervalFormatTest(TestNode
**);
29 void addRelativeDateFormatTest(TestNode
**);
30 void addNumForTest(TestNode
**);
31 void addMsgForTest(TestNode
**);
32 void addDateForRgrTest(TestNode
**);
33 void addNumFrDepTest(TestNode
**);
34 void addDtFrDepTest(TestNode
**);
35 void addUtmsTest(TestNode
**);
36 void addCurrencyTest(TestNode
**);
37 void addPluralRulesTest(TestNode
**);
38 void addURegionTest(TestNode
** root
);
39 void addUListFmtTest(TestNode
** root
);
40 void addMeasureFormatTest(TestNode
** root
);
42 void addFormatTest(TestNode
** root
);
44 void addFormatTest(TestNode
** root
)
48 addDateTimePatternGeneratorTest(root
);
49 addDateIntervalFormatTest(root
);
50 #if !UCONFIG_NO_BREAK_ITERATION
51 addRelativeDateFormatTest(root
);
52 #endif /* !UCONFIG_NO_BREAK_ITERATION */
54 addNumFrDepTest(root
);
56 addDateForRgrTest(root
);
59 addCurrencyTest(root
);
60 addPluralRulesTest(root
);
62 addUListFmtTest(root
);
63 addMeasureFormatTest(root
);
65 /*Internal functions used*/
67 UChar
* myDateFormat(UDateFormat
* dat
, UDate d1
)
70 int32_t resultlength
, resultlengthneeded
;
71 UErrorCode status
= U_ZERO_ERROR
;
75 resultlengthneeded
=udat_format(dat
, d1
, NULL
, resultlength
, NULL
, &status
);
76 if(status
==U_BUFFER_OVERFLOW_ERROR
)
79 resultlength
=resultlengthneeded
+1;
80 result1
=(UChar
*)ctst_malloc(sizeof(UChar
) * resultlength
);
81 udat_format(dat
, d1
, result1
, resultlength
, NULL
, &status
);
85 log_err("Error in formatting using udat_format(.....): %s\n", myErrorName(status
));
92 #endif /* #if !UCONFIG_NO_FORMATTING */