mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-09 15:19:32 -04:00
Added searcher test cases
This commit is contained in:
parent
9a2573e7ca
commit
97f2b4d3f4
@ -69,6 +69,8 @@ public class test {
|
|||||||
assertNotEquals("", dai.filename);
|
assertNotEquals("", dai.filename);
|
||||||
c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length));
|
c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length));
|
||||||
assertEquals(new String(faviconData), c);
|
assertEquals(new String(faviconData), c);
|
||||||
|
|
||||||
|
archive.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -98,6 +100,8 @@ public class test {
|
|||||||
assertNotEquals("", dai.filename);
|
assertNotEquals("", dai.filename);
|
||||||
c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length));
|
c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length));
|
||||||
assertEquals(new String(faviconData), c);
|
assertEquals(new String(faviconData), c);
|
||||||
|
|
||||||
|
archive.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -128,6 +132,8 @@ public class test {
|
|||||||
assertNotEquals("", dai.filename);
|
assertNotEquals("", dai.filename);
|
||||||
c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length));
|
c = new String(getFileContentPartial(dai.filename, (int) dai.offset, faviconData.length));
|
||||||
assertEquals(new String(faviconData), c);
|
assertEquals(new String(faviconData), c);
|
||||||
|
|
||||||
|
archive.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -149,7 +155,7 @@ public class test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testServer() throws IOException, ZimFileFormatException, JNIKiwixException {
|
public void testServer() throws ZimFileFormatException, JNIKiwixException {
|
||||||
Archive archive = new Archive("small.zim");
|
Archive archive = new Archive("small.zim");
|
||||||
Library lib = new Library();
|
Library lib = new Library();
|
||||||
Book book = new Book();
|
Book book = new Book();
|
||||||
@ -162,7 +168,7 @@ public class test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBookMark() throws IOException, ZimFileFormatException, JNIKiwixException {
|
public void testBookMark() throws ZimFileFormatException, JNIKiwixException {
|
||||||
Archive archive = new Archive("small.zim");
|
Archive archive = new Archive("small.zim");
|
||||||
Library lib = new Library();
|
Library lib = new Library();
|
||||||
Book book = new Book();
|
Book book = new Book();
|
||||||
@ -183,6 +189,18 @@ public class test {
|
|||||||
//assertEquals(true, lib.removeBookmark(bookmark.getBookId(), bookmark.getUrl()));
|
//assertEquals(true, lib.removeBookmark(bookmark.getBookId(), bookmark.getUrl()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearcher() throws Exception, ZimFileFormatException, JNIKiwixException {
|
||||||
|
Archive archive = new Archive("small.zim");
|
||||||
|
Searcher searcher = new Searcher(archive);
|
||||||
|
Query query = new Query("test");
|
||||||
|
Search search = searcher.search(query);
|
||||||
|
int matches = (int) search.getEstimatedMatches();
|
||||||
|
assertEquals(1, matches);
|
||||||
|
SearchIterator iterator = search.getResults(0, matches);
|
||||||
|
searcher.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
public void main(String[] args) {
|
public void main(String[] args) {
|
||||||
Library lib = new Library();
|
Library lib = new Library();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user