Annotation of embedaddon/php/ext/standard/tests/array/array_values_variation.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_values() function (variation)
! 3: --SKIPIF--
! 4: <?php
! 5: if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
! 6: ?>
! 7: --INI--
! 8: precision=14
! 9: --FILE--
! 10: <?php
! 11:
! 12: echo "\n*** Testing array_values() with resource type ***\n";
! 13: $resource1 = fopen(__FILE__, "r"); // Creating a file resource
! 14: $resource2 = opendir("."); // Creating a dir resource
! 15:
! 16: /* creating an array with resources as elements */
! 17: $arr_resource = array( "a" => $resource1, "b" => $resource2);
! 18: var_dump( array_values($arr_resource) );
! 19:
! 20: echo "\n*** Testing array_values() with range checking ***\n";
! 21: $arr_range = array(
! 22: 2147483647,
! 23: 2147483648,
! 24: -2147483647,
! 25: -2147483648,
! 26: -0,
! 27: 0,
! 28: -2147483649
! 29: );
! 30: var_dump( array_values($arr_range) );
! 31:
! 32: echo "\n*** Testing array_values() on an array created on the fly ***\n";
! 33: var_dump( array_values(array(1,2,3)) );
! 34: var_dump( array_values(array()) ); // null array
! 35:
! 36: echo "Done\n";
! 37: ?>
! 38: --EXPECTF--
! 39: *** Testing array_values() with resource type ***
! 40: array(2) {
! 41: [0]=>
! 42: resource(%d) of type (stream)
! 43: [1]=>
! 44: resource(%d) of type (stream)
! 45: }
! 46:
! 47: *** Testing array_values() with range checking ***
! 48: array(7) {
! 49: [0]=>
! 50: int(2147483647)
! 51: [1]=>
! 52: float(2147483648)
! 53: [2]=>
! 54: int(-2147483647)
! 55: [3]=>
! 56: float(-2147483648)
! 57: [4]=>
! 58: int(0)
! 59: [5]=>
! 60: int(0)
! 61: [6]=>
! 62: float(-2147483649)
! 63: }
! 64:
! 65: *** Testing array_values() on an array created on the fly ***
! 66: array(3) {
! 67: [0]=>
! 68: int(1)
! 69: [1]=>
! 70: int(2)
! 71: [2]=>
! 72: int(3)
! 73: }
! 74: array(0) {
! 75: }
! 76: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>