Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4140069
SizeTest.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
SizeTest.php
View Options
<?php
namespace
Eris\Quantifier
;
class
SizeTest
extends
\PHPUnit\Framework\TestCase
{
public
function
testProducesAListOfSizesIncreasingThemTriangularly
()
{
$size
=
Size
::
withTriangleGrowth
(
1000
);
$this
->
assertEquals
(
0
,
$size
->
at
(
0
));
$this
->
assertEquals
(
1
,
$size
->
at
(
1
));
$this
->
assertEquals
(
3
,
$size
->
at
(
2
));
$this
->
assertEquals
(
6
,
$size
->
at
(
3
));
$this
->
assertEquals
(
10
,
$size
->
at
(
4
));
}
public
function
testCyclesThroughAvailableSizesWhenTheyAreFinished
()
{
$size
=
Size
::
withTriangleGrowth
(
1000
);
\Eris\PHPUnitDeprecationHelper
::
assertIsInt
(
$size
->
at
(
42000
));
}
public
function
testAllowsLinearGrowth
()
{
$size
=
Size
::
withLinearGrowth
(
1000
);
$this
->
assertEquals
(
0
,
$size
->
at
(
0
));
$this
->
assertEquals
(
1
,
$size
->
at
(
1
));
$this
->
assertEquals
(
2
,
$size
->
at
(
2
));
$this
->
assertEquals
(
3
,
$size
->
at
(
3
));
$this
->
assertEquals
(
4
,
$size
->
at
(
4
));
}
public
static
function
limits
()
{
return
[
[
2
],
[
5
],
[
10
],
[
20
],
[
100
],
[
10000
],
];
}
/**
* @dataProvider limits
*/
public
function
testCoversAUniformSubsetWhenLimitedToTheNumberOfIterations
(
$limit
)
{
$size
=
Size
::
withTriangleGrowth
(
1000
)
->
limit
(
$limit
);
$this
->
assertEquals
(
$limit
,
count
(
$size
));
$this
->
assertEquals
(
0
,
$size
->
at
(
0
));
$this
->
assertEquals
(
990
,
$size
->
at
(
$limit
-
1
));
$this
->
assertEquals
(
0
,
$size
->
at
(
$limit
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 15:19 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2f/18/45724152758f68f6ea8b7b89d2b6
Default Alt Text
SizeTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment