]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/cintltst/cformtst.c
1 /********************************************************************
3 * Copyright (c) 1997-2007,2011,2013, 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 addNumForTest(TestNode
**);
30 void addMsgForTest(TestNode
**);
31 void addDateForRgrTest(TestNode
**);
32 void addNumFrDepTest(TestNode
**);
33 void addDtFrDepTest(TestNode
**);
34 void addUtmsTest(TestNode
**);
35 void addCurrencyTest(TestNode
**);
36 void addPluralRulesTest(TestNode
**);
37 void addURegionTest(TestNode
** root
);
39 void addFormatTest(TestNode
** root
);
41 void addFormatTest(TestNode
** root
)
45 addDateTimePatternGeneratorTest(root
);
46 addDateIntervalFormatTest(root
);
48 addNumFrDepTest(root
);
50 addDateForRgrTest(root
);
53 addCurrencyTest(root
);
54 addPluralRulesTest(root
);
57 /*Internal functions used*/
59 UChar
* myDateFormat(UDateFormat
* dat
, UDate d1
)
62 int32_t resultlength
, resultlengthneeded
;
63 UErrorCode status
= U_ZERO_ERROR
;
67 resultlengthneeded
=udat_format(dat
, d1
, NULL
, resultlength
, NULL
, &status
);
68 if(status
==U_BUFFER_OVERFLOW_ERROR
)
71 resultlength
=resultlengthneeded
+1;
72 result1
=(UChar
*)ctst_malloc(sizeof(UChar
) * resultlength
);
73 udat_format(dat
, d1
, result1
, resultlength
, NULL
, &status
);
77 log_err("Error in formatting using udat_format(.....): %s\n", myErrorName(status
));
84 #endif /* #if !UCONFIG_NO_FORMATTING */