* BitSet patch
@ 1999-03-21 9:46 Artur Biesiadowski
1999-03-21 10:00 ` Tom Tromey
1999-04-01 0:00 ` Artur Biesiadowski
0 siblings, 2 replies; 4+ messages in thread
From: Artur Biesiadowski @ 1999-03-21 9:46 UTC (permalink / raw)
To: mauve
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) );
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BitSet patch
1999-03-21 9:46 BitSet patch Artur Biesiadowski
@ 1999-03-21 10:00 ` Tom Tromey
1999-04-01 0:00 ` Tom Tromey
1999-04-01 0:00 ` Artur Biesiadowski
1 sibling, 1 reply; 4+ messages in thread
From: Tom Tromey @ 1999-03-21 10:00 UTC (permalink / raw)
To: Artur Biesiadowski; +Cc: mauve
>>>>> "Artur" == Artur Biesiadowski <abies@pg.gda.pl> writes:
Artur> A bit better test now - it was possible for and() to just clear
Artur> a bitset and pass the test.
I checked this in.
Artur> BTW it is quite hard to write a good test without 'mutation
Artur> testing' - introducing explicit errors in tested code :)
Yeah.
Sometimes I add new test cases to test for specific bugs I find in my
code. I encourage everybody to do this. There's some chance that
different programmers will make similar mistakes.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BitSet patch
1999-03-21 10:00 ` Tom Tromey
@ 1999-04-01 0:00 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 1999-04-01 0:00 UTC (permalink / raw)
To: Artur Biesiadowski; +Cc: mauve
>>>>> "Artur" == Artur Biesiadowski <abies@pg.gda.pl> writes:
Artur> A bit better test now - it was possible for and() to just clear
Artur> a bitset and pass the test.
I checked this in.
Artur> BTW it is quite hard to write a good test without 'mutation
Artur> testing' - introducing explicit errors in tested code :)
Yeah.
Sometimes I add new test cases to test for specific bugs I find in my
code. I encourage everybody to do this. There's some chance that
different programmers will make similar mistakes.
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
* BitSet patch
1999-03-21 9:46 BitSet patch Artur Biesiadowski
1999-03-21 10:00 ` Tom Tromey
@ 1999-04-01 0:00 ` Artur Biesiadowski
1 sibling, 0 replies; 4+ messages in thread
From: Artur Biesiadowski @ 1999-04-01 0:00 UTC (permalink / raw)
To: mauve
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) );
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-04-01 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-21 9:46 BitSet patch Artur Biesiadowski
1999-03-21 10:00 ` Tom Tromey
1999-04-01 0:00 ` Tom Tromey
1999-04-01 0:00 ` Artur Biesiadowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).