Fixed the testCase3 (skipto)

Change-Id: I9e03fe796bba6f4ef09055ea4d63a04b8dc4f84d
diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index 8594285..eec413c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -40,13 +40,14 @@
     private FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV("tokens", "text",
+        fd.addTV("tokens", "bbcbbb",
                 "[(0-1)s:b|s:c|_1$<i>0<i>1|<>:s$<b>64<i>0<i>1<i>1<b>0]"
                         + "[(1-2)s:b|_2$<i>1<i>2]"
                         + "[(2-3)s:c|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
                         + "[(3-4)s:b|_4$<i>3<i>4|<>:s$<b>64<i>3<i>4<i>4<b>0]"
                         + "[(4-5)s:b|_5$<i>4<i>5|<>:s$<b>64<i>4<i>5<i>5<b>0]"
-                        + "[(5-6)s:b|_6$<i>5<i>6]" + "[(6-7)s:c|_7$<i>6<i>7]");
+                        + "[(5-6)s:b|_6$<i>5<i>6]"
+                        + "[(6-7)s:c|_7$<i>6<i>7|<>:s$<b>64<i>6<i>7<i>7<b>0]");
         return fd;
     }
 
@@ -59,7 +60,7 @@
                         + "[(1-2)s:c|s:b|_2$<i>1<i>2|<>:s$<b>64<i>1<i>2<i>2<b>0]"
                         + "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
                         + "[(3-4)s:b|_4$<i>3<i>4|<>:s$<b>64<i>3<i>4<i>4<b>0]"
-                        + "[(4-5)s:d|_5$<i>4<i>5|<>:s$<b>64<i>4<i>5<i>5<b>0]"
+                        + "[(4-5)s:c|_5$<i>4<i>5|<>:s$<b>64<i>4<i>5<i>5<b>0]"
                         + "[(5-6)s:c|_6$<i>5<i>6|<>:s$<b>64<i>5<i>6<i>6<b>0]");
         return fd;
     }
@@ -68,7 +69,7 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("tokens", "text",
+        fd.addTV("tokens", "bbbddd",
                 "[(0-1)s:b|_1$<i>0<i>1|<>:p$<b>64<i>0<i>2<i>1<b>0]"
                         + "[(1-2)s:b|_2$<i>1<i>2]"
                         + "[(2-3)s:b|_3$<i>2<i>3|<>:p$<b>64<i>2<i>3<i>3<b>0]"
@@ -82,7 +83,7 @@
     private FieldDocument createFieldDoc3 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-3");
-        fd.addTV("tokens", "text",
+        fd.addTV("tokens", "bdbcdd",
                 "[(0-1)s:b|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>1<b>0]"
                         + "[(1-2)s:d|_2$<i>1<i>2]"
                         + "[(2-3)s:b|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
@@ -92,6 +93,7 @@
         return fd;
     }
 
+
     public SpanQuery createQuery (String elementType, String x, String y,
             int min, int max, boolean isOrdered) {
 
@@ -110,22 +112,26 @@
      */
     @Test
     public void testCase1 () throws IOException {
-        //System.out.println("testCase1");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
+        ki.addDoc(createFieldDoc3());
         ki.commit();
 
         SpanQuery sq;
-        sq = createQuery("s", "s:b", "s:c", 0, 2, true);
+        sq = createQuery("s", "s:b", "s:c", 1, 1, true);
 
         kr = ki.search(sq, (short) 10);
 
-        assertEquals(kr.getTotalResults(), 4);
+        assertEquals(4, kr.getTotalResults());
         assertEquals(0, kr.getMatch(0).startPos);
-        assertEquals(1, kr.getMatch(0).endPos);
-        assertEquals(0, kr.getMatch(1).startPos);
-        assertEquals(3, kr.getMatch(1).endPos);
+        assertEquals(3, kr.getMatch(0).endPos);
+        assertEquals(4, kr.getMatch(1).startPos);
+        assertEquals(7, kr.getMatch(1).endPos);
+        assertEquals(3, kr.getMatch(2).startPos);
+        assertEquals(5, kr.getMatch(2).endPos);
+        assertEquals(2, kr.getMatch(3).startPos);
+        assertEquals(4, kr.getMatch(3).endPos);
     }
 
 
@@ -134,7 +140,6 @@
      */
     @Test
     public void testCase2 () throws IOException {
-        //System.out.println("testCase2");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
@@ -156,7 +161,6 @@
     /** Skip to */
     @Test
     public void testCase3 () throws IOException {
-        //System.out.println("testCase3");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
@@ -171,7 +175,7 @@
 
         kr = ki.search(sq, (short) 10);
 
-        assertEquals(kr.getTotalResults(), 1);
+        assertEquals(1, kr.getTotalResults());
         assertEquals(2, kr.getMatch(0).getLocalDocID());
         assertEquals(2, kr.getMatch(0).startPos);
         assertEquals(5, kr.getMatch(0).endPos);
@@ -182,7 +186,6 @@
     /** Same tokens in different elements */
     @Test
     public void testCase4 () throws IOException {
-        //System.out.println("testCase4");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.commit();
@@ -203,7 +206,6 @@
     /** Test query from json */
     @Test
     public void testCase5 () throws Exception {
-        //System.out.println("testCase4");
         ki = new KrillIndex();
         ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
         ki.commit();
@@ -252,6 +254,7 @@
         assertEquals("[[ec]]ebdc", kr.getMatch(0).getSnippetBrackets());
     }
 
+
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {