@Test public void testIsPrefixZeroZero() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(0, null); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(0, null); Assert.assertFalse(first.isPrefixOf(second)); Assert.assertFalse(second.isPrefixOf(first)); }
@Test public void testIsPrefixZeroEight() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(0, null); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(8, new byte[] {(byte) 0xa8}); Assert.assertTrue(first.isPrefixOf(second)); Assert.assertFalse(second.isPrefixOf(first)); }
@Test public void testIsNoPrefixEightSixteen() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(8, new byte[] {(byte) 0xc0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(16, new byte[] {(byte) 0xc8, (byte) 0xa8}); Assert.assertFalse(first.isPrefixOf(second)); Assert.assertFalse(second.isPrefixOf(first)); }
@Test public void testIsPrefixFourFive() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(4, new byte[] {(byte) 0xa0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(5, new byte[] {(byte) 0xa8}); Assert.assertTrue(first.isPrefixOf(second)); Assert.assertFalse(second.isPrefixOf(first)); }
@Test public void testIsPrefixThirtyThirtytwo() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation( 30, new byte[] {(byte) 0xc8, (byte) 0xa8, 0x09, 0x04}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation( 32, new byte[] {(byte) 0xc8, (byte) 0xa8, 0x09, 0x07}); Assert.assertTrue(first.isPrefixOf(second)); Assert.assertFalse(second.isPrefixOf(first)); }