Esempio n. 1
0
function sort_using_locale($locale, $test_array)
{
    $coll = ut_coll_create($locale);
    // Sort array.
    ut_coll_sort($coll, $test_array);
    // And return the sorted array.
    return dump($test_array) . "\n";
}
Esempio n. 2
0
function test_COW($locale, $test_array)
{
    $res_str = '';
    $coll = ut_coll_create($locale);
    // Create two copies of the given array.
    $copy1 = $test_array;
    $copy2 = $test_array;
    // Sort given array and the first copy of it.
    ut_coll_sort($coll, $test_array);
    ut_coll_sort($coll, $copy1);
    // Return contents of all the arrays.
    // The second copy should remain unsorted.
    $res_str .= dump($test_array) . "\n";
    $res_str .= dump($copy1) . "\n";
    $res_str .= dump($copy2) . "\n";
    return $res_str;
}
Esempio n. 3
0
function sort_arrays($locale, $arrays, $sort_flag = Collator::SORT_REGULAR)
{
    $res_str = '';
    $coll = ut_coll_create($locale);
    foreach ($arrays as $array) {
        // Sort array values
        $res_val = ut_coll_sort($coll, $array, $sort_flag);
        // Concatenate the sorted array and function result
        // with output string.
        $res_dump = "\n" . dump($array) . "\n Result: " . dump($res_val);
        // Preppend test signature to output string
        $md5 = md5($res_dump);
        global $test_num;
        $res_str .= "\n\n" . "Test {$test_num}.{$md5}:" . $res_dump;
        ++$test_num;
    }
    return $res_str;
}