From: Antony Dovgal Date: Sat, 28 Apr 2007 11:58:41 +0000 (+0000) Subject: add new tests X-Git-Tag: RELEASE_1_2_0~201 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ddd0dbd4ed6b95c1448d3a30be9ab8ece4d4ede4;p=php add new tests --- diff --git a/Zend/tests/add_001.phpt b/Zend/tests/add_001.phpt new file mode 100644 index 0000000000..b2e3475053 --- /dev/null +++ b/Zend/tests/add_001.phpt @@ -0,0 +1,115 @@ +--TEST-- +adding arrays +--FILE-- +"aaa",2,3); +$b = array(1,2,"a"=>"bbbbbb"); + +$c = $a + $b; +var_dump($c); + +$a += $b; +var_dump($c); + +$a += $a; +var_dump($c); + +echo "Done\n"; +?> +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + ["a"]=> + string(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +array(3) { + ["a"]=> + string(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +array(3) { + ["a"]=> + string(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +Done +--UEXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [u"a"]=> + unicode(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +array(3) { + [u"a"]=> + unicode(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +array(3) { + [u"a"]=> + unicode(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +Done diff --git a/Zend/tests/add_002.phpt b/Zend/tests/add_002.phpt new file mode 100644 index 0000000000..437ac9113a --- /dev/null +++ b/Zend/tests/add_002.phpt @@ -0,0 +1,19 @@ +--TEST-- +adding objects to arrays +--FILE-- +prop = "value"; + +$c = $a + $o; +var_dump($c); + +echo "Done\n"; +?> +--EXPECTF-- +Notice: Object of class stdClass could not be converted to int in %s on line %d + +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/add_003.phpt b/Zend/tests/add_003.phpt new file mode 100644 index 0000000000..4223af3f19 --- /dev/null +++ b/Zend/tests/add_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +adding arrays to objects +--FILE-- +prop = "value"; + +$c = $o + $a; +var_dump($c); + +echo "Done\n"; +?> +--EXPECTF-- +Notice: Object of class stdClass could not be converted to int in %s on line %d + +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/add_004.phpt b/Zend/tests/add_004.phpt new file mode 100644 index 0000000000..492ff31ba3 --- /dev/null +++ b/Zend/tests/add_004.phpt @@ -0,0 +1,14 @@ +--TEST-- +adding numbers to arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/add_005.phpt b/Zend/tests/add_005.phpt new file mode 100644 index 0000000000..7e9bc25d8f --- /dev/null +++ b/Zend/tests/add_005.phpt @@ -0,0 +1,22 @@ +--TEST-- +adding integers to doubles +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(2834756759.1231) +float(2834756759.1231) +Done diff --git a/Zend/tests/add_006.phpt b/Zend/tests/add_006.phpt new file mode 100644 index 0000000000..c3f127e9cf --- /dev/null +++ b/Zend/tests/add_006.phpt @@ -0,0 +1,47 @@ +--TEST-- +adding numbers to strings +--FILE-- + +--EXPECTF-- +int(75636) +int(951858) +int(48550510) +float(75661.68) +int(75636) +int(951858) +int(48550510) +float(75661.68) +Done diff --git a/Zend/tests/add_007.phpt b/Zend/tests/add_007.phpt new file mode 100644 index 0000000000..b2f1559b7a --- /dev/null +++ b/Zend/tests/add_007.phpt @@ -0,0 +1,16 @@ +--TEST-- +adding strings to arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/and_001.phpt b/Zend/tests/and_001.phpt new file mode 100644 index 0000000000..109b2ce995 --- /dev/null +++ b/Zend/tests/and_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +bitwise AND and strings +--FILE-- + +--EXPECTF-- +string(3) "020" +string(4) "pead" +string(4) "pead" +string(4) "pead" +string(4) "pead" +Done diff --git a/Zend/tests/concat_001.phpt b/Zend/tests/concat_001.phpt new file mode 100644 index 0000000000..93c167a5d7 --- /dev/null +++ b/Zend/tests/concat_001.phpt @@ -0,0 +1,143 @@ +--TEST-- +concat difffent types +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +Notice: Array to string conversion in %s on line %d +string(24) "Arraythis is test object" + +Notice: Array to string conversion in %s on line %d +string(16) "Arraysome string" + +Notice: Array to string conversion in %s on line %d +string(8) "Array222" + +Notice: Array to string conversion in %s on line %d +string(13) "Array2323.444" + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(10) "ArrayArray" + +Notice: Array to string conversion in %s on line %d +string(24) "this is test objectArray" +string(30) "this is test objectsome string" +string(22) "this is test object222" +string(27) "this is test object2323.444" +string(38) "this is test objectthis is test object" +string(30) "some stringthis is test object" + +Notice: Array to string conversion in %s on line %d +string(16) "some stringArray" +string(14) "some string222" +string(19) "some string2323.444" +string(22) "some stringsome string" + +Notice: Array to string conversion in %s on line %d +string(8) "222Array" +string(22) "222this is test object" +string(14) "222some string" +string(11) "2222323.444" +string(6) "222222" + +Notice: Array to string conversion in %s on line %d +string(13) "2323.444Array" +string(27) "2323.444this is test object" +string(19) "2323.444some string" +string(11) "2323.444222" +string(16) "2323.4442323.444" +Done +--UEXPECTF-- +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 15 +unicode(24) "Arraythis is test object" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 16 +unicode(16) "Arraysome string" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 17 +unicode(8) "Array222" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 18 +unicode(13) "Array2323.444" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 19 + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 19 +unicode(10) "ArrayArray" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 21 +unicode(24) "this is test objectArray" +unicode(30) "this is test objectsome string" +unicode(22) "this is test object222" +unicode(27) "this is test object2323.444" +unicode(38) "this is test objectthis is test object" +unicode(30) "some stringthis is test object" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 28 +unicode(16) "some stringArray" +unicode(14) "some string222" +unicode(19) "some string2323.444" +unicode(22) "some stringsome string" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 33 +unicode(8) "222Array" +unicode(22) "222this is test object" +unicode(14) "222some string" +unicode(11) "2222323.444" +unicode(6) "222222" + +Notice: Array to string conversion in /local/dev/php/head/Zend/tests/concat_001.php on line 39 +unicode(13) "2323.444Array" +unicode(27) "2323.444this is test object" +unicode(19) "2323.444some string" +unicode(11) "2323.444222" +unicode(16) "2323.4442323.444" +Done diff --git a/Zend/tests/div_001.phpt b/Zend/tests/div_001.phpt new file mode 100644 index 0000000000..5fa264a11e --- /dev/null +++ b/Zend/tests/div_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +dividing doubles +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(394758.39454545) +float(394758.39454545) +float(394758.39454545) +Done diff --git a/Zend/tests/div_002.phpt b/Zend/tests/div_002.phpt new file mode 100644 index 0000000000..6ade1d9f51 --- /dev/null +++ b/Zend/tests/div_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +dividing arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt new file mode 100644 index 0000000000..88596f3d5f --- /dev/null +++ b/Zend/tests/mod_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +modulus by zero +--FILE-- + +--EXPECTF-- +Warning: Division by zero in %s on line %d +bool(false) +Done diff --git a/Zend/tests/mul_001.phpt b/Zend/tests/mul_001.phpt new file mode 100644 index 0000000000..4c5a75e7d1 --- /dev/null +++ b/Zend/tests/mul_001.phpt @@ -0,0 +1,15 @@ +--TEST-- +multiplying arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/not_001.phpt b/Zend/tests/not_001.phpt new file mode 100644 index 0000000000..6eb0f000c9 --- /dev/null +++ b/Zend/tests/not_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +bitwise NOT, doubles and strings +--FILE-- + +--EXPECTF-- +int(-24) +string(8) "8c90929a" +Done diff --git a/Zend/tests/not_002.phpt b/Zend/tests/not_002.phpt new file mode 100644 index 0000000000..df27772a73 --- /dev/null +++ b/Zend/tests/not_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +bitwise NOT and arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/or_001.phpt b/Zend/tests/or_001.phpt new file mode 100644 index 0000000000..1e4e5131a5 --- /dev/null +++ b/Zend/tests/or_001.phpt @@ -0,0 +1,29 @@ +--TEST-- +bitwise OR and strings +--FILE-- + +--EXPECTF-- +string(8) "3337>755" +string(8) "3337>755" +string(4) "wou" +string(4) "wou" +Done diff --git a/Zend/tests/shift_001.phpt b/Zend/tests/shift_001.phpt new file mode 100644 index 0000000000..aeb399452d --- /dev/null +++ b/Zend/tests/shift_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +shifting strings left +--FILE-- + +--EXPECTF-- +int(492) +int(0) +int(362760) +Done diff --git a/Zend/tests/shift_002.phpt b/Zend/tests/shift_002.phpt new file mode 100644 index 0000000000..4d8421a566 --- /dev/null +++ b/Zend/tests/shift_002.phpt @@ -0,0 +1,25 @@ +--TEST-- +shifting strings right +--FILE-- +>= 2; +var_dump($s); + +$s1 >>= 1; +var_dump($s1); + +$s2 >>= 3; +var_dump($s2); + +echo "Done\n"; +?> +--EXPECTF-- +int(30) +int(0) +int(5668) +Done diff --git a/Zend/tests/sub_001.phpt b/Zend/tests/sub_001.phpt new file mode 100644 index 0000000000..2a8b3cdffd --- /dev/null +++ b/Zend/tests/sub_001.phpt @@ -0,0 +1,15 @@ +--TEST-- +subtracting arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/Zend/tests/xor_001.phpt b/Zend/tests/xor_001.phpt new file mode 100644 index 0000000000..e1a521dff9 --- /dev/null +++ b/Zend/tests/xor_001.phpt @@ -0,0 +1,16 @@ +--TEST-- +XORing arrays +--FILE-- + +--EXPECTF-- +int(1) +Done diff --git a/Zend/tests/xor_002.phpt b/Zend/tests/xor_002.phpt new file mode 100644 index 0000000000..0cf4054fa4 --- /dev/null +++ b/Zend/tests/xor_002.phpt @@ -0,0 +1,39 @@ +--TEST-- +XORing strings +--FILE-- + +--EXPECTF-- +string(6) "030107" +string(6) "030107" +string(8) "070a1e11" +string(8) "070a1e11" +string(8) "070a1e11" +string(8) "070a1e11" +Done diff --git a/Zend/tests/xor_003.phpt b/Zend/tests/xor_003.phpt new file mode 100644 index 0000000000..8aa1c636b7 --- /dev/null +++ b/Zend/tests/xor_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +XORing booleans +--FILE-- + +--EXPECTF-- +int(1) +int(0) +int(0) +Done