]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/cintltst/cformtst.c
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************/
8 /********************************************************************************
12 * Modification History:
14 * Madhu Katragadda Creation
15 *********************************************************************************
18 /* FormatTest is a medium top level test for everything in the C FORMAT API */
20 #include "unicode/utypes.h"
22 #if !UCONFIG_NO_FORMATTING
27 void addCalTest(TestNode
**);
28 void addDateForTest(TestNode
**);
29 void addDateTimePatternGeneratorTest(TestNode
**);
30 void addDateIntervalFormatTest(TestNode
**);
31 void addRelativeDateFormatTest(TestNode
**);
32 void addNumForTest(TestNode
**);
33 void addMsgForTest(TestNode
**);
34 void addDateForRgrTest(TestNode
**);
35 void addNumFrDepTest(TestNode
**);
36 void addDtFrDepTest(TestNode
**);
37 void addUtmsTest(TestNode
**);
38 void addCurrencyTest(TestNode
**);
39 void addPluralRulesTest(TestNode
**);
40 void addURegionTest(TestNode
** root
);
41 void addUListFmtTest(TestNode
** root
);
42 void addUNumberFormatterTest(TestNode
** root
);
43 void addUFormattedValueTest(TestNode
** root
);
44 void addMeasureFormatTest(TestNode
** root
);
46 void addFormatTest(TestNode
** root
);
48 void addFormatTest(TestNode
** root
)
52 addDateTimePatternGeneratorTest(root
);
53 addDateIntervalFormatTest(root
);
54 #if !UCONFIG_NO_BREAK_ITERATION
55 addRelativeDateFormatTest(root
);
56 #endif /* !UCONFIG_NO_BREAK_ITERATION */
58 addNumFrDepTest(root
);
60 addDateForRgrTest(root
);
63 addCurrencyTest(root
);
64 addPluralRulesTest(root
);
66 addUListFmtTest(root
);
67 addUNumberFormatterTest(root
);
68 addUFormattedValueTest(root
);
69 addMeasureFormatTest(root
);
71 /*Internal functions used*/
73 UChar
* myDateFormat(UDateFormat
* dat
, UDate d1
)
76 int32_t resultlength
, resultlengthneeded
;
77 UErrorCode status
= U_ZERO_ERROR
;
81 resultlengthneeded
=udat_format(dat
, d1
, NULL
, resultlength
, NULL
, &status
);
82 if(status
==U_BUFFER_OVERFLOW_ERROR
)
85 resultlength
=resultlengthneeded
+1;
86 result1
=(UChar
*)ctst_malloc(sizeof(UChar
) * resultlength
);
87 udat_format(dat
, d1
, result1
, resultlength
, NULL
, &status
);
91 log_err("Error in formatting using udat_format(.....): %s\n", myErrorName(status
));
98 #endif /* #if !UCONFIG_NO_FORMATTING */