X-Git-Url: https://projects.mako.cc/source/scuttle/blobdiff_plain/bce919af7b49bbd06223f79b8c37a53a3d263ff0..c7f63c8b9b12efd7b3c10b9f80cda06eaf32068f:/includes/utf8/tests/cases/utf8_strcspn.test.php diff --git a/includes/utf8/tests/cases/utf8_strcspn.test.php b/includes/utf8/tests/cases/utf8_strcspn.test.php new file mode 100644 index 0000000..c2a08bd --- /dev/null +++ b/includes/utf8/tests/cases/utf8_strcspn.test.php @@ -0,0 +1,69 @@ +UnitTestCase('test_utf8_strcspn()'); + } + + function testNoMatchSingleByteSearch() { + $str = 'iñtërnâtiônàlizætiøn'; + $this->assertEqual(utf8_strcspn($str,'t'),2); + } + + function testNoMatchMultiByteSearch() { + $str = 'iñtërnâtiônàlizætiøn'; + $this->assertEqual(utf8_strcspn($str,'â'),6); + } + + function testCompareStrspn() { + $str = 'aeioustr'; + $this->assertEqual(utf8_strcspn($str,'tr'),strcspn($str,'tr')); + } + + function testMatchAscii() { + $str = 'internationalization'; + $this->assertEqual(utf8_strcspn($str,'a'),strcspn($str,'a')); + } + + function testLinefeed() { + $str = "i\nñtërnâtiônàlizætiøn"; + $this->assertEqual(utf8_strcspn($str,'t'),3); + } + + function testLinefeedMask() { + $str = "i\nñtërnâtiônàlizætiøn"; + $this->assertEqual(utf8_strcspn($str,"\n"),1); + } +} + +//-------------------------------------------------------------------- +/** +* @package utf8 +* @subpackage Tests +*/ +if (!defined('TEST_RUNNING')) { + define('TEST_RUNNING', true); + $test = &new test_utf8_strcspn (); + $reporter = & getTestReporter(); + $test->run($reporter); +}