Annotation of embedaddon/php/ext/intl/tests/collator_get_sort_key.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: collator_get_sort_key()
        !             3: --SKIPIF--
        !             4: <?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
        !             5: --XFAIL--
        !             6: Sort keys are not fixed, comparing them to fixed strings doesn't work.
        !             7: --FILE--
        !             8: <?php
        !             9: 
        !            10: /*
        !            11:  * Get sort keys using various locales
        !            12:  */
        !            13: function sort_arrays( $locale, $data )
        !            14: {
        !            15:     $res_str = '';
        !            16: 
        !            17:     $coll = ut_coll_create( $locale );
        !            18: 
        !            19:        foreach($data as $value) {
        !            20:                $res_val = ut_coll_get_sort_key( $coll, $value );
        !            21:                $res_str .= "source: ".urlencode($value)."\n".
        !            22:                                        "key: ".urlencode($res_val)."\n";
        !            23:        }
        !            24: 
        !            25:     return $res_str;
        !            26: }
        !            27: 
        !            28: 
        !            29: function ut_main()
        !            30: {
        !            31:     $res_str = '';
        !            32: 
        !            33:     // Regular strings keys
        !            34:     $test_params = array(
        !            35:                'abc', 'abd', 'aaa',
        !            36:                'аа', 'а', 'z',
        !            37:                '', null , '3',
        !            38:         'y'  , 'i'  , 'k'
        !            39:     );
        !            40: 
        !            41:     $res_str .= sort_arrays( 'en_US', $test_params );
        !            42: 
        !            43:     // Sort a non-ASCII array using ru_RU locale.
        !            44:     $test_params = array(
        !            45:                'абг', 'абв', 'жжж', 'эюя'
        !            46:     );
        !            47: 
        !            48:     $res_str .= sort_arrays( 'ru_RU', $test_params );
        !            49: 
        !            50:     // Sort an array using Lithuanian locale.
        !            51:     $res_str .= sort_arrays( 'lt_LT', $test_params );
        !            52: 
        !            53:     return $res_str . "\n";
        !            54: }
        !            55: 
        !            56: include_once( 'ut_common.inc' );
        !            57: ut_run();
        !            58: ?>
        !            59: --EXPECT--
        !            60: source: abc
        !            61: key: %29%2B-%01%07%01%07%00
        !            62: source: abd
        !            63: key: %29%2B%2F%01%07%01%07%00
        !            64: source: aaa
        !            65: key: %29%29%29%01%07%01%07%00
        !            66: source: %D0%B0%D0%B0
        !            67: key: _++%01%06%01%06%00
        !            68: source: %D0%B0
        !            69: key: _+%01%05%01%05%00
        !            70: source: z
        !            71: key: %5B%01%05%01%05%00
        !            72: source:
        !            73: key: %01%01%00
        !            74: source:
        !            75: key: %01%01%00
        !            76: source: 3
        !            77: key: %26%80%01%05%01%05%00
        !            78: source: y
        !            79: key: Y%01%05%01%05%00
        !            80: source: i
        !            81: key: 9%01%05%01%05%00
        !            82: source: k
        !            83: key: %3D%01%05%01%05%00
        !            84: source: %D0%B0%D0%B1%D0%B3
        !            85: key: _+%2C0%01%07%01%07%00
        !            86: source: %D0%B0%D0%B1%D0%B2
        !            87: key: _+%2C.%01%07%01%07%00
        !            88: source: %D0%B6%D0%B6%D0%B6
        !            89: key: _LLL%01%07%01%07%00
        !            90: source: %D1%8D%D1%8E%D1%8F
        !            91: key: %60%05%09%0B%01%07%01%07%00
        !            92: source: %D0%B0%D0%B1%D0%B3
        !            93: key: _+%2C0%01%07%01%07%00
        !            94: source: %D0%B0%D0%B1%D0%B2
        !            95: key: _+%2C.%01%07%01%07%00
        !            96: source: %D0%B6%D0%B6%D0%B6
        !            97: key: _LLL%01%07%01%07%00
        !            98: source: %D1%8D%D1%8E%D1%8F
        !            99: key: %60%05%09%0B%01%07%01%07%00

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