ipaddresses : Add cidr2netmask method for IPv4 masks
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5989 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -396,6 +396,40 @@ class ipaddressesTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertSame (0, $res);
|
||||
}
|
||||
|
||||
public function test_cidr2netmask_1 ()
|
||||
{
|
||||
$i = new ipaddresses ();
|
||||
$res = $i->cidr2netmask (0, true);
|
||||
$this->assertSame ("0.0.0.0", $res);
|
||||
}
|
||||
|
||||
public function test_cidr2netmask_2 ()
|
||||
{
|
||||
$i = new ipaddresses ();
|
||||
$res = $i->cidr2netmask (24, true);
|
||||
$this->assertSame ("255.255.255.0", $res);
|
||||
}
|
||||
|
||||
public function test_cidr2netmask_3 ()
|
||||
{
|
||||
$i = new ipaddresses ();
|
||||
$res = $i->cidr2netmask (25, true);
|
||||
$this->assertSame ("255.255.255.128", $res);
|
||||
}
|
||||
|
||||
public function test_cidr2netmask_4 ()
|
||||
{
|
||||
$i = new ipaddresses ();
|
||||
$res = $i->cidr2netmask (32, true);
|
||||
$this->assertSame ("255.255.255.255", $res);
|
||||
}
|
||||
public function test_cidr2netmask_5 ()
|
||||
{
|
||||
$i = new ipaddresses ();
|
||||
$res = $i->cidr2netmask (1, true);
|
||||
$this->assertSame ("128.0.0.0", $res);
|
||||
}
|
||||
|
||||
public function test_ipInNetwork1 ()
|
||||
{
|
||||
$i = new ipaddresses ();
|
||||
|
||||
Reference in New Issue
Block a user