]> projects.mako.cc - scuttle/blob - includes/utf8/tests/cases/utf8_strcspn.test.php
remove duplicate shared-tag in xml - the android apps dont like this
[scuttle] / includes / utf8 / tests / cases / utf8_strcspn.test.php
1 <?php
2 /**
3 * @version $Id: utf8_strcspn.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 . '/strcspn.php';
16
17 //--------------------------------------------------------------------
18 /**
19 * @package utf8
20 * @subpackage Tests
21 */
22 class test_utf8_strcspn extends UnitTestCase {
23
24     function test_utf8_strcspn () {
25         $this->UnitTestCase('test_utf8_strcspn()');
26     }
27     
28     function testNoMatchSingleByteSearch() {
29         $str = 'iñtërnâtiônàlizætiøn';
30         $this->assertEqual(utf8_strcspn($str,'t'),2);
31     }
32     
33     function testNoMatchMultiByteSearch() {
34         $str = 'iñtërnâtiônàlizætiøn';
35         $this->assertEqual(utf8_strcspn($str,'â'),6);
36     }
37     
38     function testCompareStrspn() {
39         $str = 'aeioustr';
40         $this->assertEqual(utf8_strcspn($str,'tr'),strcspn($str,'tr'));
41     }
42     
43     function testMatchAscii() {
44         $str = 'internationalization';
45         $this->assertEqual(utf8_strcspn($str,'a'),strcspn($str,'a'));
46     }
47     
48     function testLinefeed() {
49         $str = "i\nñtërnâtiônàlizætiøn";
50         $this->assertEqual(utf8_strcspn($str,'t'),3);
51     }
52     
53     function testLinefeedMask() {
54         $str = "i\nñtërnâtiônàlizætiøn";
55         $this->assertEqual(utf8_strcspn($str,"\n"),1);
56     }
57 }
58
59 //--------------------------------------------------------------------
60 /**
61 * @package utf8
62 * @subpackage Tests
63 */
64 if (!defined('TEST_RUNNING')) {
65     define('TEST_RUNNING', true);
66     $test = &new test_utf8_strcspn ();
67     $reporter = & getTestReporter();
68     $test->run($reporter);
69 }

Benjamin Mako Hill || Want to submit a patch?