1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for PMA_pow()
*
* @version $Id$
* @package phpMyAdmin-test
*/
/**
*
*/
require_once 'PHPUnit/Framework.php';
require_once './libraries/common.lib.php';
/**
* @package phpMyAdmin-test
*/
class PMA_pow_test extends PHPUnit_Framework_TestCase
{
public function testIntOverflow()
{
$this->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(0.25,
PMA_pow(2, -2));
}
public function _testNegativeExpPow()
{
if (function_exists('pow')) {
$this->assertEquals(0.25,
PMA_pow(2, -2, 'pow'));
} else {
$this->markTestSkipped('function pow() does not exist');
}
}
public function _testNegativeExpBcpow()
{
if (function_exists('bcpow')) {
$this->assertEquals(0.25,
PMA_pow(2, -2, 'bcpow'));
} else {
$this->markTestSkipped('function bcpow() does not exist');
}
}
public function _testNegativeExpGmppow()
{
if (function_exists('gmp_pow')) {
$this->assertEquals(0.25,
PMA_pow(2, -2, 'gmp_pow'));
} else {
$this->markTestSkipped('function gmp_pow() does not exist');
}
}
}
?>
|