3 * @version $Id: utf8_strpos.test.php,v 1.2 2006/02/24 23:33:10 harryf Exp $
8 //--------------------------------------------------------------------
14 require_once(dirname(__FILE__).'/../config.php');
16 //--------------------------------------------------------------------
21 class test_utf8_strpos extends UnitTestCase {
23 function test_utf8_strpos() {
24 $this->UnitTestCase('utf8_strpos()');
28 $str = 'Iñtërnâtiônàlizætiøn';
29 $this->assertEqual(utf8_strpos($str,'â'),6);
32 function testUtf8Offset() {
33 $str = 'Iñtërnâtiônàlizætiøn';
34 $this->assertEqual(utf8_strpos($str,'n',11),19);
37 function testUtf8Invalid() {
38 $str = "Iñtërnâtiôn\xe9àlizætiøn";
39 $this->assertEqual(utf8_strpos($str,'æ'),15);
42 function testAscii() {
44 $this->assertEqual(utf8_strpos($str,'B'),1);
47 function testVsStrpos() {
49 $this->assertEqual(utf8_strpos($str,'B',3),strpos($str,'B',3));
52 function testEmptyStr() {
54 $this->assertFalse(utf8_strpos($str,'x'));
59 //--------------------------------------------------------------------
64 if (!defined('TEST_RUNNING')) {
65 define('TEST_RUNNING', true);
66 $test = &new test_utf8_strpos();
67 $reporter = & getTestReporter();
68 $test->run($reporter);