From: andy wharmby Date: Mon, 17 Aug 2009 10:37:30 +0000 (+0000) Subject: New basic string tests - includes back-porting a few existing tests back to 5.2.... X-Git-Tag: php-5.4.0alpha1~191^2~2795 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db6a41487d386562a81e3f822993105adf2df18c;p=php New basic string tests - includes back-porting a few existing tests back to 5.2. All tested on Windows, Linux and Linux 64 --- diff --git a/ext/standard/tests/strings/soundex_basic.phpt b/ext/standard/tests/strings/soundex_basic.phpt new file mode 100644 index 0000000000..65bcb64252 --- /dev/null +++ b/ext/standard/tests/strings/soundex_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test soundex() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing soundex() : basic functionality *** +string(4) "E460" +string(4) "G200" +string(4) "H416" +string(4) "K530" +string(4) "L300" +string(4) "L222" +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(false) + +===DONE=== diff --git a/ext/standard/tests/strings/soundex_error.phpt b/ext/standard/tests/strings/soundex_error.phpt new file mode 100644 index 0000000000..a81b9d24fe --- /dev/null +++ b/ext/standard/tests/strings/soundex_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test soundex() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing soundex error conditions ***-- Testing soundex() function with Zero arguments -- + +Warning: soundex() expects exactly 1 parameter, 0 given in %s on line %d +NULL + + +-- Testing soundex() function with more than expected no. of arguments -- + +Warning: soundex() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/str_rot13_basic.phpt b/ext/standard/tests/strings/str_rot13_basic.phpt new file mode 100644 index 0000000000..6a16cd52f6 --- /dev/null +++ b/ext/standard/tests/strings/str_rot13_basic.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test soundex() function : basic functionality +--FILE-- +.?"), "!%^&*()_-+={}[]:;@~#<,>.?")) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} + +echo "\nEnsure strings round trip\n"; +$str = "str_rot13() tests starting"; +$encode = str_rot13($str); +$decode = str_rot13($encode); +if (strcmp($str, $decode) == 0) { + echo "Strings equal : TEST PASSED\n"; +} else { + echo "Strings unequal : TEST FAILED\n"; +} +?> +===DONE=== +--EXPECTF-- +*** Testing str_rot13() : basic functionality *** + +Basic tests +unicode(26) "fge_ebg13() grfgf fgnegvat" +unicode(26) "nopqrstuvwxyzabcdefghijklm" + +Ensure numeric characters are left untouched +Strings equal : TEST PASSED + +Ensure non-alphabetic characters are left untouched +Strings unequal : TEST FAILED + +Ensure strings round trip +Strings equal : TEST PASSED +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/str_rot13_error.phpt b/ext/standard/tests/strings/str_rot13_error.phpt new file mode 100644 index 0000000000..99a99f29c5 --- /dev/null +++ b/ext/standard/tests/strings/str_rot13_error.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test str_rot13() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing str_rot13() : error conditions *** +-- Testing str_rot13() function with Zero arguments -- + +Warning: str_rot13() expects exactly 1 parameter, 0 given in %s on line %d +NULL + + +-- Testing str_rot13() function with more than expected no. of arguments -- + +Warning: str_rot13() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strnatcasecmp_error.phpt b/ext/standard/tests/strings/strnatcasecmp_error.phpt new file mode 100644 index 0000000000..45a15daefc --- /dev/null +++ b/ext/standard/tests/strings/strnatcasecmp_error.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test strnatcasecmp() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strnatcasecmp() : error conditions *** +-- Testing strnatcmp() function with Zero arguments -- + +Warning: strnatcasecmp() expects exactly 2 parameters, 0 given in %s on line %d +NULL + + +-- Testing strnatcasecmp() function with more than expected no. of arguments -- + +Warning: strnatcasecmp() expects exactly 2 parameters, 3 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strnatcmp_basic.phpt b/ext/standard/tests/strings/strnatcmp_basic.phpt new file mode 100644 index 0000000000..140bd48d6c --- /dev/null +++ b/ext/standard/tests/strings/strnatcmp_basic.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test strnatcmp() function : basic functionality +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strnatcmp() : basic functionality *** +Less than tests +int(-1) +int(-1) +int(-1) +int(-1) +int(-1) +int(1) +int(1) +int(1) +int(1) +int(1) +Equal too tests +int(0) +int(1) +Greater than tests +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +int(1) +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/strnatcmp_error.phpt b/ext/standard/tests/strings/strnatcmp_error.phpt new file mode 100644 index 0000000000..09cc668af9 --- /dev/null +++ b/ext/standard/tests/strings/strnatcmp_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strnatcmp() function : error conditions +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strnatcmp() : error conditions *** +-- Testing strnatcmp() function with Zero arguments -- + +Warning: strnatcmp() expects exactly 2 parameters, 0 given in %s on line %d +NULL + + +-- Testing strnatcmp() function with more than expected no. of arguments -- + +Warning: strnatcmp() expects exactly 2 parameters, 3 given in %s on line %d +NULL +===DONE===