@Test public void testZeroZero() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(0, null); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(0, null); Assert.assertEquals(0, first.compareTo(second)); }
@Test public void testNonZeroZero() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation( 20, new byte[] {(byte) 0xc0, (byte) 0xc0, (byte) 0xc0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(0, null); Assert.assertEquals(1, first.compareTo(second)); }
@Test public void testCompareGreaterThirteenTwelveBits() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(13, new byte[] {(byte) 0xc0, (byte) 0xc0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(12, new byte[] {(byte) 0xc0, (byte) 0xc0}); Assert.assertEquals(1, first.compareTo(second)); }
@Test public void testCompareGreaterFiveForBits() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(5, new byte[] {(byte) 0xc0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(4, new byte[] {(byte) 0xc0}); Assert.assertEquals(1, first.compareTo(second)); }
@Test public void testCompareSmallerTwelveBitsSecond() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(12, new byte[] {(byte) 0xc0, (byte) 0x00}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(12, new byte[] {(byte) 0xc0, (byte) 0xd0}); Assert.assertEquals(-1, first.compareTo(second)); }
@Test public void testCompareEqualsSmallerBits() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation(4, new byte[] {(byte) 0xc0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation(4, new byte[] {(byte) 0xd0}); Assert.assertEquals(-1, first.compareTo(second)); }
@Test public void testCompareGreaterTwentyoneTwentyBits() { NetworkLayerReachabilityInformation first = new NetworkLayerReachabilityInformation( 21, new byte[] {(byte) 0xc0, (byte) 0xc0, (byte) 0xc0}); NetworkLayerReachabilityInformation second = new NetworkLayerReachabilityInformation( 20, new byte[] {(byte) 0xc0, (byte) 0xc0, (byte) 0xc0}); Assert.assertEquals(1, first.compareTo(second)); }