]> projects.mako.cc - scuttle/blob - includes/utf8/tests/cases/utf8_strlen.test.php
- Override privacy status on bookmark file import, if specified (i.e. Delicious)
[scuttle] / includes / utf8 / tests / cases / utf8_strlen.test.php
1 <?php
2 /**
3 * @version $Id: utf8_strlen.test.php,v 1.2 2006/02/24 23:33:10 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
16 //--------------------------------------------------------------------
17 /**
18 * @package utf8
19 * @subpackage Tests
20 */
21 class test_utf8_strlen extends UnitTestCase {
22
23     function test_utf8_strlen() {
24         $this->UnitTestCase('utf8_strlen()');
25     }
26     
27     function testUtf8() {
28         $str = 'Iñtërnâtiônàlizætiøn';
29         $this->assertEqual(utf8_strlen($str),20);
30     }
31     
32     function testUtf8Invalid() {
33         $str = "Iñtërnâtiôn\xe9àlizætiøn";
34         $this->assertEqual(utf8_strlen($str),20);
35     }
36     
37     function testAscii() {
38         $str = 'ABC 123';
39         $this->assertEqual(utf8_strlen($str),7);
40     }
41     
42     function testEmptyStr() {
43         $str = '';
44         $this->assertEqual(utf8_strlen($str),0);
45     }
46     
47     
48 }
49
50 //--------------------------------------------------------------------
51 /**
52 * @package utf8
53 * @subpackage Tests
54 */
55 if (!defined('TEST_RUNNING')) {
56     define('TEST_RUNNING', true);
57     $test = &new test_utf8_strlen();
58     $reporter = & getTestReporter();
59     $test->run($reporter);
60 }

Benjamin Mako Hill || Want to submit a patch?