]> granicus.if.org Git - php/commitdiff
MFH: more tests for pow() and count()
authorSander Roobol <sander@php.net>
Thu, 21 Mar 2002 14:23:24 +0000 (14:23 +0000)
committerSander Roobol <sander@php.net>
Thu, 21 Mar 2002 14:23:24 +0000 (14:23 +0000)
ext/standard/tests/array/count_recursive.phpt
ext/standard/tests/math/pow.phpt

index a6b7ee4afa6923262dd4d75d86dfd9d59941415a..1dcd845eaab8631905423358e7a970a1a363f460 100644 (file)
@@ -26,6 +26,12 @@ print "COUNT_RECURSIVE: should be 1, is ".count("string", COUNT_RECURSIVE)."\n";
 print "Testing various types with no second argument.\n";
 print "COUNT_NORMAL: should be 1, is ".count("string")."\n";
 print "COUNT_NORMAL: should be 2, is ".count(array("a", array("b")))."\n";
+
+$arr = array('a'=>array(NULL, NULL, NULL), 1=>array(NULL=>1, 1=>NULL),
+       array(array(array(array(array(NULL))))));
+print "Testing really cool arrays ;)\n";
+print "COUNT_NORMAL: should be 3, is ".count($arr, COUNT_NORMAL)."\n";
+print "COUNT_RECURSIVE: should be 13, is ".count($arr, COUNT_RECURSIVE)."\n";
 ?>
 --EXPECT--
 Testing NULL...
@@ -42,4 +48,7 @@ COUNT_NORMAL: should be 1, is 1
 COUNT_RECURSIVE: should be 1, is 1
 Testing various types with no second argument.
 COUNT_NORMAL: should be 1, is 1
-COUNT_NORMAL: should be 2, is 2 
+COUNT_NORMAL: should be 2, is 2
+Testing really cool arrays ;)
+COUNT_NORMAL: should be 3, is 3
+COUNT_RECURSIVE: should be 13, is 13
index 3a79a24ef63cca2705591d88f0526d2bc47aaaab..12170f4f3a1981d96fc9cfff167adc556b3fc8d0 100644 (file)
@@ -118,6 +118,12 @@ sqrt(2) ~== pow(2,1/2)
  1.0  === pow( 2.0, 0)
  2.0  === pow( 2.0, 1)
  4.0  === pow( 2.0, 2)
+ 2.0  === pow(   4, 0.5)
+ 2.0  === pow( 4.0, 0.5)
+ 3.0  === pow(  27, 1/3)
+ 3.0  === pow(27.0, 1/3)
+ 0.5  === pow(   4, -0.5)
+ 0.5  === pow( 4.0, -0.5)
 LONG_MAX-1 === pow(LONG_MAX-1,1)
 LONG_MIN+1 === pow(LONG_MIN+1,1)
 (LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2)