3 * @version $Id: utf8_str_split.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 . '/str_split.php';
17 //--------------------------------------------------------------------
22 class test_utf8_str_split extends UnitTestCase {
24 function test_utf8_str_split() {
25 $this->UnitTestCase('utf8_str_split()');
28 function testSplitOneChar() {
29 $str = 'Iñtërnâtiônàlizætiøn';
31 'I','ñ','t','ë','r','n','â','t','i','ô','n','à','l','i',
32 'z','æ','t','i','ø','n',
34 $this->assertEqual(utf8_str_split($str),$array);
37 function testSplitFiveChars() {
38 $str = 'Iñtërnâtiônàlizætiøn';
40 'Iñtër','nâtiô','nàliz','ætiøn',
42 $this->assertEqual(utf8_str_split($str,5),$array);
45 function testSplitSixChars() {
46 $str = 'Iñtërnâtiônàlizætiøn';
48 'Iñtërn','âtiônà', 'lizæti','øn',
50 $this->assertEqual(utf8_str_split($str,6),$array);
53 function testSplitLong() {
54 $str = 'Iñtërnâtiônàlizætiøn';
56 'Iñtërnâtiônàlizætiøn',
58 $this->assertEqual(utf8_str_split($str,40),$array);
61 function testSplitNewline() {
62 $str = "Iñtërn\nâtiônàl\nizætiøn\n";
64 'I','ñ','t','ë','r','n',"\n",'â','t','i','ô','n','à','l',"\n",'i',
65 'z','æ','t','i','ø','n',"\n",
67 $this->assertEqual(utf8_str_split($str),$array);
72 //--------------------------------------------------------------------
77 if (!defined('TEST_RUNNING')) {
78 define('TEST_RUNNING', true);
79 $test = &new test_utf8_str_split();
80 $reporter = & getTestReporter();
81 $test->run($reporter);