Annotation of embedaddon/php/ext/standard/tests/math/is_finite_variation1.phpt, revision 1.1

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

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