2011-03-05 22:16:50 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package testing
|
|
|
|
* @copyright (c) 2011 phpBB Group
|
2011-12-31 16:05:02 +00:00
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
2011-03-05 22:16:50 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
|
|
|
|
2011-07-13 00:49:48 +02:00
|
|
|
class phpbb_wrapper_mt_rand_test extends phpbb_test_case
|
2011-03-05 22:16:50 +01:00
|
|
|
{
|
|
|
|
public function test_max_equals_min()
|
|
|
|
{
|
|
|
|
$result = phpbb_mt_rand(42, 42);
|
|
|
|
$this->assertEquals(42, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_max_equals_min_negative()
|
|
|
|
{
|
|
|
|
$result = phpbb_mt_rand(-42, -42);
|
|
|
|
$this->assertEquals(-42, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_max_greater_min()
|
|
|
|
{
|
|
|
|
$result = phpbb_mt_rand(3, 4);
|
|
|
|
$this->assertGreaterThanOrEqual(3, $result);
|
|
|
|
$this->assertLessThanOrEqual(4, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_min_greater_max()
|
|
|
|
{
|
|
|
|
$result = phpbb_mt_rand(4, 3);
|
|
|
|
$this->assertGreaterThanOrEqual(3, $result);
|
|
|
|
$this->assertLessThanOrEqual(4, $result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test_min_greater_max_negative()
|
|
|
|
{
|
|
|
|
$result = phpbb_mt_rand(-3, -4);
|
|
|
|
$this->assertGreaterThanOrEqual(-4, $result);
|
|
|
|
$this->assertLessThanOrEqual(-3, $result);
|
|
|
|
}
|
|
|
|
}
|