]> projects.mako.cc - scuttle/blob - includes/utf8/tests/cases/utf8_strcasecmp.test.php
added new version of JQuery plus CSS/images
[scuttle] / includes / utf8 / tests / cases / utf8_strcasecmp.test.php
1 <?php
2 /**
3 * @version $Id: utf8_strcasecmp.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 . '/strcasecmp.php';
16
17 //--------------------------------------------------------------------
18 /**
19 * @package utf8
20 * @subpackage Tests
21 */
22 class test_utf8_strcasecmp extends UnitTestCase {
23
24     function test_utf8_strcasecmp () {
25         $this->UnitTestCase('test_utf8_strcasecmp()');
26     }
27     
28     function testCompareEqual() {
29         $strX = 'iñtërnâtiônàlizætiøn';
30         $strY = 'IÑTËRNÂTIÔNÀLIZÆTIØN';
31         $this->assertEqual(utf8_strcasecmp($strX,$strY),0);
32     }
33     
34     
35     function testLess() {
36         $strX = 'iñtërnâtiônàlizætiøn';
37         $strY = 'IÑTËRNÂTIÔÀLIZÆTIØN';
38         $this->assertTrue(utf8_strcasecmp($strX,$strY) < 0);
39     }
40     
41     function testGreater() {
42         $strX = 'iñtërnâtiôàlizætiøn';
43         $strY = 'IÑTËRNÂTIÔNÀLIZÆTIØN';
44         $this->assertTrue(utf8_strcasecmp($strX,$strY) > 0);
45     }
46     
47     function testEmptyX() {
48         $strX = '';
49         $strY = 'IÑTËRNÂTIÔNÀLIZÆTIØN';
50         $this->assertTrue(utf8_strcasecmp($strX,$strY) < 0);
51     }
52     
53     function testEmptyY() {
54         $strX = 'iñtërnâtiôàlizætiøn';
55         $strY = '';
56         $this->assertTrue(utf8_strcasecmp($strX,$strY) > 0);
57     }
58     
59     function testEmptyBoth() {
60         $strX = '';
61         $strY = '';
62         $this->assertTrue(utf8_strcasecmp($strX,$strY) == 0);
63     }
64     
65     function testLinefeed() {
66         $strX = "iñtërnâtiôn\nàlizætiøn";
67         $strY = "IÑTËRNÂTIÔN\nÀLIZÆTIØN";
68         $this->assertTrue(utf8_strcasecmp($strX,$strY) == 0);
69     }
70
71 }
72
73 //--------------------------------------------------------------------
74 /**
75 * @package utf8
76 * @subpackage Tests
77 */
78 if (!defined('TEST_RUNNING')) {
79     define('TEST_RUNNING', true);
80     $test = &new test_utf8_strcasecmp ();
81     $reporter = & getTestReporter();
82     $test->run($reporter);
83 }

Benjamin Mako Hill || Want to submit a patch?