This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AcuniaHashMapTest testlet bugs


Hi,

I found the following buggy tests in AcuniaHashMapTest.

2002-04-07  Mark Wielaard  <mark@klomp.org>

    * gnu/testlet/java/util/HashMap/AcuniaHashMapTest.java
    (test_HashMap(): new HashMap(10,1.5f) has a loadFactor of 1.5f.
    (test_entrySet): it.hasNext after hm.remove should throw 
    ConcurrentModificationException. setValue through iterator of
    entrySet on a HashMap should succeed.

Does anybody disagree?

Cheers,

Mark
Index: gnu/testlet/java/util/HashMap/AcuniaHashMapTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/HashMap/AcuniaHashMapTest.java,v
retrieving revision 1.2
diff -u -r1.2 AcuniaHashMapTest.java
--- gnu/testlet/java/util/HashMap/AcuniaHashMapTest.java	2 Apr 2002 13:46:45 -0000	1.2
+++ gnu/testlet/java/util/HashMap/AcuniaHashMapTest.java	7 Apr 2002 11:10:44 -0000
@@ -83,14 +83,14 @@
    th.checkPoint("HashMap()");
     hm = new HashMap();
     try {
-        th.check( lf.getFloat(hm) == 0.75f, "checking value of loadFactor");
+        th.check(lf.getFloat(hm), 0.75f);
         }
     catch (Exception e) { th.fail("no exception wanted !!!, got "+e); }
    th.checkPoint("HashMap(java.util.Map)");
     HashMap hm1 = buildHM();
     hm = new HashMap(hm1);
     try {
-        th.check( lf.getFloat(hm) == 0.75f, "checking value of loadFactor");
+        th.check(lf.getFloat(hm), 0.75f);
         }
     catch (Exception e) { th.fail("no exception wanted !!!, got "+e); }
     th.check(hm.size() == 16 , "all elements are put, got "+hm.size());
@@ -109,7 +109,7 @@
    th.checkPoint("HashMap(int)");
     hm = new HashMap(1);
     try {
-        th.check( lf.getFloat(hm) == 0.75f, "checking value of loadFactor");
+        th.check(lf.getFloat(hm), 0.75f);
         }
     catch (Exception e) { th.fail("no exception wanted !!!, got "+e); }
     try { new HashMap(-1);
@@ -120,12 +120,12 @@
    th.checkPoint("HashMap(int,int)");
     hm = new HashMap(10,0.5f);
     try {
-        th.check( lf.getFloat(hm) == 0.5f, "checking value of loadFactor, got "+lf.getFloat(hm));
+        th.check(lf.getFloat(hm), 0.5f);
         }
     catch (Exception e) { th.fail("no exception wanted !!!, got "+e); }
     hm = new HashMap(10,1.5f);
     try {
-        th.check( lf.getFloat(hm) == 0.75f, "checking value of loadFactor, got "+lf.getFloat(hm));
+        th.check(lf.getFloat(hm), 1.5f);
         }
     catch (Exception e) { th.fail("no exception wanted !!!, got "+e); }
     try {new HashMap(-1,0.1f);
@@ -318,7 +318,7 @@
     it.next();
     try {
     	s.add("ADDING");
-    	th.fail("should throw an UnsupportedOperationException");
+    	th.fail("add should throw an UnsupportedOperationException");
     }
     catch (UnsupportedOperationException uoe) { th.check(true); }
     th.check( s.size() == 16 );
@@ -326,9 +326,10 @@
     th.check( s.size() == 15 );
     try {
     	th.check(it.hasNext());
+	th.fail("it.hasNext after hm.remove should throw ConcurrentModificationException");
     }
     catch(ConcurrentModificationException cme) {
-	th.fail("it.hasNext should not throw ConcurrentModificationException");
+	th.check(true);
     }
     try {
     	it.next();
@@ -354,11 +355,11 @@
     	th.debug("got ME key = "+me+" and value = "+me.getKey());}
 
     try {
-//    	th.debug("got ME key = "+me.getKey()+" and value = "+me.getValue());
-    	me.setValue(this);
-    	th.fail("should throw an UnsupportedOperationException");
+//     th.debug("got ME key = "+me.getKey()+" and value = "+me.getValue());
+    	me.setValue("alpha");
+    	th.check(hm.get(me.getKey()), "alpha", "setValue through iterator of entrySet");
     	}
-    catch(UnsupportedOperationException uoe) { th.check(true);}
+    catch(UnsupportedOperationException uoe) { th.fail("setValue should be supported");}
     it= s.iterator();
     Vector v = new Vector();
     Object ob;
@@ -427,7 +428,7 @@
     catch (Exception e) { th.fail("got bad Exception -- got "+e); }
     try {
     	s.add("ADDING");
-    	th.fail("should throw an UnsupportedOperationException");
+    	th.fail("add should throw an UnsupportedOperationException");
     }
     catch (UnsupportedOperationException uoe) { th.check(true); }
 
@@ -471,7 +472,7 @@
     catch (Exception e) { th.fail("got bad Exception -- got "+e); }
     try {
     	s.add("ADDING");
-    	th.fail("should throw an UnsupportedOperationException");
+    	th.fail("add should throw an UnsupportedOperationException");
     }
     catch (UnsupportedOperationException uoe) { th.check(true); }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]