kraghuba Sat Sep 15 07:29:55 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/strings strncmp_basic.phpt
strncmp_variation1.phpt
strncmp_variation2.phpt
strncmp_variation3.phpt
strncmp_variation8.phpt
Log:
better output matching/fixes
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strncmp_basic.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/strings/strncmp_basic.phpt
diff -u php-src/ext/standard/tests/strings/strncmp_basic.phpt:1.1.2.1
php-src/ext/standard/tests/strings/strncmp_basic.phpt:1.1.2.2
--- php-src/ext/standard/tests/strings/strncmp_basic.phpt:1.1.2.1 Fri Sep
7 14:20:12 2007
+++ php-src/ext/standard/tests/strings/strncmp_basic.phpt Sat Sep 15
07:29:55 2007
@@ -7,17 +7,40 @@
* Source code: Zend/zend_builtin_functions.c
*/
-/* Test strncmp() function with all three arguments */
+echo "*** Testing strncmp() function: basic functionality ***\n";
-echo "*** Test strncmp() function: basic functionality ***\n";
+echo "-- Testing strncmp() with single quoted string --\n";
+var_dump( strncmp('Hello', 'Hello', 5) ); //expected: int(0)
+var_dump( strncmp('Hello', 'Hi', 5) ); //expected: value < 0
+var_dump( strncmp('Hi', 'Hello', 5) ); //expected: value > 0
+
+echo "-- Testing strncmp() with double quoted string --\n";
var_dump( strncmp("Hello", "Hello", 5) ); //expected: int(0)
-var_dump( strncmp("Hello", "Hi", 5) ); //expected: int(-1)
-var_dump( strncmp("Hi", "Hello", 5) ); //expected: int(1)
+var_dump( strncmp("Hello", "Hi", 5) ); //expected: value < 0
+var_dump( strncmp("Hi", "Hello", 5) ); //expected: value > 0
+
+echo "-- Testing strncmp() with here-doc string --\n";
+$str = <<<HEREDOC
+Hello
+HEREDOC;
+var_dump( strncmp($str, "Hello", 5) ); //expected: int(0)
+var_dump( strncmp($str, "Hi", 5) ); //expected: value < 0
+var_dump( strncmp("Hi", $str, 5) ); //expected: value > 0
+
echo "*** Done ***";
?>
---EXPECTF--
-*** Test strncmp() function: basic functionality ***
-int(0)
-int(-1)
-int(1)
-*** Done ***
+--EXPECTREGEX--
+\*\*\* Testing strncmp\(\) function: basic functionality \*\*\*
+-- Testing strncmp\(\) with single quoted string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Testing strncmp\(\) with double quoted string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+-- Testing strncmp\(\) with here-doc string --
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+\*\*\* Done \*\*\*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strncmp_variation1.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/strings/strncmp_variation1.phpt
diff -u php-src/ext/standard/tests/strings/strncmp_variation1.phpt:1.1.2.1
php-src/ext/standard/tests/strings/strncmp_variation1.phpt:1.1.2.2
--- php-src/ext/standard/tests/strings/strncmp_variation1.phpt:1.1.2.1 Fri Sep
7 14:20:12 2007
+++ php-src/ext/standard/tests/strings/strncmp_variation1.phpt Sat Sep 15
07:29:55 2007
@@ -1,5 +1,5 @@
--TEST--
-Test strncmp() function: usage variations - different inputs(alphabet
characters)
+Test strncmp() function: usage variations - case-sensitivity
--FILE--
<?php
/* Prototype : int strncmp ( string $str1, string $str2, int $len );
@@ -9,127 +9,127 @@
/* Test strncmp() function with upper-case and lower-case alphabets as inputs
for 'str1' and 'str2' */
-echo "*** Test strncmp() function: with chars ***\n";
+echo "*** Test strncmp() function: with alphabets ***\n";
echo "-- Passing upper-case letters for 'str1' --\n";
for($ASCII = 65; $ASCII <= 90; $ASCII++) {
var_dump( strncmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing uppercase
letters with uppercase letters; exp: int(0)
- var_dump( strncmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing
uppercase letters with lowercase letters; exp: int(-1)
+ var_dump( strncmp( chr($ASCII), chr($ASCII + 32), 1 ) ); //comparing
uppercase letters with lowercase letters; exp: value < 0
}
echo "\n-- Passing lower-case letters for 'str1' --\n";
for($ASCII = 97; $ASCII <= 122; $ASCII++) {
var_dump( strncmp( chr($ASCII), chr($ASCII), 1 ) ); //comparing lowercase
letters with lowercase letters; exp: int(0)
- var_dump( strncmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing
lowercase letters with uppercase letters; exp: int(1)
+ var_dump( strncmp( chr($ASCII), chr($ASCII - 32), 1 ) ); //comparing
lowercase letters with uppercase letters; exp: value > 0
}
-echo "*** Done ***\n";
+echo "*** Done ***";
?>
---EXPECTF--
-*** Test strncmp() function: with chars ***
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with alphabets \*\*\*
-- Passing upper-case letters for 'str1' --
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
-int(0)
-int(-1)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
-- Passing lower-case letters for 'str1' --
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-int(0)
-int(1)
-*** Done ***
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+\*\*\* Done \*\*\*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strncmp_variation2.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/strings/strncmp_variation2.phpt
diff -u php-src/ext/standard/tests/strings/strncmp_variation2.phpt:1.1.2.1
php-src/ext/standard/tests/strings/strncmp_variation2.phpt:1.1.2.2
--- php-src/ext/standard/tests/strings/strncmp_variation2.phpt:1.1.2.1 Fri Sep
7 14:20:12 2007
+++ php-src/ext/standard/tests/strings/strncmp_variation2.phpt Sat Sep 15
07:29:55 2007
@@ -1,5 +1,5 @@
--TEST--
-Test strncmp() function: usage variations - different inputs(double quoted
strings)
+Test strncmp() function: usage variations - double quoted strings
--FILE--
<?php
/* Prototype : int strncmp ( string $str1, string $str2, int $len );
@@ -7,9 +7,9 @@
* Source code: Zend/zend_builtin_functions.c
*/
-/* Test strncmp() function with different strings for 'str1', 'str2' and
considering case sensitive */
+/* Test strncmp() function with double quoted strings for 'str1', 'str2' */
-echo "*** Test strncmp() function: with different input strings ***\n";
+echo "*** Test strncmp() function: with double quoted strings ***\n";
$strings = array(
"Hello, World",
"hello, world",
@@ -28,36 +28,36 @@
}
echo "*** Done ***\n";
?>
---EXPECTF--
-*** Test strncmp() function: with different input strings ***
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with double quoted strings \*\*\*
-- Iteration 1 --
-int(0)
-int(-1)
-int(1)
-int(-1)
-int(1)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
-- Iteration 2 --
-int(1)
-int(0)
-int(1)
-int(1)
-int(1)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
-- Iteration 3 --
-int(-1)
-int(-1)
-int(0)
-int(-1)
-int(-1)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
-- Iteration 4 --
-int(1)
-int(-1)
-int(1)
-int(0)
-int(1)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
-- Iteration 5 --
-int(-1)
-int(-1)
-int(1)
-int(-1)
-int(0)
-*** Done ***
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+\*\*\* Done \*\*\*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strncmp_variation3.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/strings/strncmp_variation3.phpt
diff -u php-src/ext/standard/tests/strings/strncmp_variation3.phpt:1.1.2.1
php-src/ext/standard/tests/strings/strncmp_variation3.phpt:1.1.2.2
--- php-src/ext/standard/tests/strings/strncmp_variation3.phpt:1.1.2.1 Fri Sep
7 14:20:12 2007
+++ php-src/ext/standard/tests/strings/strncmp_variation3.phpt Sat Sep 15
07:29:55 2007
@@ -7,7 +7,7 @@
* Source code: Zend/zend_builtin_functions.c
*/
-/* Test strncmp() with various nteger length values including zero and
considering case sensitive */
+/* Test strncmp() with various lengths */
echo "*** Test strncmp() function: with different lengths ***\n";
/* definitions of required variables */
@@ -20,20 +20,20 @@
}
echo "*** Done ***\n";
?>
---EXPECTF--
-*** Test strncmp() function: with different lengths ***
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(-1)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-int(0)
-*** Done ***
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with different lengths \*\*\*
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+int\(0\)
+\*\*\* Done \*\*\*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/strncmp_variation8.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/strings/strncmp_variation8.phpt
diff -u php-src/ext/standard/tests/strings/strncmp_variation8.phpt:1.1.2.1
php-src/ext/standard/tests/strings/strncmp_variation8.phpt:1.1.2.2
--- php-src/ext/standard/tests/strings/strncmp_variation8.phpt:1.1.2.1 Fri Sep
7 14:20:12 2007
+++ php-src/ext/standard/tests/strings/strncmp_variation8.phpt Sat Sep 15
07:29:55 2007
@@ -1,5 +1,5 @@
--TEST--
-Test strncmp() function: usage variations - different inputs(single quoted
strings)
+Test strncmp() function: usage variations - single quoted strings
--FILE--
<?php
/* Prototype : int strncmp ( string $str1, string $str2, int $len );
@@ -7,9 +7,9 @@
* Source code: Zend/zend_builtin_functions.c
*/
-/* Test strncmp() function with different strings for 'str1', 'str2' and
considering case sensitive */
+/* Test strncmp() function with single quoted strings for 'str1', 'str2' */
-echo "*** Test strncmp() function: with different input strings ***\n";
+echo "*** Test strncmp() function: with single quoted strings ***\n";
$strings = array(
'Hello, World',
'hello, world',
@@ -27,26 +27,26 @@
}
echo "*** Done ***\n";
?>
---EXPECTF--
-*** Test strncmp() function: with different input strings ***
+--EXPECTREGEX--
+\*\*\* Test strncmp\(\) function: with single quoted strings \*\*\*
-- Iteration 1 --
-int(0)
-int(-1)
-int(1)
-int(-1)
+int\(0\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
-- Iteration 2 --
-int(1)
-int(0)
-int(1)
-int(1)
+int\([1-9][0-9]*\)
+int\(0\)
+int\([1-9][0-9]*\)
+int\([1-9][0-9]*\)
-- Iteration 3 --
-int(-1)
-int(-1)
-int(0)
-int(-1)
+int\(-[1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\(0\)
+int\(-[1-9][0-9]*\)
-- Iteration 4 --
-int(2)
-int(-1)
-int(1)
-int(0)
-*** Done ***
+int\([1-9][0-9]*\)
+int\(-[1-9][0-9]*\)
+int\([1-9][0-9]*\)
+int\(0\)
+\*\*\* Done \*\*\*
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php