Annotation of embedaddon/php/ext/intl/tests/formatter_format4.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: numfmt_format() icu >= 53.1
! 3: --SKIPIF--
! 4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
! 5: <?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
! 6: --FILE--
! 7: <?php
! 8:
! 9: /*
! 10: * Format a number using misc locales/patterns.
! 11: */
! 12:
! 13: /*
! 14: * TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
! 15: * currency and percent formatting.
! 16: */
! 17:
! 18: function ut_main()
! 19: {
! 20: $styles = array(
! 21: NumberFormatter::PATTERN_DECIMAL => '##.#####################',
! 22: NumberFormatter::DECIMAL => '',
! 23: NumberFormatter::CURRENCY => '',
! 24: NumberFormatter::PERCENT => '',
! 25: NumberFormatter::SCIENTIFIC => '',
! 26: NumberFormatter::SPELLOUT => '@@@@@@@',
! 27: NumberFormatter::ORDINAL => '',
! 28: NumberFormatter::DURATION => '',
! 29: NumberFormatter::PATTERN_RULEBASED => '#####.###',
! 30: 1234999, // bad one
! 31: );
! 32:
! 33: $integer = array(
! 34: NumberFormatter::ORDINAL => '',
! 35: NumberFormatter::DURATION => '',
! 36: );
! 37: $locales = array(
! 38: 'en_US',
! 39: 'ru_UA',
! 40: 'de',
! 41: 'fr',
! 42: 'en_UK'
! 43: );
! 44:
! 45: $str_res = '';
! 46: $number = 1234567.891234567890000;
! 47:
! 48: foreach( $locales as $locale )
! 49: {
! 50: $str_res .= "\nLocale is: $locale\n";
! 51: foreach( $styles as $style => $pattern )
! 52: {
! 53: $fmt = ut_nfmt_create( $locale, $style, $pattern );
! 54:
! 55: if(!$fmt) {
! 56: $str_res .= "Bad formatter!\n";
! 57: continue;
! 58: }
! 59: $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
! 60: }
! 61: }
! 62: return $str_res;
! 63: }
! 64:
! 65: include_once( 'ut_common.inc' );
! 66:
! 67: // Run the test
! 68: ut_run();
! 69:
! 70: ?>
! 71: --EXPECTREGEX--
! 72: Locale is: en_US
! 73: '1234567.89123457'
! 74: '1,234,567.891'
! 75: '\$1,234,567.89'
! 76: '123,456,789%'
! 77: '1.23456789123457E6'
! 78: 'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
! 79: '1,234,567(th|ᵗʰ)'
! 80: '342:56:07'
! 81: '#####.###'
! 82: 'USD1,234,567.89'
! 83:
! 84: Locale is: ru_UA
! 85: '1234567,89123457'
! 86: '1 234 567,891'
! 87: '1 234 567,89 ?(грн\.|₴)'
! 88: '123 456 789 ?%'
! 89: '1,23456789123457E6'
! 90: 'один миллион двести тридцать четыре тысяч пятьсот шестьдесят семь запятая восемь девять один два три четыре пять семь'
! 91: '1 234 567.?'
! 92: '1 234 567'
! 93: '#####.###'
! 94: '1 234 567,89 UAH'
! 95:
! 96: Locale is: de
! 97: '1234567,89123457'
! 98: '1.234.567,891'
! 99: '(¤ )?1.234.567,89( ¤)?'
! 100: '123\.456\.789 %'
! 101: '1,23456789123457E6'
! 102: 'eine Million zweihundertvierunddreißigtausendfünfhundertsiebenundsechzig Komma acht neun eins zwei drei vier fünf sieben'
! 103: '1.234.567.?'
! 104: '1.234.567'
! 105: '#####.###'
! 106: '1.234.567,89 ¤¤'
! 107:
! 108: Locale is: fr
! 109: '1234567,89123457'
! 110: '1 234 567,891'
! 111: '1 234 567,89 ¤'
! 112: '123 456 789 ?%'
! 113: '1,23456789123457E6'
! 114: 'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq sept'
! 115: '1 234 567e'
! 116: '1 234 567'
! 117: '#####.###'
! 118: '1 234 567,89 ¤¤'
! 119:
! 120: Locale is: en_UK
! 121: '1234567.89123457'
! 122: '1,234,567.891'
! 123: '¤1,234,567.89'
! 124: '123,456,789%'
! 125: '1.23456789123457E6'
! 126: 'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five seven'
! 127: '1,234,567(th|ᵗʰ)'
! 128: '342:56:07'
! 129: '#####.###'
! 130: '¤¤1,234,567.89'
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>