From: andy wharmby Date: Sun, 18 Jan 2009 22:50:58 +0000 (+0000) Subject: New nl_langinfo(), number_format() and ord() tests. Tested on Windows. Linux and... X-Git-Tag: php-5.2.9RC1~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4db72b092fabbd59548ed982a579a44f4491e40f;p=php New nl_langinfo(), number_format() and ord() tests. Tested on Windows. Linux and Linux 64 bit --- diff --git a/ext/standard/tests/strings/nl2br_variation5.phpt b/ext/standard/tests/strings/nl2br_variation5.phpt index 066d642cdc..a042dd6b16 100644 --- a/ext/standard/tests/strings/nl2br_variation5.phpt +++ b/ext/standard/tests/strings/nl2br_variation5.phpt @@ -40,8 +40,8 @@ $values = array( // float data 10.5, -10.5, - 10.5e10, - 10.6E-10, + 10.1234567e10, + 10.7654321E-10, .5, // array data @@ -85,8 +85,8 @@ foreach($values as $value) { //closing the file handle fclose( $file_handle ); -echo "Done"; ?> +===DONE=== --EXPECTF-- *** Testing nl2br() : usage variations *** -- Iteration 1 -- @@ -102,9 +102,9 @@ string(4) "10.5" -- Iteration 6 -- string(5) "-10.5" -- Iteration 7 -- -string(12) "105000000000" +string(12) "101234567000" -- Iteration 8 -- -string(7) "1.06E-9" +string(13) "1.07654321E-9" -- Iteration 9 -- string(3) "0.5" -- Iteration 10 -- @@ -147,4 +147,4 @@ string(9) "My String" string(0) "" -- Iteration 24 -- string(0) "" -Done +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/nl_langinfo_basic.phpt b/ext/standard/tests/strings/nl_langinfo_basic.phpt new file mode 100644 index 0000000000..370177ba8a --- /dev/null +++ b/ext/standard/tests/strings/nl_langinfo_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test nl_langinfo() function : basic functionality +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing nl_langinfo() : basic functionality *** +string(3) "Mon" +string(9) "Wednesday" +string(3) "Jul" +string(5) "April" +string(1) "." +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/nl_langinfo_error1.phpt b/ext/standard/tests/strings/nl_langinfo_error1.phpt new file mode 100644 index 0000000000..7702b012e9 --- /dev/null +++ b/ext/standard/tests/strings/nl_langinfo_error1.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test nl_langinfo() function : error conditions +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing nl_langinfo() : error conditions *** + +-- Testing nl_langinfo() function with no arguments -- + +Warning: nl_langinfo() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing nl_langinfo() function with more than expected no. of arguments -- + +Warning: nl_langinfo() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/strings/nl_langinfo_variation1.phpt b/ext/standard/tests/strings/nl_langinfo_variation1.phpt new file mode 100644 index 0000000000..65dbb28044 --- /dev/null +++ b/ext/standard/tests/strings/nl_langinfo_variation1.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test nl_langinfo() function : unexpected inputs for '$tem' argument +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing nl_langinfo() : with unexpected inputs for 'item' argument *** +-- Iteration 1 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: nl_langinfo(): Item '10' is not valid in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: nl_langinfo(): Item '2147483647' is not valid in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: nl_langinfo(): Item '-2147483648' is not valid in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: nl_langinfo(): Item '10' is not valid in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: nl_langinfo(): Item '20' is not valid in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: nl_langinfo(): Item '-20' is not valid in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: nl_langinfo(): Item '1012345' is not valid in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: nl_langinfo() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: nl_langinfo(): Item '1' is not valid in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: nl_langinfo(): Item '1' is not valid in %s on line %d +bool(false) +-- Iteration 15 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: nl_langinfo() expects parameter 1 to be long, object given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: nl_langinfo() expects parameter 1 to be long, resource given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: nl_langinfo(): Item '0' is not valid in %s on line %d +bool(false) +===DONE=== + diff --git a/ext/standard/tests/strings/number_format_basic.phpt b/ext/standard/tests/strings/number_format_basic.phpt new file mode 100644 index 0000000000..7a5a7a7708 --- /dev/null +++ b/ext/standard/tests/strings/number_format_basic.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test number_format() - basic function test number_format() +--FILE-- + +===DONE=== +--EXPECTF-- +-- number_format tests.....default -- +string(5) "1,235" +string(6) "-1,235" +string(10) "12,346,578" +string(11) "-12,345,679" +string(11) "305,450,479" +string(11) "402,653,183" +string(11) "123,456,789" +string(3) "123" +string(3) "123" +string(1) "0" +string(1) "1" +string(1) "0" + +-- number_format tests.....with two dp -- +string(8) "1,234.57" +string(9) "-1,234.57" +string(13) "12,346,578.00" +string(14) "-12,345,678.90" +string(14) "305,450,479.00" +string(14) "402,653,183.00" +string(14) "123,456,789.00" +string(6) "123.46" +string(6) "123.46" +string(4) "0.00" +string(4) "1.00" +string(4) "0.00" + +-- number_format tests.....English format -- +string(8) "1 234.57" +string(9) "-1 234.57" +string(13) "12 346 578.00" +string(14) "-12 345 678.90" +string(14) "305 450 479.00" +string(14) "402 653 183.00" +string(14) "123 456 789.00" +string(6) "123.46" +string(6) "123.46" +string(4) "0.00" +string(4) "1.00" +string(4) "0.00" + +-- number_format tests.....French format -- +string(8) "1 234,57" +string(9) "-1 234,57" +string(13) "12 346 578,00" +string(14) "-12 345 678,90" +string(14) "305 450 479,00" +string(14) "402 653 183,00" +string(14) "123 456 789,00" +string(6) "123,46" +string(6) "123,46" +string(4) "0,00" +string(4) "1,00" +string(4) "0,00" +===DONE=== diff --git a/ext/standard/tests/strings/number_format_error.phpt b/ext/standard/tests/strings/number_format_error.phpt new file mode 100644 index 0000000000..be3521607f --- /dev/null +++ b/ext/standard/tests/strings/number_format_error.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test number_format() - wrong params test number_format() +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing number_format() : error conditions *** + +-- Testing number_format() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for number_format() in %s on line %d + +-- Testing number_format() function with 3 arguments -- + +Warning: Wrong parameter count for number_format() in %s on line %d + +-- Testing number_format() function with more than 4 arguments -- + +Warning: Wrong parameter count for number_format() in %s on line %d +===DONE=== diff --git a/ext/standard/tests/strings/ord_basic.phpt b/ext/standard/tests/strings/ord_basic.phpt new file mode 100644 index 0000000000..19f3ea28d6 --- /dev/null +++ b/ext/standard/tests/strings/ord_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test ord() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing ord() : basic functionality *** +int(97) +int(122) +int(48) +int(57) +int(33) +int(42) +int(64) +int(10) +int(10) +int(255) +int(72) +===DONE=== diff --git a/ext/standard/tests/strings/ord_error.phpt b/ext/standard/tests/strings/ord_error.phpt new file mode 100644 index 0000000000..c81839264b --- /dev/null +++ b/ext/standard/tests/strings/ord_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test ord() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing ord() : error conditions *** + +-- Testing ord() function with no arguments -- + +Warning: Wrong parameter count for ord() in %s on line %d +NULL + +-- Testing ord() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for ord() in %s on line %d +NULL +===DONE=== diff --git a/ext/standard/tests/strings/ord_variation1.phpt b/ext/standard/tests/strings/ord_variation1.phpt new file mode 100644 index 0000000000..ebff2f7db6 --- /dev/null +++ b/ext/standard/tests/strings/ord_variation1.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test ord() function : usage variations - test values for $string argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing ord() function: with unexpected inputs for 'string' argument *** +-- Iteration 1 -- +int(48) +-- Iteration 2 -- +int(49) +-- Iteration 3 -- +int(50) +-- Iteration 4 -- +int(50) +-- Iteration 5 -- +int(50) +-- Iteration 6 -- +int(45) +-- Iteration 7 -- +int(49) +-- Iteration 8 -- +int(45) +-- Iteration 9 -- +int(49) +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +int(65) +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +int(65) +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +int(65) +-- Iteration 13 -- +int(49) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- +int(49) +-- Iteration 16 -- +int(0) +-- Iteration 17 -- +int(0) +-- Iteration 18 -- +int(0) +-- Iteration 19 -- +int(115) +-- Iteration 20 -- +int(%d) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +===DONE===