OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2007,2011,2013, International Business Machines | 3 * Copyright (c) 1997-2015, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 /*******************************************************************************
* | 6 /*******************************************************************************
* |
7 * | 7 * |
8 * File CFORMTST.C | 8 * File CFORMTST.C |
9 * | 9 * |
10 * Modification History: | 10 * Modification History: |
11 * Name Description | 11 * Name Description |
12 * Madhu Katragadda Creation | 12 * Madhu Katragadda Creation |
13 ********************************************************************************
* | 13 ********************************************************************************
* |
(...skipping 14 matching lines...) Expand all Loading... |
28 void addDateIntervalFormatTest(TestNode**); | 28 void addDateIntervalFormatTest(TestNode**); |
29 void addNumForTest(TestNode**); | 29 void addNumForTest(TestNode**); |
30 void addMsgForTest(TestNode**); | 30 void addMsgForTest(TestNode**); |
31 void addDateForRgrTest(TestNode**); | 31 void addDateForRgrTest(TestNode**); |
32 void addNumFrDepTest(TestNode**); | 32 void addNumFrDepTest(TestNode**); |
33 void addDtFrDepTest(TestNode**); | 33 void addDtFrDepTest(TestNode**); |
34 void addUtmsTest(TestNode**); | 34 void addUtmsTest(TestNode**); |
35 void addCurrencyTest(TestNode**); | 35 void addCurrencyTest(TestNode**); |
36 void addPluralRulesTest(TestNode**); | 36 void addPluralRulesTest(TestNode**); |
37 void addURegionTest(TestNode** root); | 37 void addURegionTest(TestNode** root); |
| 38 void addUListFmtTest(TestNode** root); |
38 | 39 |
39 void addFormatTest(TestNode** root); | 40 void addFormatTest(TestNode** root); |
40 | 41 |
41 void addFormatTest(TestNode** root) | 42 void addFormatTest(TestNode** root) |
42 { | 43 { |
43 addCalTest(root); | 44 addCalTest(root); |
44 addDateForTest(root); | 45 addDateForTest(root); |
45 addDateTimePatternGeneratorTest(root); | 46 addDateTimePatternGeneratorTest(root); |
46 addDateIntervalFormatTest(root); | 47 addDateIntervalFormatTest(root); |
47 addNumForTest(root); | 48 addNumForTest(root); |
48 addNumFrDepTest(root); | 49 addNumFrDepTest(root); |
49 addMsgForTest(root); | 50 addMsgForTest(root); |
50 addDateForRgrTest(root); | 51 addDateForRgrTest(root); |
51 addDtFrDepTest(root); | 52 addDtFrDepTest(root); |
52 addUtmsTest(root); | 53 addUtmsTest(root); |
53 addCurrencyTest(root); | 54 addCurrencyTest(root); |
54 addPluralRulesTest(root); | 55 addPluralRulesTest(root); |
55 addURegionTest(root); | 56 addURegionTest(root); |
| 57 addUListFmtTest(root); |
56 } | 58 } |
57 /*Internal functions used*/ | 59 /*Internal functions used*/ |
58 | 60 |
59 UChar* myDateFormat(UDateFormat* dat, UDate d1) | 61 UChar* myDateFormat(UDateFormat* dat, UDate d1) |
60 { | 62 { |
61 UChar *result1=NULL; | 63 UChar *result1=NULL; |
62 int32_t resultlength, resultlengthneeded; | 64 int32_t resultlength, resultlengthneeded; |
63 UErrorCode status = U_ZERO_ERROR; | 65 UErrorCode status = U_ZERO_ERROR; |
64 | 66 |
65 | 67 |
66 resultlength=0; | 68 resultlength=0; |
67 resultlengthneeded=udat_format(dat, d1, NULL, resultlength, NULL, &status); | 69 resultlengthneeded=udat_format(dat, d1, NULL, resultlength, NULL, &status); |
68 if(status==U_BUFFER_OVERFLOW_ERROR) | 70 if(status==U_BUFFER_OVERFLOW_ERROR) |
69 { | 71 { |
70 status=U_ZERO_ERROR; | 72 status=U_ZERO_ERROR; |
71 resultlength=resultlengthneeded+1; | 73 resultlength=resultlengthneeded+1; |
72 result1=(UChar*)ctst_malloc(sizeof(UChar) * resultlength); | 74 result1=(UChar*)ctst_malloc(sizeof(UChar) * resultlength); |
73 udat_format(dat, d1, result1, resultlength, NULL, &status); | 75 udat_format(dat, d1, result1, resultlength, NULL, &status); |
74 } | 76 } |
75 if(U_FAILURE(status)) | 77 if(U_FAILURE(status)) |
76 { | 78 { |
77 log_err("Error in formatting using udat_format(.....): %s\n", myErrorNam
e(status)); | 79 log_err("Error in formatting using udat_format(.....): %s\n", myErrorNam
e(status)); |
78 return 0; | 80 return 0; |
79 } | 81 } |
80 return result1; | 82 return result1; |
81 | 83 |
82 } | 84 } |
83 | 85 |
84 #endif /* #if !UCONFIG_NO_FORMATTING */ | 86 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |