Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
13 / 13 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
| phpbb_wrapper_mt_rand_test | |
100.00% |
13 / 13 |
|
100.00% |
5 / 5 |
5 | |
100.00% |
1 / 1 |
| test_max_equals_min | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| test_max_equals_min_negative | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| test_max_greater_min | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| test_min_greater_max | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| test_min_greater_max_negative | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | class phpbb_wrapper_mt_rand_test extends phpbb_test_case |
| 15 | { |
| 16 | public function test_max_equals_min() |
| 17 | { |
| 18 | $result = phpbb_mt_rand(42, 42); |
| 19 | $this->assertEquals(42, $result); |
| 20 | } |
| 21 | |
| 22 | public function test_max_equals_min_negative() |
| 23 | { |
| 24 | $result = phpbb_mt_rand(-42, -42); |
| 25 | $this->assertEquals(-42, $result); |
| 26 | } |
| 27 | |
| 28 | public function test_max_greater_min() |
| 29 | { |
| 30 | $result = phpbb_mt_rand(3, 4); |
| 31 | $this->assertGreaterThanOrEqual(3, $result); |
| 32 | $this->assertLessThanOrEqual(4, $result); |
| 33 | } |
| 34 | |
| 35 | public function test_min_greater_max() |
| 36 | { |
| 37 | $result = phpbb_mt_rand(4, 3); |
| 38 | $this->assertGreaterThanOrEqual(3, $result); |
| 39 | $this->assertLessThanOrEqual(4, $result); |
| 40 | } |
| 41 | |
| 42 | public function test_min_greater_max_negative() |
| 43 | { |
| 44 | $result = phpbb_mt_rand(-3, -4); |
| 45 | $this->assertGreaterThanOrEqual(-4, $result); |
| 46 | $this->assertLessThanOrEqual(-3, $result); |
| 47 | } |
| 48 | } |