From: Anatol Belski Date: Mon, 25 Jun 2018 09:30:14 +0000 (+0200) Subject: Prepare tests for ICU 62.1 X-Git-Tag: php-7.2.8RC1~24^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5af0db88fafe7b36d13c67bc641e0f3749e59d7d;p=php Prepare tests for ICU 62.1 --- diff --git a/ext/intl/tests/bug62070_2.phpt b/ext/intl/tests/bug62070_2.phpt index 63f510793b..c632b569cc 100644 --- a/ext/intl/tests/bug62070_2.phpt +++ b/ext/intl/tests/bug62070_2.phpt @@ -3,6 +3,7 @@ Bug #62070: Collator::getSortKey() returns garbage --SKIPIF-- = 53.1'); ?> += 0) die('skip for ICU < 62.1'); ?> --FILE-- += 62.1'); ?> +--FILE-- += 56.1 --SKIPIF-- = 56.1'); ?> += 0) die('skip for ICU < 62.1'); ?> --FILE-- = 62.1 +--SKIPIF-- + += 62.1'); ?> +--FILE-- + +--EXPECT-- +source: abc +key: 2a2c2e01070107 +source: abd +key: 2a2c3001070107 +source: aaa +key: 2a2a2a01070107 +source: аа +key: 61060601060106 +source: а +key: 610601050105 +source: z +key: 5c01050105 +source: +key: 0101 +source: +key: 0101 +source: 3 +key: 1901050105 +source: y +key: 5a01050105 +source: i +key: 3a01050105 +source: k +key: 3e01050105 +source: абг +key: 27060c1001070107 +source: абв +key: 27060c0e01070107 +source: жжж +key: 272c2c2c01070107 +source: эюя +key: 27eef0f401070107 +source: абг +key: 61060c1001070107 +source: абв +key: 61060c0e01070107 +source: жжж +key: 612c2c2c01070107 +source: эюя +key: 61eef0f401070107 diff --git a/ext/intl/tests/formatter_format7.phpt b/ext/intl/tests/formatter_format7.phpt index 088c526c70..13d58bdd51 100644 --- a/ext/intl/tests/formatter_format7.phpt +++ b/ext/intl/tests/formatter_format7.phpt @@ -1,8 +1,9 @@ --TEST-- -numfmt_format() icu >= 61.1 +numfmt_format() icu >= 61.1 && < 62.1 --SKIPIF-- = 61.1'); ?> += 0) die('skip for ICU < 62.1'); ?> --FILE-- = 62.1 +--SKIPIF-- + += 62.1'); ?> +--FILE-- + '##.#####################', + NumberFormatter::DECIMAL => '', + NumberFormatter::CURRENCY => '', + NumberFormatter::PERCENT => '', + NumberFormatter::SCIENTIFIC => '', + NumberFormatter::SPELLOUT => '@@@@@@@', + NumberFormatter::ORDINAL => '', + NumberFormatter::DURATION => '', + NumberFormatter::PATTERN_RULEBASED => '#####.###', + 1234999, // bad one + ); + + $integer = array( + NumberFormatter::ORDINAL => '', + NumberFormatter::DURATION => '', + ); + $locales = array( + 'en_US', + 'ru_UA', + 'de', + 'fr', + 'en_UK' + ); + + $str_res = ''; + $number = 1234567.891234567890000; + + foreach( $locales as $locale ) + { + $str_res .= "\nLocale is: $locale\n"; + foreach( $styles as $style => $pattern ) + { + $fmt = ut_nfmt_create( $locale, $style, $pattern ); + + if(!$fmt) { + $str_res .= "Bad formatter!\n"; + continue; + } + $str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n"; + } + } + return $str_res; +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); + +?> +--EXPECTREGEX-- +Locale is: en_US +'1234567.8912345\d+' +'1,234,567.891' +'\$1,234,567.89' +'123,456,789%' +'1.2345678912345\d+E6' +'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?' +'1,234,567(th|ᵗʰ)' +'342:56:07' +'#####.###' +'USD 1,234,567.89' + +Locale is: ru_UA +'1234567.8912345\d+' +'1 234 567,891' +'1 234 567,89 ?(грн\.|₴)' +'123 456 789 ?%' +'1.2345678912345\d+E6' +'один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь целых восемьдесят девять миллионов сто двадцать три тысячи четыреста пятьдесят семь стомиллионных' +'1 234 567.?' +'1 234 567' +'#####.###' +'1 234 567,89 UAH' + +Locale is: de +'1234567.8912345\d+' +'1.234.567,891' +'1.234.567,89 XXX' +'123\.456\.789 %' +'1.2345678912345\d+E6' +'eine Million zwei­hundert­vier­und­dreißig­tausend­fünf­hundert­sieben­und­sechzig Komma acht neun eins zwei drei vier fünf( sechs)? sieben( neun)?' +'1.234.567.?' +'1.234.567' +'#####.###' +'1.234.567,89 XXX' + +Locale is: fr +'1234567.8912345\d+' +'1 234 567,891' +'1 234 567,89 XXX' +'123 456 789 ?%' +'1.2345678912345\d+E6' +'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq( six)? sept( neuf)?' +'1 234 567e' +'1 234 567' +'#####.###' +'1 234 567,89 XXX' + +Locale is: en_UK +'1234567.8912345\d+' +'1,234,567.891' +'XXX 1,234,567.89' +'123,456,789%' +'1.2345678912345\d+E6' +'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?' +'1,234,567(th|ᵗʰ)' +'342:56:07' +'#####.###' +'XXX 1,234,567.89' diff --git a/ext/intl/tests/formatter_format_currency2.phpt b/ext/intl/tests/formatter_format_currency2.phpt index d9277f3e98..16a421018c 100644 --- a/ext/intl/tests/formatter_format_currency2.phpt +++ b/ext/intl/tests/formatter_format_currency2.phpt @@ -42,9 +42,9 @@ include_once( 'ut_common.inc' ); ut_run(); ?> ---EXPECT-- +--EXPECTF-- en_UK: '£1,234,567.89' en_US: '$1,234,567.89' ru: '1 234 567,89 р.' uk: '1 234 567,89 ₴' -en: 'UAH1,234,567.89' +en: 'UAH%A1,234,567.89' diff --git a/ext/intl/tests/formatter_get_locale_variant3.phpt b/ext/intl/tests/formatter_get_locale_variant3.phpt index 901e2353b4..8f3ea8edc7 100644 --- a/ext/intl/tests/formatter_get_locale_variant3.phpt +++ b/ext/intl/tests/formatter_get_locale_variant3.phpt @@ -3,6 +3,7 @@ numfmt_get_locale() --SKIPIF-- = 58.1'); ?> += 0) die('skip for ICU < 62.1'); ?> --FILE-- += 62.1'); ?> +--FILE-- + 'actual', + Locale::VALID_LOCALE => 'valid', + ); + + $res_str = ''; + + foreach( $locales as $locale ) + { + $fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL ); + $res_str .= "$locale: "; + foreach( $loc_types as $loc_type => $loc_type_name ) + $res_str .= sprintf( " %s=%s", + $loc_type_name, + dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) ); + $res_str .= "\n"; + } + + return $res_str; +} + +include_once( 'ut_common.inc' ); + +// Run the test +ut_run(); +?> +--EXPECT-- +en_UK: actual='en' valid='en' +en_US: actual='en_US' valid='en_US' +fr_CA: actual='fr_CA' valid='fr_CA' diff --git a/ext/intl/tests/formatter_get_set_pattern.phpt b/ext/intl/tests/formatter_get_set_pattern.phpt index 0ae5b308b2..7f33254e2c 100644 --- a/ext/intl/tests/formatter_get_set_pattern.phpt +++ b/ext/intl/tests/formatter_get_set_pattern.phpt @@ -2,6 +2,7 @@ numfmt_get/set_pattern() --SKIPIF-- += 0) die('skip for ICU < 62.1'); ?> --FILE-- += 62.1'); ?> +--FILE-- + +--EXPECT-- +Default pattern: '#' +Formatting result: 12345.123456 +New pattern: '0.0' +Formatted number: 12345.1 +New pattern: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@' +Formatted number: 12345.123456000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/ext/intl/tests/formatter_get_set_symbol2.phpt b/ext/intl/tests/formatter_get_set_symbol2.phpt index 3f982cd063..8e762f350f 100644 --- a/ext/intl/tests/formatter_get_set_symbol2.phpt +++ b/ext/intl/tests/formatter_get_set_symbol2.phpt @@ -88,7 +88,7 @@ include_once( 'ut_common.inc' ); ut_run(); ?> ---EXPECT-- +--EXPECTF-- Symbol 'DECIMAL_SEPARATOR_SYMBOL' Default symbol: [.] New symbol: [_._] @@ -132,7 +132,7 @@ A number formatted with the new symbol: 1.2345123456E4 Symbol 'CURRENCY_SYMBOL' Default symbol: [$] New symbol: [_$_] -A number formatted with the new symbol: _$_12,345.12 +A number formatted with the new symbol: _$_%A12,345.12 Symbol 'INTL_CURRENCY_SYMBOL' Default symbol: [USD]