Merge branch 'QA_3_3'
[phpmyadmin-regexreplace.git] / test / PMA_pow_test.php
blobcb62e528c600f4e4d8e640f10b1adb623c6ad4ab
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * tests for PMA_pow()
6 * @package phpMyAdmin-test
7 */
9 /**
12 require_once 'PHPUnit/Framework.php';
13 require_once './libraries/common.lib.php';
15 /**
16 * @package phpMyAdmin-test
18 class PMA_pow_test extends PHPUnit_Framework_TestCase
20 public function testIntOverflow()
22 $this->assertEquals('1267650600228229401496703205376',
23 PMA_pow(2, 100));
26 public function testBcpow()
28 if (function_exists('bcpow')) {
29 $this->assertEquals('1267650600228229401496703205376',
30 PMA_pow(2, 100, 'bcpow'));
31 } else {
32 $this->markTestSkipped('function bcpow() does not exist');
36 public function testGmppow()
38 if (function_exists('gmp_pow')) {
39 $this->assertEquals('1267650600228229401496703205376',
40 PMA_pow(2, 100, 'gmp_pow'));
41 } else {
42 $this->markTestSkipped('function gmp_pow() does not exist');
46 public function _testNegativeExp()
48 $this->assertEquals(0.25,
49 PMA_pow(2, -2));
52 public function _testNegativeExpPow()
54 if (function_exists('pow')) {
55 $this->assertEquals(0.25,
56 PMA_pow(2, -2, 'pow'));
57 } else {
58 $this->markTestSkipped('function pow() does not exist');
62 public function _testNegativeExpBcpow()
64 if (function_exists('bcpow')) {
65 $this->assertEquals(0.25,
66 PMA_pow(2, -2, 'bcpow'));
67 } else {
68 $this->markTestSkipped('function bcpow() does not exist');
72 public function _testNegativeExpGmppow()
74 if (function_exists('gmp_pow')) {
75 $this->assertEquals(0.25,
76 PMA_pow(2, -2, 'gmp_pow'));
77 } else {
78 $this->markTestSkipped('function gmp_pow() does not exist');