diff options
author | andy wharmby <wharmby@php.net> | 2009-01-26 22:27:06 +0000 |
---|---|---|
committer | andy wharmby <wharmby@php.net> | 2009-01-26 22:27:06 +0000 |
commit | 5e6736ac7aa0a389fbc83b06ac805d8e46188daa (patch) | |
tree | bc0f82ac881cdd9ba14ea74f1a3e2bc29688cfd8 /ext/standard/tests/general_functions/var_export_basic1.phpt | |
parent | aba50265bb8c1368da9e8d82e1931eeced1613ea (diff) | |
download | php-git-5e6736ac7aa0a389fbc83b06ac805d8e46188daa.tar.gz |
Split-ip var_export.phpt and add new error tests. Tested on Windows, Linux and Linux 64 bit
Diffstat (limited to 'ext/standard/tests/general_functions/var_export_basic1.phpt')
-rw-r--r-- | ext/standard/tests/general_functions/var_export_basic1.phpt | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt new file mode 100644 index 0000000000..3a734c7fe0 --- /dev/null +++ b/ext/standard/tests/general_functions/var_export_basic1.phpt @@ -0,0 +1,141 @@ +--TEST-- +Test var_export() function with integer values +--FILE-- +<?php +/* Prototype : mixed var_export(mixed var [, bool return]) + * Description: Outputs or returns a string representation of a variable + * Source code: ext/standard/var.c + * Alias to functions: + */ + +echo "*** Testing var_export() with integer values ***\n"; +// different integer vlaues +$valid_ints = array( + '0' => '0', + '1' => '1', + '-1' => '-1', + '-2147483648' => '-2147483648', // max negative integer value + '-2147483647' => '-2147483647', + '2147483647' => 2147483647, // max positive integer value + '2147483640' => 2147483640, + '0x123B' => 0x123B, // integer as hexadecimal + "'0x12ab'" => '0x12ab', + "'0Xfff'" => '0Xfff', + "'0XFA'" => '0XFA', + "-0x80000000" => -0x80000000, // max negative integer as hexadecimal + "'0x7fffffff'" => '0x7fffffff', // max postive integer as hexadecimal + "0x7FFFFFFF" => 0x7FFFFFFF, // max postive integer as hexadecimal + "'0123'" => '0123', // integer as octal + "01912" => 01912, // should be quivalent to octal 1 + "-020000000000" => -020000000000, // max negative integer as octal + "017777777777" => 017777777777, // max positive integer as octal +); + +/* Loop to check for above integer values with var_export() */ +echo "\n*** Output for integer values ***\n"; +foreach($valid_ints as $key => $int_value) { + echo "\n-- Iteration: $key --\n"; + var_export( $int_value ); + echo "\n"; + var_export( $int_value, FALSE); + echo "\n"; + var_dump( var_export( $int_value, TRUE) ); +} + +?> +===DONE=== +--EXPECT-- +*** Testing var_export() with integer values *** + +*** Output for integer values *** + +-- Iteration: 0 -- +'0' +'0' +string(3) "'0'" + +-- Iteration: 1 -- +'1' +'1' +string(3) "'1'" + +-- Iteration: -1 -- +'-1' +'-1' +string(4) "'-1'" + +-- Iteration: -2147483648 -- +'-2147483648' +'-2147483648' +string(13) "'-2147483648'" + +-- Iteration: -2147483647 -- +'-2147483647' +'-2147483647' +string(13) "'-2147483647'" + +-- Iteration: 2147483647 -- +2147483647 +2147483647 +string(10) "2147483647" + +-- Iteration: 2147483640 -- +2147483640 +2147483640 +string(10) "2147483640" + +-- Iteration: 0x123B -- +4667 +4667 +string(4) "4667" + +-- Iteration: '0x12ab' -- +'0x12ab' +'0x12ab' +string(8) "'0x12ab'" + +-- Iteration: '0Xfff' -- +'0Xfff' +'0Xfff' +string(7) "'0Xfff'" + +-- Iteration: '0XFA' -- +'0XFA' +'0XFA' +string(6) "'0XFA'" + +-- Iteration: -0x80000000 -- +-2147483648 +-2147483648 +string(11) "-2147483648" + +-- Iteration: '0x7fffffff' -- +'0x7fffffff' +'0x7fffffff' +string(12) "'0x7fffffff'" + +-- Iteration: 0x7FFFFFFF -- +2147483647 +2147483647 +string(10) "2147483647" + +-- Iteration: '0123' -- +'0123' +'0123' +string(6) "'0123'" + +-- Iteration: 01912 -- +1 +1 +string(1) "1" + +-- Iteration: -020000000000 -- +-2147483648 +-2147483648 +string(11) "-2147483648" + +-- Iteration: 017777777777 -- +2147483647 +2147483647 +string(10) "2147483647" +===DONE=== |