Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7414963
ConstantGeneratorTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
935 B
Referenced Files
None
Subscribers
None
ConstantGeneratorTest.php
View Options
<?php
namespace
Eris\Generator
;
use
Eris\Random\RandomRange
;
use
Eris\Random\RandSource
;
class
ConstantGeneratorTest
extends
\PHPUnit\Framework\TestCase
{
/**
* @var int
*/
private
$size
;
/**
* @var RandomRange
*/
private
$rand
;
protected
function
setUp
():
void
{
$this
->
size
=
0
;
$this
->
rand
=
new
RandomRange
(
new
RandSource
());
}
public
function
testPicksAlwaysTheValue
():
void
{
$generator
=
new
ConstantGenerator
(
true
);
for
(
$i
=
0
;
$i
<
50
;
$i
++)
{
$this
->
assertTrue
(
$generator
(
$this
->
size
,
$this
->
rand
)->
unbox
());
}
}
public
function
testShrinkAlwaysToTheValue
():
void
{
$generator
=
new
ConstantGenerator
(
true
);
$element
=
$generator
(
$this
->
size
,
$this
->
rand
);
for
(
$i
=
0
;
$i
<
50
;
$i
++)
{
$this
->
assertTrue
(
$generator
->
shrink
(
$element
)->
unbox
());
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 01:55 (1 d, 13 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
83/52/2765a07f98e6505126b835cf3afd
Default Alt Text
ConstantGeneratorTest.php (935 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment