Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/SuggestUnitTest.java |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | import java.util.Map; |
6 | 6 | import java.util.TreeMap; |
7 | 7 | |
| 8 | +import org.junit.Test; |
8 | 9 | import org.wikimedia.lsearch.config.IndexId; |
9 | 10 | import org.wikimedia.lsearch.search.NamespaceFilter; |
10 | 11 | import org.wikimedia.lsearch.spell.dist.EditDistance; |
— | — | @@ -12,6 +13,7 @@ |
13 | 14 | public class SuggestUnitTest extends AbstractWikiTestCase |
14 | 15 | { |
15 | 16 | |
| 17 | + @Test |
16 | 18 | public void testMakeNamespaces() throws IOException { |
17 | 19 | IndexId iid = IndexId.get("entest"); |
18 | 20 | Suggest sug = new Suggest(iid); |
— | — | @@ -35,6 +37,7 @@ |
36 | 38 | * |
37 | 39 | * @throws IOException |
38 | 40 | */ |
| 41 | + @Test |
39 | 42 | public void testExtractSpaceMap1() throws IOException { |
40 | 43 | assertEquals("{}",getSpaceMap(".999","0 999").toString()); |
41 | 44 | } |
— | — | @@ -43,6 +46,7 @@ |
44 | 47 | * |
45 | 48 | * @throws IOException |
46 | 49 | */ |
| 50 | + @Test |
47 | 51 | public void testExtractSpaceMap2() throws IOException { |
48 | 52 | assertEquals("{4=3}",getSpaceMap("some string","som estring").toString()); |
49 | 53 | } |
— | — | @@ -51,6 +55,7 @@ |
52 | 56 | * |
53 | 57 | * @throws IOException |
54 | 58 | */ |
| 59 | + @Test |
55 | 60 | public void testExtractSpaceMap3() throws IOException { |
56 | 61 | assertEquals("",getSpaceMap(" a "," b ").toString()); |
57 | 62 | } |
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/ArticleNamespaceScaleTest.java |
— | — | @@ -4,10 +4,13 @@ |
5 | 5 | import java.util.Map.Entry; |
6 | 6 | |
7 | 7 | import org.apache.lucene.search.ArticleNamespaceScaling; |
| 8 | +import org.junit.Test; |
8 | 9 | |
9 | 10 | import junit.framework.TestCase; |
10 | 11 | |
11 | 12 | public class ArticleNamespaceScaleTest extends TestCase { |
| 13 | + |
| 14 | + @Test |
12 | 15 | public void testComplex(){ |
13 | 16 | HashMap<Integer,Float> map = new HashMap<Integer,Float>(); |
14 | 17 | // (0, 1) (2, 0.005) (3, 0.001) (4, 0.01), (6, 0.02), (10, 0.0005), (12, 0.01), (14, 0.02) |
— | — | @@ -28,6 +31,7 @@ |
29 | 32 | assertEquals(0.0025f,a.scaleNamespace(5)); |
30 | 33 | } |
31 | 34 | |
| 35 | + @Test |
32 | 36 | public void testDefault(){ |
33 | 37 | ArticleNamespaceScaling a = new ArticleNamespaceScaling(new HashMap<Integer,Float>()); |
34 | 38 | assertEquals(1f,a.scaleNamespace(0)); |
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/PrefixMatchTest.java |
— | — | @@ -1,11 +1,14 @@ |
2 | 2 | package org.wikimedia.lsearch.search; |
3 | 3 | |
4 | 4 | import org.apache.lucene.search.ArticleNamespaceScaling; |
| 5 | +import org.junit.Test; |
5 | 6 | import org.wikimedia.lsearch.test.AbstractWikiTestCase; |
6 | 7 | import org.wikimedia.lsearch.config.IndexId; |
7 | 8 | import org.wikimedia.lsearch.search.SearchEngine.PrefixMatch; |
8 | 9 | |
9 | 10 | public class PrefixMatchTest extends AbstractWikiTestCase { |
| 11 | + |
| 12 | + @Test |
10 | 13 | public void testDeserialization(){ |
11 | 14 | IndexId iid = IndexId.get("enwiki"); |
12 | 15 | PrefixMatch m = new PrefixMatch("0:Some_title 10 ",iid.getNamespaceScaling()); |