PageRenderTime 30ms CodeModel.GetById 24ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/includes/utf8/tests/cases/utf8_ord.test.php

https://bitbucket.org/fieldsofview/scuttle-fork
PHP | 65 lines | 34 code | 10 blank | 21 comment | 1 complexity | 65f7394cf2ba993dce1d8d1f5a721e48 MD5 | raw file
 1<?php
 2/**
 3* @version $Id: utf8_ord.test.php,v 1.1 2006/03/26 22:26:16 harryf Exp $
 4* @package utf8
 5* @subpackage Tests
 6*/
 7
 8//--------------------------------------------------------------------
 9/**
10* Includes
11* @package utf8
12* @subpackage Tests
13*/
14require_once(dirname(__FILE__).'/../config.php');
15require_once UTF8 . '/ord.php';
16
17//--------------------------------------------------------------------
18/**
19* @package utf8
20* @subpackage Tests
21*/
22class test_utf8_ord extends UnitTestCase {
23
24    function test_utf8_ord() {
25        $this->UnitTestCase('utf8_ord()');
26    }
27    
28    function testEmptyStr() {
29        $str = '';
30        $this->assertEqual(utf8_ord($str),0);
31    }
32    
33    function testAsciiChar() {
34        $str = 'a';
35        $this->assertEqual(utf8_ord($str),97);
36    }
37    
38    function test2ByteChar() {
39        $str = 'ñ';
40        $this->assertEqual(utf8_ord($str),241);
41    }
42    
43    function test3ByteChar() {
44        $str = '₧';
45        $this->assertEqual(utf8_ord($str),8359);
46    }
47    
48    function test4ByteChar() {
49        $str = "\xf0\x90\x8c\xbc";
50        $this->assertEqual(utf8_ord($str),66364);
51    }
52    
53}
54
55//--------------------------------------------------------------------
56/**
57* @package utf8
58* @subpackage Tests
59*/
60if (!defined('TEST_RUNNING')) {
61    define('TEST_RUNNING', true);
62    $test = &new test_utf8_ord();
63    $reporter = & getTestReporter();
64    $test->run($reporter);
65}