summaryrefslogtreecommitdiff
path: root/ext/gmp
diff options
context:
space:
mode:
authorSean Bright <elixer@php.net>2002-02-10 23:13:37 +0000
committerSean Bright <elixer@php.net>2002-02-10 23:13:37 +0000
commit72c5a9cd8aeb4eedda33e1e88c7ce6517430feee (patch)
treeb23475104cefb1d31ff273386ad42c1c5495aa71 /ext/gmp
parentcc065b33514a3ef6533de6b5406db954a5f4b9c4 (diff)
downloadphp-git-72c5a9cd8aeb4eedda33e1e88c7ce6517430feee.tar.gz
Add a new test for GMP base recognition.
Diffstat (limited to 'ext/gmp')
-rw-r--r--ext/gmp/tests/003.phpt49
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/gmp/tests/003.phpt b/ext/gmp/tests/003.phpt
new file mode 100644
index 0000000000..0a302573ee
--- /dev/null
+++ b/ext/gmp/tests/003.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Check for number base recognition
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
+--POST--
+--GET--
+--FILE--
+<?php
+ /* Binary */
+ $test[] = gmp_init("0b10011010010");
+ $test[] = gmp_init("0b10011010010", 2);
+ $test[] = gmp_init("10011010010");
+ $test[] = gmp_init("10011010010", 2);
+
+ /* Octal */
+ $test[] = gmp_init("02322");
+ $test[] = gmp_init("02322", 8);
+ $test[] = gmp_init("2322");
+ $test[] = gmp_init("2322", 8);
+
+ /* Decimal */
+ $test[] = gmp_init("1234");
+ $test[] = gmp_init("1234", 10);
+
+ /* Hexidecimal */
+ $test[] = gmp_init("0x4d2");
+ $test[] = gmp_init("0x4d2", 16);
+ $test[] = gmp_init("4d2");
+ $test[] = gmp_init("4d2", 16);
+
+ for ($i = 0; $i < count($test); $i++) {
+ printf("%s\n", gmp_strval($test[$i]));
+ }
+?>
+--EXPECT--
+1234
+1234
+10011010010
+1234
+1234
+1234
+2322
+1234
+1234
+1234
+1234
+1234
+0
+1234