From: Raghubansh Kumar Date: Wed, 26 Sep 2007 14:42:15 +0000 (+0000) Subject: new testcases for strrev() function X-Git-Tag: RELEASE_2_0_0a1~1750 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed72c6c50b522fd56c6b946a054192a26a638410;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..f358af8fa5 --- /dev/null +++ b/ext/standard/tests/strings/strrev_basic.phpt @@ -0,0 +1,60 @@ +--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 *** +--UEXPECTF-- +*** Testing strrev() : basic functionality *** +unicode(12) "dlroW ,olleH" +unicode(12) "dlroW ,olleH" +unicode(1) "H" +unicode(1) "H" +unicode(6) "HHHHHH" +unicode(6) "HhhhhH" +unicode(13) " +dlroW ,olleH" +unicode(14) "n\dlroW ,olleH" +unicode(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..ad165d36b3 --- /dev/null +++ b/ext/standard/tests/strings/strrev_error.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test strrev() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrev() : error conditions *** +-- Testing strrev() function with Zero arguments -- +Warning: strrev() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strrev() function with more than expected no. of arguments -- +Warning: strrev() expects exactly 1 parameter, 2 given in %s on line %d +NULL +*** Done *** +--UEXPECTF-- +*** Testing strrev() : error conditions *** +-- Testing strrev() function with Zero arguments -- +Warning: strrev() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing strrev() function with more than expected no. of arguments -- +Warning: strrev() expects exactly 1 parameter, 2 given 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..0e860480da 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..df3c245343 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..23caac19de 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..3a8a7a9f63 --- /dev/null +++ b/ext/standard/tests/strings/strrev_variation4.phpt @@ -0,0 +1,275 @@ +--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 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 11 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 12 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 13 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 14 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- 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 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), resource given in %s on line %d +NULL + +-- Iterator 25 -- +string(0) "" + +-- Iterator 26 -- +string(0) "" +*** Done *** +--UEXPECTF-- +*** Testing strrev() : unexpected inputs for 'str' *** + +-- Iterator 1 -- +unicode(1) "0" + +-- Iterator 2 -- +unicode(1) "1" + +-- Iterator 3 -- +unicode(5) "54321" + +-- Iterator 4 -- +unicode(5) "5432-" + +-- Iterator 5 -- +unicode(4) "5.01" + +-- Iterator 6 -- +unicode(5) "5.01-" + +-- Iterator 7 -- +unicode(12) "000000000501" + +-- Iterator 8 -- +unicode(7) "9-E60.1" + +-- Iterator 9 -- +unicode(3) "5.0" + +-- Iterator 10 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 11 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 12 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 13 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 14 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), array given in %s on line %d +NULL + +-- Iterator 15 -- +unicode(0) "" + +-- Iterator 16 -- +unicode(0) "" + +-- Iterator 17 -- +unicode(1) "1" + +-- Iterator 18 -- +unicode(0) "" + +-- Iterator 19 -- +unicode(1) "1" + +-- Iterator 20 -- +unicode(0) "" + +-- Iterator 21 -- +unicode(0) "" + +-- Iterator 22 -- +unicode(0) "" + +-- Iterator 23 -- +unicode(6) "tcejbo" + +-- Iterator 24 -- + +Warning: strrev() expects parameter 1 to be string (Unicode or binary), resource given in %s on line %d +NULL + +-- Iterator 25 -- +unicode(0) "" + +-- Iterator 26 -- +unicode(0) "" +*** Done ***