Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5963777
IntegerTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
IntegerTest.php
View Options
<?php
use
Eris\Generators
;
use
Eris\TestTrait
;
class
IntegerTest
extends
\PHPUnit\Framework\TestCase
{
use
TestTrait
;
public
function
testSumIsCommutative
()
{
$this
->
forAll
(
Generators
::
int
(),
Generators
::
int
()
)
->
then
(
function
(
$first
,
$second
)
{
$x
=
$first
+
$second
;
$y
=
$second
+
$first
;
$this
->
assertEquals
(
$x
,
$y
,
"Sum between {$first} and {$second} should be commutative"
);
});
}
public
function
testSumIsAssociative
()
{
$this
->
forAll
(
Generators
::
int
(),
Generators
::
neg
(),
Generators
::
pos
()
)
->
then
(
function
(
$first
,
$second
,
$third
)
{
$x
=
$first
+
(
$second
+
$third
);
$y
=
(
$first
+
$second
)
+
$third
;
$this
->
assertEquals
(
$x
,
$y
,
"Sum between {$first} and {$second} should be associative"
);
});
}
public
function
testByteData
()
{
$this
->
forAll
(
Generators
::
byte
()
)
->
then
(
function
(
$byte
)
{
$this
->
assertTrue
(
$byte
>=
0
&&
$byte
<=
255
,
"$byte is not a valid value for a byte"
);
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 09:51 (1 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
34/b9/e3ff224281fdc32ac9bf93c54796
Default Alt Text
IntegerTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment