home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / phpMyAdmin / test / PMA_pow_test.php < prev    next >
Encoding:
PHP Script  |  2008-06-23  |  2.0 KB  |  80 lines

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