OLD | NEW |
1 /******************************************************************** | 1 /******************************************************************** |
2 * COPYRIGHT: | 2 * COPYRIGHT: |
3 * Copyright (c) 1997-2013, International Business Machines Corporation | 3 * Copyright (c) 1997-2014, International Business Machines Corporation |
4 * and others. All Rights Reserved. | 4 * and others. All Rights Reserved. |
5 ********************************************************************/ | 5 ********************************************************************/ |
6 | 6 |
7 #include "unicode/utypes.h" | 7 #include "unicode/utypes.h" |
8 | 8 |
9 #if !UCONFIG_NO_FORMATTING | 9 #if !UCONFIG_NO_FORMATTING |
10 | 10 |
11 #include "calregts.h" | 11 #include "calregts.h" |
12 | 12 |
13 #include "unicode/gregocal.h" | 13 #include "unicode/gregocal.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 printdate(cal2, "cal2 should be unmodified:") ; | 195 printdate(cal2, "cal2 should be unmodified:") ; |
196 delete cal1; | 196 delete cal1; |
197 delete cal2; | 197 delete cal2; |
198 } | 198 } |
199 | 199 |
200 | 200 |
201 void | 201 void |
202 CalendarRegressionTest::Test9019() | 202 CalendarRegressionTest::Test9019() |
203 { | 203 { |
204 UErrorCode status = U_ZERO_ERROR; | 204 UErrorCode status = U_ZERO_ERROR; |
205 LocalPointer<GregorianCalendar> cal1(new GregorianCalendar(status)); | 205 LocalPointer<GregorianCalendar> cal1(new GregorianCalendar(status), status); |
206 LocalPointer<GregorianCalendar> cal2(new GregorianCalendar(status)); | 206 LocalPointer<GregorianCalendar> cal2(new GregorianCalendar(status), status); |
| 207 if(U_FAILURE(status)) { |
| 208 dataerrln("Error creating Calendar: %s", u_errorName(status)); |
| 209 return; |
| 210 } |
207 cal1->set(UCAL_HOUR, 1); | 211 cal1->set(UCAL_HOUR, 1); |
208 cal2->set(UCAL_HOUR,2); | 212 cal2->set(UCAL_HOUR,2); |
209 cal1->clear(); | 213 cal1->clear(); |
210 cal2->clear(); | 214 cal2->clear(); |
211 if(U_FAILURE(status)) { | |
212 dataerrln("Error creating Calendar: %s", u_errorName(status)); | |
213 return; | |
214 } | |
215 failure(status, "new GregorianCalendar"); | 215 failure(status, "new GregorianCalendar"); |
216 cal1->set(2011,UCAL_MAY,06); | 216 cal1->set(2011,UCAL_MAY,06); |
217 cal2->set(2012,UCAL_JANUARY,06); | 217 cal2->set(2012,UCAL_JANUARY,06); |
218 printdate(cal1.getAlias(), "cal1: ") ; | 218 printdate(cal1.getAlias(), "cal1: ") ; |
219 cal1->setLenient(FALSE); | 219 cal1->setLenient(FALSE); |
220 cal1->add(UCAL_MONTH,8,status); | 220 cal1->add(UCAL_MONTH,8,status); |
221 failure(status, "->add(UCAL_MONTH,8)"); | 221 failure(status, "->add(UCAL_MONTH,8)"); |
222 printdate(cal1.getAlias(), "cal1 (lenient) after adding 8 months:") ; | 222 printdate(cal1.getAlias(), "cal1 (lenient) after adding 8 months:") ; |
223 printdate(cal2.getAlias(), "cal2 (expected date):") ; | 223 printdate(cal2.getAlias(), "cal2 (expected date):") ; |
224 | 224 |
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 d = cal.getTime(status); | 2938 d = cal.getTime(status); |
2939 failure(status, "getTime after -1 day"); | 2939 failure(status, "getTime after -1 day"); |
2940 dstr.remove(); | 2940 dstr.remove(); |
2941 sdf.format(d, dstr); | 2941 sdf.format(d, dstr); |
2942 logln(UnicodeString("-1 day: ") + dstr); | 2942 logln(UnicodeString("-1 day: ") + dstr); |
2943 assertEquals("Subtract 1 day", UnicodeString("2011-12-29T00:00:00-10:00"
), dstr); | 2943 assertEquals("Subtract 1 day", UnicodeString("2011-12-29T00:00:00-10:00"
), dstr); |
2944 } | 2944 } |
2945 } | 2945 } |
2946 | 2946 |
2947 #endif /* #if !UCONFIG_NO_FORMATTING */ | 2947 #endif /* #if !UCONFIG_NO_FORMATTING */ |
OLD | NEW |