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