Index: trunk/lucene-search-3/src/test/java/org/wikimedia/nlp/mdl/SignatureTest.java |
— | — | @@ -0,0 +1,62 @@ |
| 2 | +package org.wikimedia.nlp.mdl; |
| 3 | + |
| 4 | +import static org.junit.Assert.*; |
| 5 | + |
| 6 | +import org.hamcrest.CoreMatchers; |
| 7 | +import org.hamcrest.core.IsEqual; |
| 8 | +import org.junit.Before; |
| 9 | +import org.junit.Test; |
| 10 | +import org.junit.matchers.JUnitMatchers; |
| 11 | +import org.wikimedia.nlp.mdl.Atom; |
| 12 | +import org.wikimedia.nlp.mdl.Signature; |
| 13 | + |
| 14 | +import static org.hamcrest.CoreMatchers.*; |
| 15 | +//import static org.junit.matchers.JUnitMatchers.*; |
| 16 | + |
| 17 | +public class SignatureTest { |
| 18 | + |
| 19 | + Signature sig ; |
| 20 | + Atom govern = new Atom("govern",6l); |
| 21 | + Atom government = new Atom("government",5l); |
| 22 | + Atom governnor = new Atom("governnor",3l); |
| 23 | + @Before |
| 24 | + public void setUp(){ |
| 25 | + |
| 26 | + sig = new Signature(); |
| 27 | + |
| 28 | + } |
| 29 | + |
| 30 | + @Test |
| 31 | + public void testAddKeyValue() { |
| 32 | + |
| 33 | + sig.addKeyValue(govern, "ment,nor"); |
| 34 | + |
| 35 | + assertTrue("added",sig.hasKey(govern)); |
| 36 | + assertFalse("not added",sig.hasKey(governnor)); |
| 37 | + } |
| 38 | + |
| 39 | + @Test |
| 40 | + public void testKeyAvailable() { |
| 41 | + |
| 42 | + sig.addKey(govern); |
| 43 | + sig.addKey(government); |
| 44 | + |
| 45 | + assertTrue(sig.hasKey(govern)); |
| 46 | + assertFalse(sig.hasKey(governnor)); |
| 47 | + } |
| 48 | + |
| 49 | + @Test |
| 50 | + public void testAddKeytoKey() { |
| 51 | + String suffixList="ment,nor"; |
| 52 | + |
| 53 | + sig.addKeyValue(govern,suffixList ); |
| 54 | + sig.addKey(govern, government); |
| 55 | + |
| 56 | + assertThat(sig.getVal(govern), equalTo(suffixList)); |
| 57 | + assertThat(sig.getVal(government), equalTo(suffixList)); |
| 58 | + assertThat(sig.getVal(governnor), not(equalTo(suffixList))); |
| 59 | + |
| 60 | + } |
| 61 | + |
| 62 | + |
| 63 | +} |
Property changes on: trunk/lucene-search-3/src/test/java/org/wikimedia/nlp/mdl/SignatureTest.java |
___________________________________________________________________ |
Added: svn:keywords |
1 | 64 | + LastChangedDate LastChangedRevision LastChangedBy Id |
Index: trunk/lucene-search-3/src/test/java/org/wikimedia/nlp/mdl/MdlMorphologyTest.java |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +package org.wikimedia.nlp.mdl; |
| 3 | + |
| 4 | +import static org.junit.Assert.*; |
| 5 | + |
| 6 | +import org.junit.Before; |
| 7 | +import org.junit.Test; |
| 8 | + |
| 9 | +public class MdlMorphologyTest { |
| 10 | + |
| 11 | + int maxLength=0; |
| 12 | + |
| 13 | + public long genFrequency(String input) |
| 14 | + { |
| 15 | + |
| 16 | + return (1+maxLength-input.length())*20; |
| 17 | + |
| 18 | + } |
| 19 | + |
| 20 | + Signature sig ; |
| 21 | + Atom govern; |
| 22 | + Atom government; |
| 23 | + Atom governnor; |
| 24 | + @Before |
| 25 | + public void setUp(){ |
| 26 | + |
| 27 | + String[] words = new String[]{ "govern", "government", "governnor"}; |
| 28 | + |
| 29 | + govern = new Atom(words[1],genFrequency(words[1]),"en"); |
| 30 | + government = new Atom(words[2],genFrequency(words[2]),"en"); |
| 31 | + governnor = new Atom(words[3],genFrequency(words[3]),"en"); |
| 32 | + sig = new Signature(); |
| 33 | + |
| 34 | + } |
| 35 | + @Test |
| 36 | + public void test() { |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + fail("Not yet implemented"); |
| 41 | + } |
| 42 | + |
| 43 | +} |
Property changes on: trunk/lucene-search-3/src/test/java/org/wikimedia/nlp/mdl/MdlMorphologyTest.java |
___________________________________________________________________ |
Added: svn:keywords |
1 | 44 | + LastChangedDate LastChangedRevision LastChangedBy Id |