From 771afcbc0f188a8b3668ac51759cacefad90a733 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Wed, 14 Mar 2007 12:27:07 +0000 Subject: [PATCH] added testsuite for PMA_pow() --- test/AllTests.php | 3 ++- test/PMA_pow_test.php | 49 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 test/PMA_pow_test.php diff --git a/test/AllTests.php b/test/AllTests.php index c33bc38aa..7f2b28c33 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -20,6 +20,7 @@ require_once 'PHPUnit/TextUI/TestRunner.php'; require_once './test/FailTest.php'; require_once './test/PMA_get_real_size_test.php'; require_once './test/PMA_sanitize_test.php'; +require_once './test/PMA_pow_test.php'; class AllTests { @@ -35,7 +36,7 @@ class AllTests //$suite->addTestSuite('FailTest'); $suite->addTestSuite('PMA_get_real_size_test'); $suite->addTestSuite('PMA_sanitize_test'); - + $suite->addTestSuite('PMA_pow_test'); return $suite; } } diff --git a/test/PMA_pow_test.php b/test/PMA_pow_test.php new file mode 100644 index 000000000..893092cde --- /dev/null +++ b/test/PMA_pow_test.php @@ -0,0 +1,49 @@ +assertEquals('1267650600228229401496703205376', + PMA_pow(2, 100)); + } + + public function testBcpow() + { + if (function_exists('bcpow')) { + $this->assertEquals('1267650600228229401496703205376', + PMA_pow(2, 100, 'bcpow')); + } else { + $this->markTestSkipped('function bcpow() does not exist'); + } + } + + public function testGmppow() + { + if (function_exists('gmp_pow')) { + $this->assertEquals('1267650600228229401496703205376', + PMA_pow(2, 100, 'gmp_pow')); + } else { + $this->markTestSkipped('function gmp_pow() does not exist'); + } + } + + public function testNegativeExp() + { + $this->assertEquals(false, + PMA_pow(2, -1)); + } +} +?> \ No newline at end of file