| OLD | NEW |
| 1 | 1 |
| 2 /*********************************************************************** | 2 /*********************************************************************** |
| 3 * COPYRIGHT: | 3 * COPYRIGHT: |
| 4 * Copyright (c) 1997-2012, International Business Machines Corporation | 4 * Copyright (c) 1997-2014, International Business Machines Corporation |
| 5 * and others. All Rights Reserved. | 5 * and others. All Rights Reserved. |
| 6 ***********************************************************************/ | 6 ***********************************************************************/ |
| 7 | 7 |
| 8 #include "unicode/utypes.h" | 8 #include "unicode/utypes.h" |
| 9 | 9 |
| 10 #if !UCONFIG_NO_FORMATTING | 10 #if !UCONFIG_NO_FORMATTING |
| 11 | 11 |
| 12 #include "intltest.h" | 12 #include "intltest.h" |
| 13 #include "tfsmalls.h" | 13 #include "tfsmalls.h" |
| 14 #include "cmemory.h" |
| 14 | 15 |
| 15 #include "unicode/msgfmt.h" | 16 #include "unicode/msgfmt.h" |
| 16 #include "unicode/choicfmt.h" | 17 #include "unicode/choicfmt.h" |
| 17 | 18 |
| 18 #include "unicode/parsepos.h" | 19 #include "unicode/parsepos.h" |
| 19 #include "unicode/fieldpos.h" | 20 #include "unicode/fieldpos.h" |
| 20 #include "unicode/fmtable.h" | 21 #include "unicode/fmtable.h" |
| 21 | 22 |
| 22 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) | |
| 23 | |
| 24 /*static UBool chkstatus( UErrorCode &status, char* msg = NULL ) | 23 /*static UBool chkstatus( UErrorCode &status, char* msg = NULL ) |
| 25 { | 24 { |
| 26 UBool ok = (status == U_ZERO_ERROR); | 25 UBool ok = (status == U_ZERO_ERROR); |
| 27 if (!ok) it_errln( msg ); | 26 if (!ok) it_errln( msg ); |
| 28 return ok; | 27 return ok; |
| 29 }*/ | 28 }*/ |
| 30 | 29 |
| 31 void test_ParsePosition( void ) | 30 void test_ParsePosition( void ) |
| 32 { | 31 { |
| 33 ParsePosition* pp1 = new ParsePosition(); | 32 ParsePosition* pp1 = new ParsePosition(); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 UnicodeString* ucs_ptr = new UnicodeString("pointed-to-unicode-string"); | 247 UnicodeString* ucs_ptr = new UnicodeString("pointed-to-unicode-string"); |
| 249 | 248 |
| 250 const Formattable ftarray[] = | 249 const Formattable ftarray[] = |
| 251 { | 250 { |
| 252 Formattable( 1.0, Formattable::kIsDate ), | 251 Formattable( 1.0, Formattable::kIsDate ), |
| 253 2.0, | 252 2.0, |
| 254 (int32_t)3, | 253 (int32_t)3, |
| 255 ucs, | 254 ucs, |
| 256 ucs_ptr | 255 ucs_ptr |
| 257 }; | 256 }; |
| 258 const int32_t ft_cnt = LENGTHOF(ftarray); | 257 const int32_t ft_cnt = UPRV_LENGTHOF(ftarray); |
| 259 Formattable ft_arr( ftarray, ft_cnt ); | 258 Formattable ft_arr( ftarray, ft_cnt ); |
| 260 UnicodeString temp; | 259 UnicodeString temp; |
| 261 if ((ft_arr[0].getType() == Formattable::kDate) && (ft_arr[0].getDate()
== 1.0) | 260 if ((ft_arr[0].getType() == Formattable::kDate) && (ft_arr[0].getDate()
== 1.0) |
| 262 && (ft_arr[1].getType() == Formattable::kDouble) && (ft_arr[1].getDouble()
== 2.0) | 261 && (ft_arr[1].getType() == Formattable::kDouble) && (ft_arr[1].getDouble()
== 2.0) |
| 263 && (ft_arr[2].getType() == Formattable::kLong) && (ft_arr[2].getLong()
== (int32_t)3) | 262 && (ft_arr[2].getType() == Formattable::kLong) && (ft_arr[2].getLong()
== (int32_t)3) |
| 264 && (ft_arr[3].getType() == Formattable::kString) && (ft_arr[3].getString(te
mp) == ucs) | 263 && (ft_arr[3].getType() == Formattable::kString) && (ft_arr[3].getString(te
mp) == ucs) |
| 265 && (ft_arr[4].getType() == Formattable::kString) && (ft_arr[4].getString(te
mp) == *ucs_ptr) ) { | 264 && (ft_arr[4].getType() == Formattable::kString) && (ft_arr[4].getString(te
mp) == *ucs_ptr) ) { |
| 266 it_logln("FT constr. for date, double, long, ustring, ustring* and array
tested"); | 265 it_logln("FT constr. for date, double, long, ustring, ustring* and array
tested"); |
| 267 }else{ | 266 }else{ |
| 268 it_errln("*** FT constr. for date, double, long, ustring, ustring* or ar
ray"); | 267 it_errln("*** FT constr. for date, double, long, ustring, ustring* or ar
ray"); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 break; | 377 break; |
| 379 case 3: name = "ft"; | 378 case 3: name = "ft"; |
| 380 if (exec) logln("TestSuite Format/SmallClasses/Formattable (f/ch
c/sma/ft): "); | 379 if (exec) logln("TestSuite Format/SmallClasses/Formattable (f/ch
c/sma/ft): "); |
| 381 if (exec) test_Formattable(); | 380 if (exec) test_Formattable(); |
| 382 break; | 381 break; |
| 383 default: name = ""; break; //needed to end loop | 382 default: name = ""; break; //needed to end loop |
| 384 } | 383 } |
| 385 } | 384 } |
| 386 | 385 |
| 387 #endif /* #if !UCONFIG_NO_FORMATTING */ | 386 #endif /* #if !UCONFIG_NO_FORMATTING */ |
| OLD | NEW |