]> projects.mako.cc - scuttle/blob - includes/utf8/tests/cases/utf8_ord.test.php
remove duplicate shared-tag in xml - the android apps dont like this
[scuttle] / includes / utf8 / tests / cases / utf8_ord.test.php
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 */
14 require_once(dirname(__FILE__).'/../config.php');
15 require_once UTF8 . '/ord.php';
16
17 //--------------------------------------------------------------------
18 /**
19 * @package utf8
20 * @subpackage Tests
21 */
22 class 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 */
60 if (!defined('TEST_RUNNING')) {
61     define('TEST_RUNNING', true);
62     $test = &new test_utf8_ord();
63     $reporter = & getTestReporter();
64     $test->run($reporter);
65 }

Benjamin Mako Hill || Want to submit a patch?