From: Raghubansh Kumar Date: Wed, 26 Sep 2007 14:40:14 +0000 (+0000) Subject: new testcases for strrev() function X-Git-Tag: php-5.2.5RC1~88 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ff92b584e6b4ec301ce5145b0f98c383cc2d4fb;p=php new testcases for strrev() function --- diff --git a/ext/standard/tests/strings/strrev_basic.phpt b/ext/standard/tests/strings/strrev_basic.phpt new file mode 100644 index 0000000000..2cde4cdf89 --- /dev/null +++ b/ext/standard/tests/strings/strrev_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strrev() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strrev() : basic functionality *** +string(12) "dlroW ,olleH" +string(12) "dlroW ,olleH" +string(1) "H" +string(1) "H" +string(6) "HHHHHH" +string(6) "HhhhhH" +string(13) " +dlroW ,olleH" +string(14) "n\dlroW ,olleH" +string(12) "dlrow ,olleH" +*** Done *** diff --git a/ext/standard/tests/strings/strrev_error.phpt b/ext/standard/tests/strings/strrev_error.phpt new file mode 100644 index 0000000000..e1fd9f8248 --- /dev/null +++ b/ext/standard/tests/strings/strrev_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test strrev() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrev() : error conditions *** +-- Testing strrev() function with Zero arguments -- +Warning: Wrong parameter count for strrev() in %s on line %d +NULL + +-- Testing strrev() function with more than expected no. of arguments -- +Warning: Wrong parameter count for strrev() in %s on line %d +NULL +*** Done *** diff --git a/ext/standard/tests/strings/strrev_variation1.phpt b/ext/standard/tests/strings/strrev_variation1.phpt new file mode 100644 index 0000000000..39c1ec4144 Binary files /dev/null and b/ext/standard/tests/strings/strrev_variation1.phpt differ diff --git a/ext/standard/tests/strings/strrev_variation2.phpt b/ext/standard/tests/strings/strrev_variation2.phpt new file mode 100644 index 0000000000..41e54d53c6 Binary files /dev/null and b/ext/standard/tests/strings/strrev_variation2.phpt differ diff --git a/ext/standard/tests/strings/strrev_variation3.phpt b/ext/standard/tests/strings/strrev_variation3.phpt new file mode 100644 index 0000000000..8ab3e25b66 Binary files /dev/null and b/ext/standard/tests/strings/strrev_variation3.phpt differ diff --git a/ext/standard/tests/strings/strrev_variation4.phpt b/ext/standard/tests/strings/strrev_variation4.phpt new file mode 100644 index 0000000000..c9473e433d --- /dev/null +++ b/ext/standard/tests/strings/strrev_variation4.phpt @@ -0,0 +1,180 @@ +--TEST-- +Test strrev() function : usage variations - unexpected inputs +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // resource + $resource, + + // undefined data + @$undefined_var, + + // unset data + @$unset_var +); + +// loop through each element of the array for str + +$count = 1; +foreach($values as $value) { + echo "\n-- Iterator $count --\n"; + var_dump( strrev($value) ); + $count++; +}; + +fclose($resource); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrev() : unexpected inputs for 'str' *** + +-- Iterator 1 -- +string(1) "0" + +-- Iterator 2 -- +string(1) "1" + +-- Iterator 3 -- +string(5) "54321" + +-- Iterator 4 -- +string(5) "5432-" + +-- Iterator 5 -- +string(4) "5.01" + +-- Iterator 6 -- +string(5) "5.01-" + +-- Iterator 7 -- +string(12) "000000000501" + +-- Iterator 8 -- +string(7) "9-E60.1" + +-- Iterator 9 -- +string(3) "5.0" + +-- Iterator 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 15 -- +string(0) "" + +-- Iterator 16 -- +string(0) "" + +-- Iterator 17 -- +string(1) "1" + +-- Iterator 18 -- +string(0) "" + +-- Iterator 19 -- +string(1) "1" + +-- Iterator 20 -- +string(0) "" + +-- Iterator 21 -- +string(0) "" + +-- Iterator 22 -- +string(0) "" + +-- Iterator 23 -- +string(6) "tcejbo" + +-- Iterator 24 -- +string(14) "%d# di ecruoseR" + +-- Iterator 25 -- +string(0) "" + +-- Iterator 26 -- +string(0) "" +*** Done ***