From a117e6b93740e1c05ba8926c3f8938a9ad0cb631 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 11 Mar 2014 13:28:26 +0100 Subject: [PATCH] Add tests for bug #66872 and gmp_[rem]root --- ext/gmp/tests/041.phpt | 147 ++++++++++++++++++++++++++++++++++++ ext/gmp/tests/bug66872.phpt | 11 +++ 2 files changed, 158 insertions(+) create mode 100644 ext/gmp/tests/041.phpt create mode 100644 ext/gmp/tests/bug66872.phpt diff --git a/ext/gmp/tests/041.phpt b/ext/gmp/tests/041.phpt new file mode 100644 index 0000000000..6e6d959288 --- /dev/null +++ b/ext/gmp/tests/041.phpt @@ -0,0 +1,147 @@ +--TEST-- +gmp_root() and gmp_rootrem() basic tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +object(GMP)#%d (1) { + ["num"]=> + string(2) "10" +} +object(GMP)#%d (1) { + ["num"]=> + string(1) "4" +} +object(GMP)#%d (1) { + ["num"]=> + string(2) "-4" +} +object(GMP)#%d (1) { + ["num"]=> + string(1) "5" +} +object(GMP)#%d (1) { + ["num"]=> + string(1) "3" +} + +Warning: gmp_root(): Can't take even root of negative number in %s on line %d +bool(false) +object(GMP)#%d (1) { + ["num"]=> + string(1) "0" +} + +Warning: gmp_root(): The root must be positive in %s on line %d +bool(false) + +Warning: gmp_root(): The root must be positive in %s on line %d +bool(false) +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "10" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "0" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "4" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "36" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "-4" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "36" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "5" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(3) "375" + } +} +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "3" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(2) "19" + } +} + +Warning: gmp_rootrem(): Can't take even root of negative number in %s on line %d +bool(false) +array(2) { + [0]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "0" + } + [1]=> + object(GMP)#%d (1) { + ["num"]=> + string(1) "0" + } +} + +Warning: gmp_rootrem(): The root must be positive in %s on line %d +bool(false) + +Warning: gmp_rootrem(): The root must be positive in %s on line %d +bool(false) diff --git a/ext/gmp/tests/bug66872.phpt b/ext/gmp/tests/bug66872.phpt new file mode 100644 index 0000000000..715b7bae55 --- /dev/null +++ b/ext/gmp/tests/bug66872.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #66872: Crash when passing string to gmp_testbit +--FILE-- + +--EXPECTF-- +Warning: gmp_testbit(): Unable to convert variable to GMP - string is not an integer in %s on line %d +bool(false) -- 2.50.1