Annotation of embedaddon/php/ext/intl/tests/regression_sortwsk_and_cow.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Regression: sort_wsk() and copy-on-write.
                      3: --SKIPIF--
                      4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
                      5: --FILE--
                      6: <?php
                      7: /*
                      8:  * Check if collator_sort_with_sort_keys()
                      9:  * properly supports copy-on-write.
                     10:  */
                     11: 
                     12: 
                     13: /* Create two copies of the given array.
                     14:  * Sort the array and the first copy.
                     15:  * Check if the second copy remains unsorted.
                     16:  */
                     17: function test_COW( $locale, $test_array )
                     18: {
                     19:     $res_str = '';
                     20: 
                     21:     $coll = ut_coll_create( $locale );
                     22: 
                     23:     // Create two copies of the given array.
                     24:     $copy1 = $test_array;
                     25:     $copy2 = $test_array;
                     26: 
                     27:     // Sort given array and the first copy of it.
                     28:     ut_coll_sort_with_sort_keys( $coll, $test_array );
                     29:     ut_coll_sort_with_sort_keys( $coll, $copy1      );
                     30: 
                     31:     // Return contents of all the arrays.
                     32:     // The second copy should remain unsorted.
                     33:     $res_str .= dump( $test_array ) . "\n";
                     34:     $res_str .= dump( $copy1      ) . "\n";
                     35:     $res_str .= dump( $copy2      ) . "\n";
                     36: 
                     37:     return $res_str;
                     38: }
                     39: 
                     40: function ut_main()
                     41: {
                     42:     $res_str = '';
                     43: 
                     44:     $a1 = array( 'b', 'a', 'c' );
                     45:     $a2 = array( 'в', 'а', 'б' );
                     46: 
                     47:     $res_str .= test_COW( 'en_US', $a1 );
                     48:     $res_str .= test_COW( 'ru_RU', $a2 );
                     49: 
                     50:     return $res_str;
                     51: }
                     52: 
                     53: require_once( 'ut_common.inc' );
                     54: ut_run();
                     55: ?>
                     56: --EXPECT--
                     57: array (
                     58:   0 => 'a',
                     59:   1 => 'b',
                     60:   2 => 'c',
                     61: )
                     62: array (
                     63:   0 => 'a',
                     64:   1 => 'b',
                     65:   2 => 'c',
                     66: )
                     67: array (
                     68:   0 => 'b',
                     69:   1 => 'a',
                     70:   2 => 'c',
                     71: )
                     72: array (
                     73:   0 => 'а',
                     74:   1 => 'б',
                     75:   2 => 'в',
                     76: )
                     77: array (
                     78:   0 => 'а',
                     79:   1 => 'б',
                     80:   2 => 'в',
                     81: )
                     82: array (
                     83:   0 => 'в',
                     84:   1 => 'а',
                     85:   2 => 'б',
                     86: )

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>