~ubuntu-branches/ubuntu/lucid/php5/lucid

« back to all changes in this revision

Viewing changes to ext/intl/tests/collator_get_sort_key.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-03-16 09:09:50 UTC
  • mfrom: (1.1.18 upstream) (0.3.10 sid)
  • Revision ID: james.westby@ubuntu.com-20100316090950-e36m0pzranoixifd
Tags: 5.3.2-1ubuntu1
* Merge from debian unstable: 
  - debian/control:
    * Dropped firebird2.1-dev, libc-client-dev, libmcrypt-dev as it is in universe.
    * Dropped libmysqlclient15-dev, build against mysql 5.1.
    * Dropped libcurl-dev not in the archive.
    * Suggest php5-suhosin rather than recommends.
    * Dropped php5-imap, php5-interbase, php5-mcrypt since we have versions already in
      universe.
    * Dropped libonig-dev and libqgdbm since its in universe. (will be re-added in lucid+1)
    * Dropped locales-all.
  - modulelist: Drop imap, interbase, and mcrypt.
  - debian/rules:
    * Dropped building of mcrypt, imap, and interbase.
    * Install apport hook for php5.
  - Dropped debian/patches/libedit_is_editline.patch.

Show diffs side-by-side

added added

removed removed

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