From: Francis Kung <fkung@redhat.com>
To: mauve-patches <mauve-patches@sources.redhat.com>
Subject: FYI: Arrays.binarySearch tests
Date: Wed, 03 Jan 2007 20:57:00 -0000 [thread overview]
Message-ID: <459C18A6.3040105@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
Hi,
This patch adds some checks to the binarySearch methods for the
empty-array case.
Cheers,
Francis
2007-01-03 Francis Kung <fkung@redhat.com>
* gnu/testlet/java/util/Arrays/binarySearch.java:
(testByte): Added check for empty array.
(testChar): Likewise.
(testDouble): Likewise.
(testFloat): Likewise.
(testInt): Likewise.
(testLong): Likewise.
(testObject): Likewise.
(testShort): Likewise.
[-- Attachment #2: mauve-binarysearch.diff --]
[-- Type: text/x-patch, Size: 2278 bytes --]
Index: gnu/testlet/java/util/Arrays/binarySearch.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Arrays/binarySearch.java,v
retrieving revision 1.1
diff -u -r1.1 binarySearch.java
--- gnu/testlet/java/util/Arrays/binarySearch.java 27 Aug 2004 21:57:50 -0000 1.1
+++ gnu/testlet/java/util/Arrays/binarySearch.java 3 Jan 2007 20:55:37 -0000
@@ -69,6 +69,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new byte[0];
+ harness.check(Arrays.binarySearch(b1, (byte)0), -1);
}
private void testChar(TestHarness harness)
@@ -91,6 +94,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new char[0];
+ harness.check(Arrays.binarySearch(b1, '0'), -1);
}
private void testDouble(TestHarness harness)
@@ -113,6 +119,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new double[0];
+ harness.check(Arrays.binarySearch(b1, 0.0), -1);
}
private void testFloat(TestHarness harness)
@@ -135,6 +144,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new float[0];
+ harness.check(Arrays.binarySearch(b1, 0.0f), -1);
}
private void testInt(TestHarness harness)
@@ -157,6 +169,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new int[0];
+ harness.check(Arrays.binarySearch(b1, 0), -1);
}
private void testLong(TestHarness harness)
@@ -179,6 +194,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new long[0];
+ harness.check(Arrays.binarySearch(b1, 0), -1);
}
private void testObject(TestHarness harness)
@@ -227,6 +245,9 @@
harness.check(Arrays.binarySearch(b1, "2", new ReverseComparator()) == 1);
harness.check(Arrays.binarySearch(b1, "3", new ReverseComparator()) == 0);
harness.check(Arrays.binarySearch(b1, "4", new ReverseComparator()) == -1);
+
+ b1 = new Object[0];
+ harness.check(Arrays.binarySearch(b1, ""), -1);
}
private void testShort(TestHarness harness)
@@ -249,6 +270,9 @@
pass = true;
}
harness.check(pass);
+
+ b1 = new short[0];
+ harness.check(Arrays.binarySearch(b1, (short)0), -1);
}
static class ReverseComparator implements Comparator {
reply other threads:[~2007-01-03 20:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=459C18A6.3040105@redhat.com \
--to=fkung@redhat.com \
--cc=mauve-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).