[kaffe] CVS kaffe (kaz): test/regression/InetAddressTest.java:

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Thu Sep 11 08:05:02 2003


PatchSet 4023 
Date: 2003/09/11 15:02:22
Author: kaz
Branch: HEAD
Tag: (none) 
Log:
2003-09-09  Ito Kazumitsu <kaz@maczuka.gcd.org>

	* test/regression/InetAddressTest.java:
	check whether InetAddress.getByName returns IPv6 address.

Members: 
	ChangeLog:1.1619->1.1620 
	test/regression/InetAddressTest.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1619 kaffe/ChangeLog:1.1620
--- kaffe/ChangeLog:1.1619	Tue Sep  9 16:34:58 2003
+++ kaffe/ChangeLog	Thu Sep 11 15:02:22 2003
@@ -1,3 +1,8 @@
+2003-09-09  Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+	* test/regression/InetAddressTest.java:
+	check whether InetAddress.getByName returns IPv6 address.
+
 2003-09-09  Guilhem Lavaux <guilhem@kaffe.org>
 
 	* libraries/javalib/java/net/InetAddress.java:
Index: kaffe/test/regression/InetAddressTest.java
diff -u kaffe/test/regression/InetAddressTest.java:1.1 kaffe/test/regression/InetAddressTest.java:1.2
--- kaffe/test/regression/InetAddressTest.java:1.1	Thu May 15 15:03:24 2003
+++ kaffe/test/regression/InetAddressTest.java	Thu Sep 11 15:02:23 2003
@@ -1,5 +1,6 @@
 
 import java.net.InetAddress;
+import java.net.Inet6Address;
 
 public class InetAddressTest
 {
@@ -9,18 +10,30 @@
 	InetAddress ia;
 
 	ia = InetAddress.getByName(null);
-	System.out.println("(null) = " + ia);
+	System.out.println("(null) = " + check(ia));
 	
 	ia = InetAddress.getByName("");
-	System.out.println("\"\" = " + ia);
-	
+	System.out.println("\"\" = " + check(ia));
+
 	ia = InetAddress.getByName("localhost");
-	System.out.println("localhost = " + ia);
+	System.out.println("localhost = " + check(ia));
 	if( !ia.isLoopbackAddress() )
 	{
 	    System.out.println("Not a loopback?");
 	}
     }
+
+    private static String check(InetAddress ia)
+         throws Throwable
+    {
+        String expected = (
+            ia instanceof Inet6Address ?
+                "localhost/::::::::1" :
+	        "localhost/127.0.0.1" );
+        if (ia.toString().equals(expected)) return "localhost/127.0.0.1";
+        return ia.toString();
+    }
+
 }
 
 /* Expected Output: