Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added another unit test

  • Loading branch information...
commit 3a2c4f3090d74814bbc8c6de4f5e2d5459b30117 1 parent 464571d
@javasoze javasoze authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/test/java/com/kamikaze/test/PForDeltaKamikazeTest.java
View
33 src/test/java/com/kamikaze/test/PForDeltaKamikazeTest.java
@@ -38,6 +38,39 @@
private static String serial = "PForDeltaSerial";
private static String serial2 = "PForDeltaSerial2";
+ @Test
+ public void testCorrectness() throws Exception{
+ int numdocs = 6;
+ Random rand = new Random();
+ HashSet<Integer> set = new HashSet<Integer>();
+ while(set.size() < numdocs){
+ int n = Math.abs(rand.nextInt());
+ set.add(n);
+ }
+
+ int[] numArray = new int[set.size()];
+
+ //Arrays.sort(numArray);
+
+ int i = 0;
+ for (int n : set){
+ numArray[i++] = n;
+ }
+
+ PForDeltaDocIdSet docset = new PForDeltaDocIdSet(5);
+
+ for (int n : numArray){
+ docset.addDoc(n);
+ }
+
+ DocIdSetIterator iter = docset.iterator();
+
+ int doc;
+ i = 0;
+ while((doc=iter.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS){
+ TestCase.assertEquals(numArray[i++], doc);
+ }
+ }
@Test
public void testAddDocNextDoc() throws Exception
Please sign in to comment.
Something went wrong with that request. Please try again.