scuttle-fork /includes/utf8/tests/cases/utf8_ord.test.php

Language PHP Lines 66
MD5 Hash 65f7394cf2ba993dce1d8d1f5a721e48 Estimated Cost $752 (why?)
Repository https://bitbucket.org/fieldsofview/scuttle-fork.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* @version $Id: utf8_ord.test.php,v 1.1 2006/03/26 22:26:16 harryf Exp $
* @package utf8
* @subpackage Tests
*/

//--------------------------------------------------------------------
/**
* Includes
* @package utf8
* @subpackage Tests
*/
require_once(dirname(__FILE__).'/../config.php');
require_once UTF8 . '/ord.php';

//--------------------------------------------------------------------
/**
* @package utf8
* @subpackage Tests
*/
class test_utf8_ord extends UnitTestCase {

    function test_utf8_ord() {
        $this->UnitTestCase('utf8_ord()');
    }
    
    function testEmptyStr() {
        $str = '';
        $this->assertEqual(utf8_ord($str),0);
    }
    
    function testAsciiChar() {
        $str = 'a';
        $this->assertEqual(utf8_ord($str),97);
    }
    
    function test2ByteChar() {
        $str = 'ñ';
        $this->assertEqual(utf8_ord($str),241);
    }
    
    function test3ByteChar() {
        $str = '₧';
        $this->assertEqual(utf8_ord($str),8359);
    }
    
    function test4ByteChar() {
        $str = "\xf0\x90\x8c\xbc";
        $this->assertEqual(utf8_ord($str),66364);
    }
    
}

//--------------------------------------------------------------------
/**
* @package utf8
* @subpackage Tests
*/
if (!defined('TEST_RUNNING')) {
    define('TEST_RUNNING', true);
    $test = &new test_utf8_ord();
    $reporter = & getTestReporter();
    $test->run($reporter);
}
Back to Top