summaryrefslogtreecommitdiff
path: root/ext/gmp/tests/012.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gmp/tests/012.phpt')
-rw-r--r--ext/gmp/tests/012.phpt42
1 files changed, 42 insertions, 0 deletions
diff --git a/ext/gmp/tests/012.phpt b/ext/gmp/tests/012.phpt
new file mode 100644
index 0000000000..ff60385bb7
--- /dev/null
+++ b/ext/gmp/tests/012.phpt
@@ -0,0 +1,42 @@
+--TEST--
+gmp_neg() basic tests
+--FILE--
+<?php
+
+var_dump(gmp_intval(gmp_neg(0)));
+var_dump(gmp_intval(gmp_neg(1)));
+var_dump(gmp_intval(gmp_neg(-1)));
+var_dump(gmp_intval(gmp_neg("-1")));
+var_dump(gmp_intval(gmp_neg("")));
+var_dump(gmp_intval(gmp_neg(0)));
+
+$n = gmp_init("0");
+var_dump(gmp_intval(gmp_neg($n)));
+$n = gmp_init("12345678901234567890");
+var_dump(gmp_strval(gmp_neg($n)));
+
+var_dump(gmp_neg(1,1));
+var_dump(gmp_neg());
+var_dump(gmp_neg(array()));
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(0)
+int(-1)
+int(1)
+int(1)
+int(0)
+int(0)
+int(0)
+string(21) "-12345678901234567890"
+
+Warning: Wrong parameter count for gmp_neg() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gmp_neg() in %s on line %d
+NULL
+
+Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d
+bool(false)
+Done