3 * @version $Id: utf8_strspn.test.php,v 1.2 2006/02/25 14:52:18 harryf Exp $
8 //--------------------------------------------------------------------
14 require_once(dirname(__FILE__).'/../config.php');
15 require_once UTF8 . '/strspn.php';
17 //--------------------------------------------------------------------
22 class test_utf8_strspn extends UnitTestCase {
24 function test_utf8_strspn () {
25 $this->UnitTestCase('test_utf8_strspn()');
28 function testMatch() {
29 $str = 'iñtërnâtiônàlizætiøn';
30 $this->assertEqual(utf8_strspn($str,'âëiônñrt'),11);
33 function testMatchTwo() {
34 $str = 'iñtërnâtiônàlizætiøn';
35 $this->assertEqual(utf8_strspn($str,'iñtë'),4);
38 function testCompareStrspn() {
40 $this->assertEqual(utf8_strspn($str,'saeiou'),strspn($str,'saeiou'));
43 function testMatchAscii() {
44 $str = 'internationalization';
45 $this->assertEqual(utf8_strspn($str,'aeionrt'),strspn($str,'aeionrt'));
48 function testLinefeed() {
49 $str = "iñtërnât\niônàlizætiøn";
50 $this->assertEqual(utf8_strspn($str,'âëiônñrt'),8);
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);
60 //--------------------------------------------------------------------
65 if (!defined('TEST_RUNNING')) {
66 define('TEST_RUNNING', true);
67 $test = &new test_utf8_strspn ();
68 $reporter = & getTestReporter();
69 $test->run($reporter);