r111343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111342‎ | r111343 | r111344 >
Date:00:21, 13 February 2012
Author:oren
Status:deferred
Tags:
Comment:
upgrading tests
Modified paths:
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/ArticleNamespaceScaleTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/PrefixMatchTest.java (modified) (history)
  • /trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/SuggestUnitTest.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/spell/SuggestUnitTest.java
@@ -4,6 +4,7 @@
55 import java.util.Map;
66 import java.util.TreeMap;
77
 8+import org.junit.Test;
89 import org.wikimedia.lsearch.config.IndexId;
910 import org.wikimedia.lsearch.search.NamespaceFilter;
1011 import org.wikimedia.lsearch.spell.dist.EditDistance;
@@ -12,6 +13,7 @@
1314 public class SuggestUnitTest extends AbstractWikiTestCase
1415 {
1516
 17+ @Test
1618 public void testMakeNamespaces() throws IOException {
1719 IndexId iid = IndexId.get("entest");
1820 Suggest sug = new Suggest(iid);
@@ -35,6 +37,7 @@
3638 *
3739 * @throws IOException
3840 */
 41+ @Test
3942 public void testExtractSpaceMap1() throws IOException {
4043 assertEquals("{}",getSpaceMap(".999","0 999").toString());
4144 }
@@ -43,6 +46,7 @@
4447 *
4548 * @throws IOException
4649 */
 50+ @Test
4751 public void testExtractSpaceMap2() throws IOException {
4852 assertEquals("{4=3}",getSpaceMap("some string","som estring").toString());
4953 }
@@ -51,6 +55,7 @@
5256 *
5357 * @throws IOException
5458 */
 59+ @Test
5560 public void testExtractSpaceMap3() throws IOException {
5661 assertEquals("",getSpaceMap(" a "," b ").toString());
5762 }
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/ArticleNamespaceScaleTest.java
@@ -4,10 +4,13 @@
55 import java.util.Map.Entry;
66
77 import org.apache.lucene.search.ArticleNamespaceScaling;
 8+import org.junit.Test;
89
910 import junit.framework.TestCase;
1011
1112 public class ArticleNamespaceScaleTest extends TestCase {
 13+
 14+ @Test
1215 public void testComplex(){
1316 HashMap<Integer,Float> map = new HashMap<Integer,Float>();
1417 // (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 @@
2932 assertEquals(0.0025f,a.scaleNamespace(5));
3033 }
3134
 35+ @Test
3236 public void testDefault(){
3337 ArticleNamespaceScaling a = new ArticleNamespaceScaling(new HashMap<Integer,Float>());
3438 assertEquals(1f,a.scaleNamespace(0));
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/lsearch/search/PrefixMatchTest.java
@@ -1,11 +1,14 @@
22 package org.wikimedia.lsearch.search;
33
44 import org.apache.lucene.search.ArticleNamespaceScaling;
 5+import org.junit.Test;
56 import org.wikimedia.lsearch.test.AbstractWikiTestCase;
67 import org.wikimedia.lsearch.config.IndexId;
78 import org.wikimedia.lsearch.search.SearchEngine.PrefixMatch;
89
910 public class PrefixMatchTest extends AbstractWikiTestCase {
 11+
 12+ @Test
1013 public void testDeserialization(){
1114 IndexId iid = IndexId.get("enwiki");
1215 PrefixMatch m = new PrefixMatch("0:Some_title 10 ",iid.getNamespaceScaling());

Sign-offs

UserFlagDate
Nikerabbitinspected07:26, 13 February 2012

Status & tagging log