From: Antony Dovgal Date: Mon, 16 Jul 2007 10:59:07 +0000 (+0000) Subject: split test X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~102 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=febe567acb354f35708dfd52ecf1b04439d34a94;p=php split test --- diff --git a/ext/standard/tests/strings/substr_count_basic.phpt b/ext/standard/tests/strings/substr_count_basic.phpt new file mode 100644 index 0000000000..5aa3c9d2cd --- /dev/null +++ b/ext/standard/tests/strings/substr_count_basic.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test substr_count() function (basic) +--FILE-- + +--EXPECTF-- +***Testing basic operations *** +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(100) +int(200) +int(160) +int(10) +Done +--UEXPECTF-- +***Testing basic operations *** +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(100) +int(200) +int(160) +int(10) +Done diff --git a/ext/standard/tests/strings/substr_count_error.phpt b/ext/standard/tests/strings/substr_count_error.phpt new file mode 100644 index 0000000000..772b95cff1 --- /dev/null +++ b/ext/standard/tests/strings/substr_count_error.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test substr_count() function (error conditions) +--FILE-- + size of the string */ +var_dump(substr_count($str, "t", 25)); + +/* Using offset and length to go beyond the size of the string: + Warning message expected, as length+offset > length of string */ +var_dump( substr_count($str, "i", 5, 15) ); + +/* length as Null */ +var_dump( substr_count($str, "t", "", "") ); +var_dump( substr_count($str, "i", NULL, NULL) ); + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count() expects parameter 3 to be long, string given in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d +int(0) +Done diff --git a/ext/standard/tests/strings/substr_count.phpt b/ext/standard/tests/strings/substr_count_variation_001.phpt similarity index 59% rename from ext/standard/tests/strings/substr_count.phpt rename to ext/standard/tests/strings/substr_count_variation_001.phpt index 3581aa5b8b..e9841cb29e 100644 --- a/ext/standard/tests/strings/substr_count.phpt +++ b/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -1,25 +1,7 @@ --TEST-- -Test substr_count() function +Test substr_count() function (variation - 1) --FILE-- size of the string */ -var_dump(substr_count($str, "t", 25)); - -/* Using offset and length to go beyond the size of the string: - Warning message expected, as length+offset > length of string */ -var_dump( substr_count($str, "i", 5, 15) ); - -/* length as Null */ -var_dump( substr_count($str, "t", "", "") ); -var_dump( substr_count($str, "i", NULL, NULL) ); - echo "Done\n"; ?> --EXPECTF-- -***Testing basic operations *** -bool(false) -bool(false) -int(0) -int(0) -int(0) -int(100) -int(200) -int(160) -int(10) - *** Testing possible variations *** -- 3rd or 4th arg as string -- int(1) @@ -147,25 +96,49 @@ int(16) int(0) int(0) int(0) +Done +--UEXPECTF-- +*** Testing possible variations *** +-- 3rd or 4th arg as string -- +int(1) +int(1) -*** Testing error conditions *** +Notice: A non well formed numeric value encountered in %s on line %d +int(2) -Warning: substr_count() expects at least 2 parameters, 0 given in %s on line %d -NULL +Notice: A non well formed numeric value encountered in %s on line %d -Warning: substr_count() expects at most 4 parameters, 5 given in %s on line %d -NULL +Notice: A non well formed numeric value encountered in %s on line %d +int(2) -Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d -bool(false) +-- 3rd or 4th arg as NULL -- -Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d -bool(false) +Warning: substr_count() expects parameter 3 to be long, string given in %s on line %d +NULL -Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d -bool(false) +Warning: substr_count() expects parameter 3 to be long, string given in %s on line %d +NULL Warning: substr_count() expects parameter 3 to be long, string given in %s on line %d NULL int(0) +int(2) + +-- overlapped substrings -- +int(2) +int(2) + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) Done diff --git a/ext/standard/tests/strings/substr_count_variation_002.phpt b/ext/standard/tests/strings/substr_count_variation_002.phpt new file mode 100644 index 0000000000..77aef8cdfe --- /dev/null +++ b/ext/standard/tests/strings/substr_count_variation_002.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test substr_count() function (variation - 2) +--FILE-- + +--EXPECTF-- +*** Testing possible variations *** + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done +--UEXPECTF-- +*** Testing possible variations *** + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done