tony2001 Thu Nov 8 11:19:19 2007 UTC
Added files:
/php-src/ext/standard/tests/strings str_split_variation6_64bit.phpt
str_split_variation7_64bit.phpt
Modified files:
/php-src/ext/standard/tests/strings str_split_variation6.phpt
str_split_variation7.phpt
Log:
fix tests
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_split_variation6.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/strings/str_split_variation6.phpt
diff -u php-src/ext/standard/tests/strings/str_split_variation6.phpt:1.2
php-src/ext/standard/tests/strings/str_split_variation6.phpt:1.3
--- php-src/ext/standard/tests/strings/str_split_variation6.phpt:1.2 Fri Oct
5 18:20:57 2007
+++ php-src/ext/standard/tests/strings/str_split_variation6.phpt Thu Nov
8 11:19:19 2007
@@ -1,5 +1,9 @@
--TEST--
Test str_split() function : usage variations - different integer values for
'split_length' argument(Bug#42866)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
/* Prototype : array str_split(string $str [, int $split_length])
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_split_variation7.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/strings/str_split_variation7.phpt
diff -u php-src/ext/standard/tests/strings/str_split_variation7.phpt:1.2
php-src/ext/standard/tests/strings/str_split_variation7.phpt:1.3
--- php-src/ext/standard/tests/strings/str_split_variation7.phpt:1.2 Fri Oct
5 18:20:57 2007
+++ php-src/ext/standard/tests/strings/str_split_variation7.phpt Thu Nov
8 11:19:19 2007
@@ -1,5 +1,9 @@
--TEST--
Test str_split() function : usage variations - different integer values for
'split_length' with heredoc 'str'(Bug#42866)
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
--FILE--
<?php
/* Prototype : array str_split(string $str [, int $split_length])
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_split_variation6_64bit.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/str_split_variation6_64bit.phpt
+++ php-src/ext/standard/tests/strings/str_split_variation6_64bit.phpt
--TEST--
Test str_split() function : usage variations - different integer values for
'split_length' argument
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
/* Prototype : array str_split(string $str [, int $split_length])
* Description: Convert a string to an array. If split_length is
specified, break the string down into chunks each
split_length characters long.
* Source code: ext/standard/string.c
* Alias to functions: none
*/
/*
* passing different integer values for 'split_length' argument to str_split()
*/
echo "*** Testing str_split() : different intger values for 'split_length'
***\n";
//Initialise variables
$str = 'This is a string with 123 & escape char \t';
//different values for 'split_length'
$values = array (
0,
1,
-123, //negative integer
0234, //octal number
0x1A, //hexadecimal number
2147483647, //max positive integer number
2147483648, //max positive integer+1
-2147483648, //min negative integer
);
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
echo "-- Iteration ".($count + 1)." --\n";
var_dump( str_split($str, $values[$count]) );
}
echo "Done"
?>
--EXPECTF--
*** Testing str_split() : different intger values for 'split_length' ***
-- Iteration 1 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 2 --
array(42) {
[0]=>
string(1) "T"
[1]=>
string(1) "h"
[2]=>
string(1) "i"
[3]=>
string(1) "s"
[4]=>
string(1) " "
[5]=>
string(1) "i"
[6]=>
string(1) "s"
[7]=>
string(1) " "
[8]=>
string(1) "a"
[9]=>
string(1) " "
[10]=>
string(1) "s"
[11]=>
string(1) "t"
[12]=>
string(1) "r"
[13]=>
string(1) "i"
[14]=>
string(1) "n"
[15]=>
string(1) "g"
[16]=>
string(1) " "
[17]=>
string(1) "w"
[18]=>
string(1) "i"
[19]=>
string(1) "t"
[20]=>
string(1) "h"
[21]=>
string(1) " "
[22]=>
string(1) "1"
[23]=>
string(1) "2"
[24]=>
string(1) "3"
[25]=>
string(1) " "
[26]=>
string(1) "&"
[27]=>
string(1) " "
[28]=>
string(1) "e"
[29]=>
string(1) "s"
[30]=>
string(1) "c"
[31]=>
string(1) "a"
[32]=>
string(1) "p"
[33]=>
string(1) "e"
[34]=>
string(1) " "
[35]=>
string(1) "c"
[36]=>
string(1) "h"
[37]=>
string(1) "a"
[38]=>
string(1) "r"
[39]=>
string(1) " "
[40]=>
string(1) "\"
[41]=>
string(1) "t"
}
-- Iteration 3 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 4 --
array(1) {
[0]=>
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 5 --
array(2) {
[0]=>
string(26) "This is a string with 123 "
[1]=>
string(16) "& escape char \t"
}
-- Iteration 6 --
array(1) {
[0]=>
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 7 --
array(1) {
[0]=>
string(42) "This is a string with 123 & escape char \t"
}
-- Iteration 8 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
Done
--UEXPECTF--
*** Testing str_split() : different intger values for 'split_length' ***
-- Iteration 1 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 2 --
array(42) {
[0]=>
unicode(1) "T"
[1]=>
unicode(1) "h"
[2]=>
unicode(1) "i"
[3]=>
unicode(1) "s"
[4]=>
unicode(1) " "
[5]=>
unicode(1) "i"
[6]=>
unicode(1) "s"
[7]=>
unicode(1) " "
[8]=>
unicode(1) "a"
[9]=>
unicode(1) " "
[10]=>
unicode(1) "s"
[11]=>
unicode(1) "t"
[12]=>
unicode(1) "r"
[13]=>
unicode(1) "i"
[14]=>
unicode(1) "n"
[15]=>
unicode(1) "g"
[16]=>
unicode(1) " "
[17]=>
unicode(1) "w"
[18]=>
unicode(1) "i"
[19]=>
unicode(1) "t"
[20]=>
unicode(1) "h"
[21]=>
unicode(1) " "
[22]=>
unicode(1) "1"
[23]=>
unicode(1) "2"
[24]=>
unicode(1) "3"
[25]=>
unicode(1) " "
[26]=>
unicode(1) "&"
[27]=>
unicode(1) " "
[28]=>
unicode(1) "e"
[29]=>
unicode(1) "s"
[30]=>
unicode(1) "c"
[31]=>
unicode(1) "a"
[32]=>
unicode(1) "p"
[33]=>
unicode(1) "e"
[34]=>
unicode(1) " "
[35]=>
unicode(1) "c"
[36]=>
unicode(1) "h"
[37]=>
unicode(1) "a"
[38]=>
unicode(1) "r"
[39]=>
unicode(1) " "
[40]=>
unicode(1) "\"
[41]=>
unicode(1) "t"
}
-- Iteration 3 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 4 --
array(1) {
[0]=>
unicode(42) "This is a string with 123 & escape char \t"
}
-- Iteration 5 --
array(2) {
[0]=>
unicode(26) "This is a string with 123 "
[1]=>
unicode(16) "& escape char \t"
}
-- Iteration 6 --
array(1) {
[0]=>
unicode(42) "This is a string with 123 & escape char \t"
}
-- Iteration 7 --
array(1) {
[0]=>
unicode(42) "This is a string with 123 & escape char \t"
}
-- Iteration 8 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/str_split_variation7_64bit.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/str_split_variation7_64bit.phpt
+++ php-src/ext/standard/tests/strings/str_split_variation7_64bit.phpt
--TEST--
Test str_split() function : usage variations - different integer values for
'split_length' with heredoc 'str'
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
/* Prototype : array str_split(string $str [, int $split_length])
* Description: Convert a string to an array. If split_length is
specified, break the string down into chunks each
split_length characters long.
* Source code: ext/standard/string.c
* Alias to functions: none
*/
/*
* passing different integer values for 'split_length' and heredoc string as
'str' argument to str_split()
*/
echo "*** Testing str_split() : different intger values for 'split_length' with
heredoc 'str' ***\n";
//Initialise variables
$str = <<<EOT
string with 123,escape char \t.
EOT;
//different values for 'split_length'
$values = array (
0,
1,
-123, //negative integer
0234, //octal number
0x1A, //hexadecimal number
2147483647, //max positive integer number
2147483648, //max positive integer+1
-2147483648, //min negative integer
);
//loop through each element of $values for 'split_length'
for($count = 0; $count < count($values); $count++) {
echo "-- Iteration ".($count + 1)." --\n";
var_dump( str_split($str, $values[$count]) );
}
echo "Done"
?>
--EXPECTF--
*** Testing str_split() : different intger values for 'split_length' with
heredoc 'str' ***
-- Iteration 1 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 2 --
array(30) {
[0]=>
string(1) "s"
[1]=>
string(1) "t"
[2]=>
string(1) "r"
[3]=>
string(1) "i"
[4]=>
string(1) "n"
[5]=>
string(1) "g"
[6]=>
string(1) " "
[7]=>
string(1) "w"
[8]=>
string(1) "i"
[9]=>
string(1) "t"
[10]=>
string(1) "h"
[11]=>
string(1) " "
[12]=>
string(1) "1"
[13]=>
string(1) "2"
[14]=>
string(1) "3"
[15]=>
string(1) ","
[16]=>
string(1) "e"
[17]=>
string(1) "s"
[18]=>
string(1) "c"
[19]=>
string(1) "a"
[20]=>
string(1) "p"
[21]=>
string(1) "e"
[22]=>
string(1) " "
[23]=>
string(1) "c"
[24]=>
string(1) "h"
[25]=>
string(1) "a"
[26]=>
string(1) "r"
[27]=>
string(1) " "
[28]=>
string(1) " "
[29]=>
string(1) "."
}
-- Iteration 3 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 4 --
array(1) {
[0]=>
string(30) "string with 123,escape char ."
}
-- Iteration 5 --
array(2) {
[0]=>
string(26) "string with 123,escape cha"
[1]=>
string(4) "r ."
}
-- Iteration 6 --
array(1) {
[0]=>
string(30) "string with 123,escape char ."
}
-- Iteration 7 --
array(1) {
[0]=>
string(30) "string with 123,escape char ."
}
-- Iteration 8 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
Done
--UEXPECTF--
*** Testing str_split() : different intger values for 'split_length' with
heredoc 'str' ***
-- Iteration 1 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 2 --
array(30) {
[0]=>
unicode(1) "s"
[1]=>
unicode(1) "t"
[2]=>
unicode(1) "r"
[3]=>
unicode(1) "i"
[4]=>
unicode(1) "n"
[5]=>
unicode(1) "g"
[6]=>
unicode(1) " "
[7]=>
unicode(1) "w"
[8]=>
unicode(1) "i"
[9]=>
unicode(1) "t"
[10]=>
unicode(1) "h"
[11]=>
unicode(1) " "
[12]=>
unicode(1) "1"
[13]=>
unicode(1) "2"
[14]=>
unicode(1) "3"
[15]=>
unicode(1) ","
[16]=>
unicode(1) "e"
[17]=>
unicode(1) "s"
[18]=>
unicode(1) "c"
[19]=>
unicode(1) "a"
[20]=>
unicode(1) "p"
[21]=>
unicode(1) "e"
[22]=>
unicode(1) " "
[23]=>
unicode(1) "c"
[24]=>
unicode(1) "h"
[25]=>
unicode(1) "a"
[26]=>
unicode(1) "r"
[27]=>
unicode(1) " "
[28]=>
unicode(1) " "
[29]=>
unicode(1) "."
}
-- Iteration 3 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
-- Iteration 4 --
array(1) {
[0]=>
unicode(30) "string with 123,escape char ."
}
-- Iteration 5 --
array(2) {
[0]=>
unicode(26) "string with 123,escape cha"
[1]=>
unicode(4) "r ."
}
-- Iteration 6 --
array(1) {
[0]=>
unicode(30) "string with 123,escape char ."
}
-- Iteration 7 --
array(1) {
[0]=>
unicode(30) "string with 123,escape char ."
}
-- Iteration 8 --
Warning: str_split(): The length of each segment must be greater than zero in
%s on line %d
bool(false)
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php