Annotation of embedaddon/php/ext/ctype/tests/ctype_upper_variation1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test ctype_upper() function : usage variations - different data types
                      3: --SKIPIF--
                      4: <?php require_once('skipif.inc'); ?>
                      5: --FILE--
                      6: <?php
                      7: /* Prototype  : bool ctype_upper(mixed $c)
                      8:  * Description: Checks for uppercase character(s) 
                      9:  * Source code: ext/ctype/ctype.c
                     10:  */
                     11: 
                     12: /*
                     13:  * Pass different data types as $c argument to ctype_upper() to test behaviour
                     14:  */
                     15: 
                     16: echo "*** Testing ctype_upper() : usage variations ***\n";
                     17: 
                     18: $orig = setlocale(LC_CTYPE, "C");
                     19: 
                     20: //get an unset variable
                     21: $unset_var = 10;
                     22: unset ($unset_var);
                     23: 
                     24: // get a class
                     25: class classA
                     26: {
                     27:        public function __toString() {
                     28:                return "HELLO";
                     29:        }
                     30: }
                     31: 
                     32: // heredoc string
                     33: $heredoc = <<<EOT
                     34: HI
                     35: EOT;
                     36: 
                     37: // get a resource variable
                     38: $fp = fopen(__FILE__, "r");
                     39: 
                     40: // unexpected values to be passed to $c argument
                     41: $inputs = array(
                     42: 
                     43:        // int data
                     44: /*1*/  0,
                     45:        1,
                     46:        12345,
                     47:        -2345,
                     48: 
                     49:        // float data
                     50: /*5*/  10.5,
                     51:        -10.5,
                     52:        12.3456789000e10,
                     53:        12.3456789000E-10,
                     54:        .5,
                     55: 
                     56:        // null data
                     57: /*10*/ NULL,
                     58:        null,
                     59: 
                     60:        // boolean data
                     61: /*12*/ true,
                     62:        false,
                     63:        TRUE,
                     64:        FALSE,
                     65:        
                     66:        // empty data
                     67: /*16*/ "",
                     68:        '',
                     69:        array(),
                     70: 
                     71:        // string data
                     72: /*19*/ "STRING",
                     73:        'STRING',
                     74:        $heredoc,
                     75:        
                     76:        // object data
                     77: /*22*/ new classA(),
                     78: 
                     79:        // undefined data
                     80: /*23*/ @$undefined_var,
                     81: 
                     82:        // unset data
                     83: /*24*/ @$unset_var,
                     84: 
                     85:        // resource variable
                     86: /*25*/ $fp
                     87: );
                     88: 
                     89: // loop through each element of $inputs to check the behavior of ctype_upper()
                     90: $iterator = 1;
                     91: foreach($inputs as $input) {
                     92:        echo "\n-- Iteration $iterator --\n";
                     93:        var_dump( ctype_upper($input) );
                     94:        $iterator++;
                     95: };
                     96: 
                     97: fclose($fp);
                     98: 
                     99: setlocale(LC_CTYPE, $orig);
                    100: ?>
                    101: ===DONE===
                    102: --EXPECTF--
                    103: *** Testing ctype_upper() : usage variations ***
                    104: 
                    105: -- Iteration 1 --
                    106: bool(false)
                    107: 
                    108: -- Iteration 2 --
                    109: bool(false)
                    110: 
                    111: -- Iteration 3 --
                    112: bool(false)
                    113: 
                    114: -- Iteration 4 --
                    115: bool(false)
                    116: 
                    117: -- Iteration 5 --
                    118: bool(false)
                    119: 
                    120: -- Iteration 6 --
                    121: bool(false)
                    122: 
                    123: -- Iteration 7 --
                    124: bool(false)
                    125: 
                    126: -- Iteration 8 --
                    127: bool(false)
                    128: 
                    129: -- Iteration 9 --
                    130: bool(false)
                    131: 
                    132: -- Iteration 10 --
                    133: bool(false)
                    134: 
                    135: -- Iteration 11 --
                    136: bool(false)
                    137: 
                    138: -- Iteration 12 --
                    139: bool(false)
                    140: 
                    141: -- Iteration 13 --
                    142: bool(false)
                    143: 
                    144: -- Iteration 14 --
                    145: bool(false)
                    146: 
                    147: -- Iteration 15 --
                    148: bool(false)
                    149: 
                    150: -- Iteration 16 --
                    151: bool(false)
                    152: 
                    153: -- Iteration 17 --
                    154: bool(false)
                    155: 
                    156: -- Iteration 18 --
                    157: bool(false)
                    158: 
                    159: -- Iteration 19 --
                    160: bool(true)
                    161: 
                    162: -- Iteration 20 --
                    163: bool(true)
                    164: 
                    165: -- Iteration 21 --
                    166: bool(true)
                    167: 
                    168: -- Iteration 22 --
                    169: bool(false)
                    170: 
                    171: -- Iteration 23 --
                    172: bool(false)
                    173: 
                    174: -- Iteration 24 --
                    175: bool(false)
                    176: 
                    177: -- Iteration 25 --
                    178: bool(false)
                    179: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>