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

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

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