Skip to content

Commit a15c9a3

Browse files
author
Sander Roobol
committed
Added tests for pow()'ing with broken exponents and some additional test
for count()'ing arrays.
1 parent abb7905 commit a15c9a3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ext/standard/tests/array/count_recursive.phpt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ print "COUNT_RECURSIVE: should be 1, is ".count("string", COUNT_RECURSIVE)."\n";
2626
print "Testing various types with no second argument.\n";
2727
print "COUNT_NORMAL: should be 1, is ".count("string")."\n";
2828
print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n";
29+
30+
$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL),
31+
array(array(array(array(array(NULL))))));
32+
print "Testing really cool arrays ;)\n";
33+
print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n";
34+
print "COUNT_RECURSIVE: should be 13, is ".count($arr, COUNT_RECURSIVE)."\n";
2935
?>
3036
--EXPECT--
3137
Testing NULL...
@@ -42,4 +48,7 @@ COUNT_NORMAL: should be 1, is 1
4248
COUNT_RECURSIVE: should be 1, is 1
4349
Testing various types with no second argument.
4450
COUNT_NORMAL: should be 1, is 1
45-
COUNT_NORMAL: should be 2, is 2
51+
COUNT_NORMAL: should be 2, is 2
52+
Testing really cool arrays ;)
53+
COUNT_NORMAL: should be 3, is 3
54+
COUNT_RECURSIVE: should be 13, is 13

ext/standard/tests/math/pow.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ sqrt(2) ~== pow(2,1/2)
118118
1.0 === pow( 2.0, 0)
119119
2.0 === pow( 2.0, 1)
120120
4.0 === pow( 2.0, 2)
121+
2.0 === pow( 4, 0.5)
122+
2.0 === pow( 4.0, 0.5)
123+
3.0 === pow( 27, 1/3)
124+
3.0 === pow(27.0, 1/3)
125+
0.5 === pow( 4, -0.5)
126+
0.5 === pow( 4.0, -0.5)
121127
LONG_MAX-1 === pow(LONG_MAX-1,1)
122128
LONG_MIN+1 === pow(LONG_MIN+1,1)
123129
(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2)

0 commit comments

Comments
 (0)