diff options
author | Sander Roobol <sander@php.net> | 2002-11-21 15:24:45 +0000 |
---|---|---|
committer | Sander Roobol <sander@php.net> | 2002-11-21 15:24:45 +0000 |
commit | f4ffead6faef29aae8409df08ce5125e9440a93c (patch) | |
tree | 3c5a8609062fcf0f66f79d8b0bd79120c98732d0 /ext | |
parent | 64e45b12879da2533e8e54cadbc1e25d91eb98fb (diff) | |
download | php-git-f4ffead6faef29aae8409df08ce5125e9440a93c.tar.gz |
Adding tests for the bcmath extension
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bcmath/tests/bcadd.phpt | 14 | ||||
-rw-r--r-- | ext/bcmath/tests/bccomp.phpt | 16 | ||||
-rw-r--r-- | ext/bcmath/tests/bcdiv.phpt | 16 | ||||
-rw-r--r-- | ext/bcmath/tests/bcmod.phpt | 14 | ||||
-rw-r--r-- | ext/bcmath/tests/bcmul.phpt | 16 | ||||
-rw-r--r-- | ext/bcmath/tests/bcpow.phpt | 14 | ||||
-rw-r--r-- | ext/bcmath/tests/bcscale.phpt | 19 | ||||
-rw-r--r-- | ext/bcmath/tests/bcsqrt.phpt | 12 | ||||
-rw-r--r-- | ext/bcmath/tests/bcsub.phpt | 14 |
9 files changed, 135 insertions, 0 deletions
diff --git a/ext/bcmath/tests/bcadd.phpt b/ext/bcmath/tests/bcadd.phpt new file mode 100644 index 0000000000..5713057032 --- /dev/null +++ b/ext/bcmath/tests/bcadd.phpt @@ -0,0 +1,14 @@ +--TEST-- +bcadd() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcadd("1", "2"),"\n"; +echo bcadd("-1", "5", 4),"\n"; +echo bcadd("1928372132132819737213", "8728932001983192837219398127471", 2),"\n"; +?> +--EXPECT-- +3 +4.0000 +8728932003911564969352217864684.00 diff --git a/ext/bcmath/tests/bccomp.phpt b/ext/bcmath/tests/bccomp.phpt new file mode 100644 index 0000000000..f1b389a140 --- /dev/null +++ b/ext/bcmath/tests/bccomp.phpt @@ -0,0 +1,16 @@ +--TEST-- +bccomp() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bccomp("-1", "5", 4),"\n"; +echo bccomp("1928372132132819737213", "8728932001983192837219398127471"),"\n"; +echo bccomp("1.00000000000000000001", "1", 2),"\n"; +echo bccomp("97321", "2321"),"\n"; +?> +--EXPECT-- +-1 +-1 +0 +1 diff --git a/ext/bcmath/tests/bcdiv.phpt b/ext/bcmath/tests/bcdiv.phpt new file mode 100644 index 0000000000..2bba262e00 --- /dev/null +++ b/ext/bcmath/tests/bcdiv.phpt @@ -0,0 +1,16 @@ +--TEST-- +bcdiv() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcdiv("1", "2"),"\n"; +echo bcdiv("1", "2", 2),"\n"; +echo bcdiv("-1", "5", 4),"\n"; +echo bcdiv("8728932001983192837219398127471", "1928372132132819737213", 2),"\n"; +?> +--EXPECT-- +0 +0.50 +-0.2000 +4526580661.75 diff --git a/ext/bcmath/tests/bcmod.phpt b/ext/bcmath/tests/bcmod.phpt new file mode 100644 index 0000000000..74bec5a8d8 --- /dev/null +++ b/ext/bcmath/tests/bcmod.phpt @@ -0,0 +1,14 @@ +--TEST-- +bcmod() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcmod("11", "2"),"\n"; +echo bcmod("-1", "5"),"\n"; +echo bcmod("8728932001983192837219398127471", "1928372132132819737213"),"\n"; +?> +--EXPECT-- +1 +-1 +1459434331351930289678 diff --git a/ext/bcmath/tests/bcmul.phpt b/ext/bcmath/tests/bcmul.phpt new file mode 100644 index 0000000000..76891f37e8 --- /dev/null +++ b/ext/bcmath/tests/bcmul.phpt @@ -0,0 +1,16 @@ +--TEST-- +bcmul() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcmul("1", "2"),"\n"; +echo bcmul("-3", "5"),"\n"; +echo bcmul("1234567890", "9876543210"),"\n"; +echo bcmul("2.5", "1.5", 2),"\n"; +?> +--EXPECT-- +2 +-15 +12193263111263526900 +3.75 diff --git a/ext/bcmath/tests/bcpow.phpt b/ext/bcmath/tests/bcpow.phpt new file mode 100644 index 0000000000..69ff171526 --- /dev/null +++ b/ext/bcmath/tests/bcpow.phpt @@ -0,0 +1,14 @@ +--TEST-- +bcpow() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcpow("1", "2"),"\n"; +echo bcpow("-2", "5", 4),"\n"; +echo bcpow("2", "64"),"\n"; +?> +--EXPECT-- +1 +-32 +18446744073709551616 diff --git a/ext/bcmath/tests/bcscale.phpt b/ext/bcmath/tests/bcscale.phpt new file mode 100644 index 0000000000..742c7adb9f --- /dev/null +++ b/ext/bcmath/tests/bcscale.phpt @@ -0,0 +1,19 @@ +--TEST-- +bcscale() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcadd("1", "2"),"\n"; +bcscale(2); +echo bcadd("1", "2"),"\n"; +bcscale(10); +echo bcadd("1", "2"),"\n"; +bcscale(0); +echo bcadd("1", "2"),"\n"; +?> +--EXPECT-- +3 +3.00 +3.0000000000 +3 diff --git a/ext/bcmath/tests/bcsqrt.phpt b/ext/bcmath/tests/bcsqrt.phpt new file mode 100644 index 0000000000..b9b243bc12 --- /dev/null +++ b/ext/bcmath/tests/bcsqrt.phpt @@ -0,0 +1,12 @@ +--TEST-- +bcsqrt() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcsqrt("9"),"\n"; +echo bcsqrt("1928372132132819737213", 5),"\n"; +?> +--EXPECT-- +3 +43913234134.28826 diff --git a/ext/bcmath/tests/bcsub.phpt b/ext/bcmath/tests/bcsub.phpt new file mode 100644 index 0000000000..918eaadb1d --- /dev/null +++ b/ext/bcmath/tests/bcsub.phpt @@ -0,0 +1,14 @@ +--TEST-- +bcsub() function +--SKIP-- +<?php if(!extension_loaded("bcmath")) print "skip"; ?> +--FILE-- +<?php +echo bcsub("1", "2"),"\n"; +echo bcsub("-1", "5", 4),"\n"; +echo bcsub("8728932001983192837219398127471", "1928372132132819737213", 2),"\n"; +?> +--EXPECT-- +-1 +-6.0000 +8728932000054820705086578390258.00 |