Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793802
IPv4RangeTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1003 B
Referenced Files
None
Subscribers
None
IPv4RangeTest.php
View Options
<?php
namespace
Keruald\OmniTools\Tests\Network
;
use
Keruald\OmniTools\Network\IPRange
;
use
PHPUnit\Framework\TestCase
;
class
IPv4RangeTest
extends
TestCase
{
/**
* @var IPRange
*/
protected
$range
;
///
/// Fixtures
///
protected
function
setUp
()
:
void
{
$this
->
range
=
IPRange
::
from
(
"216.66.0.0/18"
);
}
///
/// Tests
///
public
function
testGetBase
()
:
void
{
$this
->
assertEquals
(
"216.66.0.0"
,
$this
->
range
->
getBase
());
}
public
function
testGetNetworkBits
()
:
void
{
$this
->
assertEquals
(
18
,
$this
->
range
->
getNetworkBits
());
}
public
function
testCount
()
:
void
{
$this
->
assertEquals
(
14
,
$this
->
range
->
count
());
// 14 + 18 = 32 bits
}
public
function
testGetFirst
()
:
void
{
$this
->
assertEquals
(
"216.66.0.0"
,
$this
->
range
->
getFirst
());
}
public
function
testGetLast
()
:
void
{
$this
->
assertEquals
(
"216.66.63.255"
,
$this
->
range
->
getLast
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 22:47 (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2435492
Default Alt Text
IPv4RangeTest.php (1003 B)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment