]> granicus.if.org Git - php/commitdiff
Make math tests pass, round & co don't work this way, and there was an error
authorJeroen van Wolffelaar <jeroen@php.net>
Mon, 22 Oct 2001 09:44:27 +0000 (09:44 +0000)
committerJeroen van Wolffelaar <jeroen@php.net>
Mon, 22 Oct 2001 09:44:27 +0000 (09:44 +0000)
in expected output

ext/standard/tests/math/001.phpt [deleted file]
ext/standard/tests/math/abs.phpt [new file with mode: 0644]
ext/standard/tests/math/pow.phpt
ext/standard/tests/math/round.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/math/001.phpt b/ext/standard/tests/math/001.phpt
deleted file mode 100644 (file)
index a79d32c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-Simple math tests
---POST--
---GET--
---FILE--
-<?php 
-
-define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
-define('LONG_MIN', -LONG_MAX - 1);
-printf("%d,%d,%d,%d\n",is_int(LONG_MIN  ),is_int(LONG_MAX  ),
-                                          is_int(LONG_MIN-1),is_int(LONG_MAX+1));
-
-$tests = <<<TESTS
- 1   === abs(-1)
- 1.5 === abs(-1.5)
- 1   === abs("-1")
- 1.5 === abs("-1.5")
--LONG_MIN+1 === abs(LONG_MIN-1)
--LONG_MIN   === abs(LONG_MIN)
--(LONG_MIN+1) === abs(LONG_MIN+1)
--1 === ceil(-1.5)
- 2 === ceil( 1.5)
--2 === floor(-1.5)
- 1 === floor(1.5)
- LONG_MIN   === ceil(LONG_MIN - 0.5)
- LONG_MIN+1 === ceil(LONG_MIN + 0.5)
- LONG_MIN-1 === round(LONG_MIN - 0.6)
- LONG_MIN   === round(LONG_MIN - 0.4)
- LONG_MIN   === round(LONG_MIN + 0.4)
- LONG_MIN+1 === round(LONG_MIN + 0.6)
- LONG_MIN-1 === floor(LONG_MIN - 0.5)
- LONG_MIN   === floor(LONG_MIN + 0.5)
- LONG_MAX   === ceil(LONG_MAX - 0.5)
- LONG_MAX+1 === ceil(LONG_MAX + 0.5)
- LONG_MAX-1 === round(LONG_MAX - 0.6)
- LONG_MAX   === round(LONG_MAX - 0.4)
- LONG_MAX   === round(LONG_MAX + 0.4)
- LONG_MAX+1 === round(LONG_MAX + 0.6)
- LONG_MAX-1 === floor(LONG_MAX - 0.5)
- LONG_MAX   === floor(LONG_MAX + 0.5)
-TESTS;
-
-include('../../../../tests/quicktester.inc');
---EXPECT--
-OK
diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt
new file mode 100644 (file)
index 0000000..b5ffff3
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+Simple math tests
+--POST--
+--GET--
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN  ),is_int(LONG_MAX  ),
+                                          is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+ 1   === abs(-1)
+ 1.5 === abs(-1.5)
+ 1   === abs("-1")
+ 1.5 === abs("-1.5")
+-LONG_MIN+1 === abs(LONG_MIN-1)
+-LONG_MIN   === abs(LONG_MIN)
+-(LONG_MIN+1) === abs(LONG_MIN+1)
+TESTS;
+
+include('../../../../tests/quicktester.inc');
+--EXPECT--
+1,1,0,0
+OK
index efaf500521b4e0516e0a6fcb569e6f91d4634b2a..40b7151c3e7218615c36f99671f0832636f8d3ea 100644 (file)
@@ -3,7 +3,8 @@ Various pow() tests
 --POST--
 --GET--
 --FILE--
-<?php 
+<?php // $Id$
+
 define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
 define('LONG_MIN', -LONG_MAX - 1);
 printf("%d,%d,%d,%d\n",is_int(LONG_MIN  ),is_int(LONG_MAX  ),
diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt
new file mode 100644 (file)
index 0000000..bfb9750
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+Simple math tests
+--POST--
+--GET--
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN  ),is_int(LONG_MAX  ),
+                                          is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+-1 ~== ceil(-1.5)
+ 2 ~== ceil( 1.5)
+-2 ~== floor(-1.5)
+ 1 ~== floor(1.5)
+ LONG_MIN   ~== ceil(LONG_MIN - 0.5)
+ LONG_MIN+1 ~== ceil(LONG_MIN + 0.5)
+ LONG_MIN-1 ~== round(LONG_MIN - 0.6)
+ LONG_MIN   ~== round(LONG_MIN - 0.4)
+ LONG_MIN   ~== round(LONG_MIN + 0.4)
+ LONG_MIN+1 ~== round(LONG_MIN + 0.6)
+ LONG_MIN-1 ~== floor(LONG_MIN - 0.5)
+ LONG_MIN   ~== floor(LONG_MIN + 0.5)
+ LONG_MAX   ~== ceil(LONG_MAX - 0.5)
+ LONG_MAX+1 ~== ceil(LONG_MAX + 0.5)
+ LONG_MAX-1 ~== round(LONG_MAX - 0.6)
+ LONG_MAX   ~== round(LONG_MAX - 0.4)
+ LONG_MAX   ~== round(LONG_MAX + 0.4)
+ LONG_MAX+1 ~== round(LONG_MAX + 0.6)
+ LONG_MAX-1 ~== floor(LONG_MAX - 0.5)
+ LONG_MAX   ~== floor(LONG_MAX + 0.5)
+TESTS;
+
+include('../../../../tests/quicktester.inc');
+--EXPECT--
+1,1,0,0
+OK