Source for file utf8_ord.test.php

Documentation is available at utf8_ord.test.php

  1. <?php
  2. /**
  3. * @version $Id: utf8_ord.test.php,v 1.1 2007/09/09 20:39:50 pitlinz 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 . '/ord.php';
  16.  
  17. //--------------------------------------------------------------------
  18. /**
  19. * @package utf8
  20. * @subpackage Tests
  21. */
  22. class test_utf8_ord extends UnitTestCase {
  23.  
  24.     function test_utf8_ord() {
  25.         $this->UnitTestCase('utf8_ord()');
  26.     }
  27.     
  28.     function testEmptyStr() {
  29.         $str = '';
  30.         $this->assertEqual(utf8_ord($str),0);
  31.     }
  32.     
  33.     function testAsciiChar() {
  34.         $str = 'a';
  35.         $this->assertEqual(utf8_ord($str),97);
  36.     }
  37.     
  38.     function test2ByteChar() {
  39.         $str = 'ñ';
  40.         $this->assertEqual(utf8_ord($str),241);
  41.     }
  42.     
  43.     function test3ByteChar() {
  44.         $str = '₧';
  45.         $this->assertEqual(utf8_ord($str),8359);
  46.     }
  47.     
  48.     function test4ByteChar() {
  49.         $str = "\xf0\x90\x8c\xbc";
  50.         $this->assertEqual(utf8_ord($str),66364);
  51.     }
  52.     
  53. }
  54.  
  55. //--------------------------------------------------------------------
  56. /**
  57. * @package utf8
  58. * @subpackage Tests
  59. */
  60. if (!defined('TEST_RUNNING')) {
  61.     define('TEST_RUNNING', true);
  62.     $test = &new test_utf8_ord();
  63.     $reporter = & getTestReporter();
  64.     $test->run($reporter);
  65. }

Documentation generated on Thu, 08 Jan 2009 17:49:15 +0100 by phpDocumentor 1.4.0a2