* the network and broadcast addresses in host counts
*/
public void testCidrAddresses() {
SubnetUtils utils = new SubnetUtils("192.168.0.1/8");
utils.setInclusiveHostCount(true);
SubnetInfo info = utils.getInfo();
assertEquals("255.0.0.0",info.getNetmask());
assertEquals(16777216, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/9");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.128.0.0",info.getNetmask());
assertEquals(8388608, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/10");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.192.0.0",info.getNetmask());
assertEquals(4194304, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/11");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.224.0.0",info.getNetmask());
assertEquals(2097152, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/12");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.240.0.0",info.getNetmask());
assertEquals(1048576, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/13");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.248.0.0",info.getNetmask());
assertEquals(524288, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/14");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.252.0.0",info.getNetmask());
assertEquals(262144, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/15");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.254.0.0",info.getNetmask());
assertEquals(131072, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/16");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.0.0",info.getNetmask());
assertEquals(65536, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/17");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.128.0",info.getNetmask());
assertEquals(32768, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/18");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.192.0",info.getNetmask());
assertEquals(16384, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/19");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.224.0",info.getNetmask());
assertEquals(8192, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/20");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.240.0",info.getNetmask());
assertEquals(4096, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/21");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.248.0",info.getNetmask());
assertEquals(2048, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/22");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.252.0",info.getNetmask());
assertEquals(1024, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/23");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.254.0",info.getNetmask());
assertEquals(512, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/24");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.0",info.getNetmask());
assertEquals(256, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/25");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.128",info.getNetmask());
assertEquals(128, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/26");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.192",info.getNetmask());
assertEquals(64, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/27");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.224",info.getNetmask());
assertEquals(32, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/28");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.240",info.getNetmask());
assertEquals(16, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/29");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.248",info.getNetmask());
assertEquals(8, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/30");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.252",info.getNetmask());
assertEquals(4, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/31");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.254",info.getNetmask());
assertEquals(2, info.getAddressCount());
utils = new SubnetUtils("192.168.0.1/32");
utils.setInclusiveHostCount(true);
info = utils.getInfo();
assertEquals("255.255.255.255",info.getNetmask());
assertEquals(1, info.getAddressCount());
new SubnetUtils("192.168.0.1/1");
}