]> projects.mako.cc - scuttle/blob - includes/utf8/tests/cases/utf8_strspn.test.php
- Override privacy status on bookmark file import, if specified (i.e. Delicious)
[scuttle] / includes / utf8 / tests / cases / utf8_strspn.test.php
1 <?php
2 /**
3 * @version $Id: utf8_strspn.test.php,v 1.2 2006/02/25 14:52:18 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 . '/strspn.php';
16
17 //--------------------------------------------------------------------
18 /**
19 * @package utf8
20 * @subpackage Tests
21 */
22 class test_utf8_strspn extends UnitTestCase {
23
24     function test_utf8_strspn () {
25         $this->UnitTestCase('test_utf8_strspn()');
26     }
27     
28     function testMatch() {
29         $str = 'iñtërnâtiônàlizætiøn';
30         $this->assertEqual(utf8_strspn($str,'âëiônñrt'),11);
31     }
32     
33     function testMatchTwo() {
34         $str = 'iñtërnâtiônàlizætiøn';
35         $this->assertEqual(utf8_strspn($str,'iñtë'),4);
36     }
37     
38     function testCompareStrspn() {
39         $str = 'aeioustr';
40         $this->assertEqual(utf8_strspn($str,'saeiou'),strspn($str,'saeiou'));
41     }
42     
43     function testMatchAscii() {
44         $str = 'internationalization';
45         $this->assertEqual(utf8_strspn($str,'aeionrt'),strspn($str,'aeionrt'));
46     }
47     
48     function testLinefeed() {
49         $str = "iñtërnât\niônàlizætiøn";
50         $this->assertEqual(utf8_strspn($str,'âëiônñrt'),8);
51     }
52     
53     function testLinefeedMask() {
54         $str = "iñtërnât\niônàlizætiøn";
55         $this->assertEqual(utf8_strspn($str,"âëiônñrt\n"),12);
56     }
57     
58 }
59
60 //--------------------------------------------------------------------
61 /**
62 * @package utf8
63 * @subpackage Tests
64 */
65 if (!defined('TEST_RUNNING')) {
66     define('TEST_RUNNING', true);
67     $test = &new test_utf8_strspn ();
68     $reporter = & getTestReporter();
69     $test->run($reporter);
70 }

Benjamin Mako Hill || Want to submit a patch?