-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use RFC5952 canonical form for IPv6 addresses in WARC-IP-Address
Per suggestion in iipc/warc-specifications#100
- Loading branch information
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.netpreserve.jwarc; | ||
|
||
import org.junit.Test; | ||
|
||
import java.net.Inet6Address; | ||
import java.net.InetAddress; | ||
|
||
import static org.junit.Assert.*; | ||
import static org.netpreserve.jwarc.InetAddresses.canonicalInet6; | ||
|
||
public class InetAddressesTest { | ||
@Test | ||
public void testCanonicalInet6() throws Exception { | ||
assertEquals("2001:db8::1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("2001:db8:0:0:0:0:0:1"))); | ||
assertEquals("::", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("0:0:0:0:0:0:0:0"))); | ||
assertEquals("::1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("0:0:0:0:0:0:0:1"))); | ||
assertEquals("2001:db8:1:1:1:1:1:1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("2001:db8:1:1:1:1:1:1"))); | ||
assertEquals("2001:0:0:1::1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("2001:0:0:1:0:0:0:1"))); | ||
assertEquals("2001:db8:f::1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("2001:db8:000f:0:0:0:0:1"))); | ||
assertEquals("2001:db8::1:0:0:1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("2001:0db8:0000:0000:0001:0000:0000:0001"))); | ||
assertEquals("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"))); | ||
assertEquals("2001:200f::1", | ||
canonicalInet6((Inet6Address) InetAddress.getByName("2001:200f:0:0:0:0:0:1"))); | ||
} | ||
|
||
} |