migrate ext_icu_collator to use inout parameters instead of references
[hiphop-php.git] / hphp / test / zend / good / ext / intl / tests / collator_sort_with_sort_keys_variant2.php
blobae18b6a52bd8a8b9ef8ddb391190508334a698ec
1 <?hh
3 /*
4 * Sort arrays using various locales.
5 */
8 ZendGoodExtIntlTestsCollatorSortWithSortKeysVariant2::$test_num = 1;
11 * Sort arrays in the given list using specified locale.
13 function sort_arrays( $locale, $arrays )
15 $res_str = '';
17 $coll = ut_coll_create( $locale );
19 foreach( $arrays as $array )
21 // Sort array values
22 $res_val = ut_coll_sort_with_sort_keys( $coll, inout $array );
24 // Concatenate the sorted array and function result
25 // with output string.
26 $res_dump = "\n" . dump( $array ) .
27 "\n Result: " . dump( $res_val );
30 // Preppend test signature to output string
31 $md5 = md5( $res_dump );
34 $res_str .= "\n\n".
35 "Test ".ZendGoodExtIntlTestsCollatorSortWithSortKeysVariant2::$test_num.".$md5:" .
36 $res_dump;
37 ++ZendGoodExtIntlTestsCollatorSortWithSortKeysVariant2::$test_num;
40 return $res_str;
44 function ut_main()
47 ZendGoodExtIntlTestsCollatorSortWithSortKeysVariant2::$test_num = 1;
48 $res_str = '';
50 // Sort an array in SORT_REGULAR mode using en_US locale.
51 $test_params = array(
52 array( 'abc', 'abd', 'aaa' ),
53 array( 'm' , '1' , '_' ),
54 array( 'a' , 'aaa', 'aa' ),
55 array( 'ba' , 'b' , 'ab' ),
56 array( 'e' , 'c' , 'a' ),
57 array( 'd' , '' , ' a' ),
58 array( 'd ' , 'f ' , ' a' ),
59 array( 'a' , null , '3' ),
60 array( 'y' , 'i' , 'k' )
63 $res_str .= sort_arrays( 'en_US', $test_params );
65 // Sort a non-ASCII array using ru_RU locale.
66 $test_params = array(
67 array( 'абг', 'абв', 'ааа', 'abc' ),
68 array( 'аа', 'ааа', 'а' )
71 $res_str .= sort_arrays( 'ru_RU', $test_params );
73 // Array with data for sorting.
74 $test_params = array(
75 array( 'y' , 'i' , 'k' )
78 // Sort an array using Lithuanian locale.
79 $res_str .= sort_arrays( 'lt_LT', $test_params );
81 return $res_str . "\n";
84 include_once( 'ut_common.inc' );
85 ut_run();
87 abstract final class ZendGoodExtIntlTestsCollatorSortWithSortKeysVariant2 {
88 public static $test_num;