4 package jp.sourceforge.mikutoga.typical;
7 import jp.sfjp.mikutoga.pmd.MorphType;
8 import org.junit.After;
9 import org.junit.AfterClass;
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import static org.junit.Assert.*;
18 public class TypicalMorphTest {
20 public TypicalMorphTest() {
24 public static void setUpClass() {
28 public static void tearDownClass() {
36 public void tearDown() {
40 * Test of getTypedMorphList method, of class TypicalMorph.
43 public void testGetTypedMorphList() {
44 System.out.println("getTypedMorphList");
46 List<TypicalMorph> morphList;
48 morphList = TypicalMorph.getTypedMorphList(MorphType.EYEBROW);
49 assertEquals(6, morphList.size());
51 morphList = TypicalMorph.getTypedMorphList(MorphType.EYE);
52 assertEquals(7, morphList.size());
54 morphList = TypicalMorph.getTypedMorphList(MorphType.LIP);
55 assertEquals(12, morphList.size());
57 morphList = TypicalMorph.getTypedMorphList(MorphType.EXTRA);
58 assertEquals(2, morphList.size());
64 * Test of findWithPrimary method, of class TypicalMorph.
67 public void testFindWithPrimary() {
68 System.out.println("findWithPrimary");
72 result = TypicalMorph.findWithPrimary("あ");
73 assertNotNull(result);
74 assertEquals(MorphType.LIP, result.getMorphType());
75 assertEquals("あ", result.getTopPrimaryName());
76 assertEquals("a", result.getTopGlobalName());
77 assertEquals(1, result.getPrimaryList().size());
78 assertEquals("あ", result.getPrimaryList().get(0));
79 assertEquals(1, result.getGlobalList().size());
80 assertEquals("a", result.getGlobalList().get(0));
85 result1 = TypicalMorph.findWithPrimary("べー");
86 result2 = TypicalMorph.findWithPrimary("ぺろっ");
87 assertSame(result1, result2);
88 assertEquals(MorphType.EXTRA, result1.getMorphType());
89 assertEquals("べー", result1.getTopPrimaryName());
90 assertEquals("tongue", result1.getTopGlobalName());
91 assertEquals(2, result1.getPrimaryList().size());
92 assertEquals("べー", result1.getPrimaryList().get(0));
93 assertEquals("ぺろっ", result1.getPrimaryList().get(1));
94 assertEquals(1, result1.getGlobalList().size());
95 assertEquals("tongue", result1.getGlobalList().get(0));
101 * Test of findWithGlobal method, of class TypicalMorph.
104 public void testFindWithGlobal() {
105 System.out.println("findWithGlobal");
109 result = TypicalMorph.findWithGlobal("a");
110 assertNotNull(result);
112 TypicalMorph result2;
113 result2 = TypicalMorph.findWithPrimary("あ");
115 assertSame(result, result2);
121 * Test of primary2global method, of class TypicalMorph.
124 public void testPrimary2global() {
125 System.out.println("primary2global");
129 result = TypicalMorph.primary2global("あ");
130 assertEquals("a", result);
135 result1 = TypicalMorph.primary2global("べー");
136 result2 = TypicalMorph.primary2global("ぺろっ");
137 assertSame(result1, result2);
139 result1 = TypicalMorph.primary2global("ウィンク");
140 result2 = TypicalMorph.primary2global("ウィンク");
141 assertSame(result1, result2);
143 result = TypicalMorph.primary2global("XXX");
150 * Test of global2primary method, of class TypicalMorph.
153 public void testGlobal2primary() {
154 System.out.println("global2primary");
158 result = TypicalMorph.global2primary("a");
159 assertEquals("あ", result);
161 result = TypicalMorph.global2primary("tongue");
162 assertEquals("べー", result);
164 result = TypicalMorph.global2primary("XXX");
171 * Test of getMorphType method, of class TypicalMorph.
174 public void testGetMorphType() {
175 System.out.println("getMorphType");
177 List<TypicalMorph> morphList;
179 morphList = TypicalMorph.getTypedMorphList(MorphType.EYEBROW);
181 for(TypicalMorph morph : morphList){
182 MorphType type = morph.getMorphType();
183 assertEquals(MorphType.EYEBROW, type);
186 morphList = TypicalMorph.getTypedMorphList(MorphType.EYE);
188 for(TypicalMorph morph : morphList){
189 MorphType type = morph.getMorphType();
190 assertEquals(MorphType.EYE, type);
193 morphList = TypicalMorph.getTypedMorphList(MorphType.LIP);
195 for(TypicalMorph morph : morphList){
196 MorphType type = morph.getMorphType();
197 assertEquals(MorphType.LIP, type);
200 morphList = TypicalMorph.getTypedMorphList(MorphType.EXTRA);
202 for(TypicalMorph morph : morphList){
203 MorphType type = morph.getMorphType();
204 assertEquals(MorphType.EXTRA, type);