3 * @version $Id: utf8_strcspn.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 . '/strcspn.php';
17 //--------------------------------------------------------------------
22 class test_utf8_strcspn extends UnitTestCase {
24 function test_utf8_strcspn () {
25 $this->UnitTestCase('test_utf8_strcspn()');
28 function testNoMatchSingleByteSearch() {
29 $str = 'iñtërnâtiônàlizætiøn';
30 $this->assertEqual(utf8_strcspn($str,'t'),2);
33 function testNoMatchMultiByteSearch() {
34 $str = 'iñtërnâtiônàlizætiøn';
35 $this->assertEqual(utf8_strcspn($str,'â'),6);
38 function testCompareStrspn() {
40 $this->assertEqual(utf8_strcspn($str,'tr'),strcspn($str,'tr'));
43 function testMatchAscii() {
44 $str = 'internationalization';
45 $this->assertEqual(utf8_strcspn($str,'a'),strcspn($str,'a'));
48 function testLinefeed() {
49 $str = "i\nñtërnâtiônàlizætiøn";
50 $this->assertEqual(utf8_strcspn($str,'t'),3);
53 function testLinefeedMask() {
54 $str = "i\nñtërnâtiônàlizætiøn";
55 $this->assertEqual(utf8_strcspn($str,"\n"),1);
59 //--------------------------------------------------------------------
64 if (!defined('TEST_RUNNING')) {
65 define('TEST_RUNNING', true);
66 $test = &new test_utf8_strcspn ();
67 $reporter = & getTestReporter();
68 $test->run($reporter);