This is the mail archive of the mauve-discuss@sourceware.cygnus.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]

BitSet patch


A bit better test now - it was possible for and() to just clear a bitset
and pass the test.

BTW it is quite hard to write a good test without 'mutation testing' -
introducing explicit errors in tested code :)

Artur
diff -urPwb old/jdk10.java new/jdk10.java
--- old/jdk10.java	Tue Feb  9 11:58:40 1999
+++ new/jdk10.java	Sun Mar 21 16:39:00 1999
@@ -97,19 +97,27 @@
 		h.check(b1.toString().equals("{1, 2, 11, 200}"));
 		b2 = new BitSet(100);
 		h.check(b2.toString().equals("{}"));
+		b2.set(1);
+		h.check(b2.toString().equals("{1}"));
 
 		h.checkPoint("Hashcode");
 		h.check(b1.hashCode() == 2260);
-		h.check(b2.hashCode() == 1234);
+		b3 = new BitSet();
+		h.check(b3.hashCode() == 1234);
 
 		h.checkPoint("And/Or/Xor");
-		b3 = new BitSet();
+		b2.set(1);
+		b2.set(3);
+		b2.set(200);
+		b2.set(300);
 		b2.and(b1);
-		h.check( trulyEquals(b2,b3) );
+		h.check( b2.toString().equals("{1, 200}") );
+		b1.set(17);
+		b2.set(15);
 		b2.or(b1);
-		h.check( trulyEquals(b2,b1) );
+		h.check( b2.toString().equals("{1, 2, 11, 15, 17, 200}") );
 		b2.xor(b2);
-		h.check( trulyEquals(b2,b3) );
+		h.check( b2.toString().equals("{}") );
 		b2.xor(b1);
 		b3.or(b1);
 		h.check( trulyEquals(b2,b3) );

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