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

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

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