Added glocal china unit test and added T07PartPlanIt

This commit is contained in:
Willem Cazander 2022-01-31 17:21:32 +01:00
parent daad0690fc
commit 9793e70937
6 changed files with 297 additions and 21 deletions

View file

@ -0,0 +1,69 @@
package love.distributedrebirth.numberxd.base2t;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import love.distributedrebirth.numberxd.base2t.facet.BasePart;
public class BasePartFactoryTest {
@Test
public void testSupportedBases() {
int[] bases = BasePartFactory.getSupportedBases();
Assertions.assertNotNull(bases);
Assertions.assertTrue(bases.length > 1);
Assertions.assertTrue(bases.length < 100);
for (int base:bases) {
Assertions.assertNotNull(base);
}
}
@Test
public void testGlobalChinaMap() {
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BasePart part:BasePartFactory.buildBasePartsByBase(base)) {
Assertions.assertFalse(global.containsKey(part.getChinaKey()));
global.put(part.getChinaKey(), part.getChinaValue());
}
}
Assertions.assertTrue(global.size() > 1);
}
@Test
public void testGlobalToneMap() {
boolean duplicate = false;
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BasePart part:BasePartFactory.buildBasePartsByBase(base)) {
if (global.containsKey(part.getIdentifierTone())) {
duplicate = true;
break;
}
global.put(part.getIdentifierTone(), part.getChinaValue());
}
}
Assertions.assertTrue(global.size() > 1);
Assertions.assertTrue(duplicate);
}
@Test
public void testGlobalLetterMap() {
boolean duplicate = false;
Map<String,String> global = new HashMap<>();
for (int base:BasePartFactory.getSupportedBases()) {
for (BasePart part:BasePartFactory.buildBasePartsByBase(base)) {
if (global.containsKey(part.getIdentifierLetter())) {
duplicate = true;
break;
}
global.put(part.getIdentifierLetter(), part.getChinaValue());
}
}
Assertions.assertTrue(global.size() > 1);
Assertions.assertTrue(duplicate);
}
}

View file

@ -0,0 +1,41 @@
package love.distributedrebirth.numberxd.base2t;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
*
*
* @author willemtsade ©Δ 仙上主天
*/
public class T07PartPlanItTest {
@Test
public void testBasePart() {
for (T07PartPlanIt value:T07PartPlanIt.values()) {
Assertions.assertNotNull(value.getIdentifierTone());
Assertions.assertNotNull(value.getIdentifierLetter());
Assertions.assertNotNull(value.getChinaKey());
Assertions.assertNotNull(value.getChinaValue());
Assertions.assertNotNull(value.getAlt1Value());
Assertions.assertNotNull(value.getAlt1Name());
Assertions.assertNotNull(value.getAlt1Wiki());
}
}
@Test
public void testToneMap() {
Assertions.assertEquals(T07PartPlanIt.PART_1, T07PartPlanIt.valueOfTone("˥"));
Assertions.assertEquals(T07PartPlanIt.PART_2, T07PartPlanIt.valueOfTone(""));
Assertions.assertEquals(T07PartPlanIt.PART_6, T07PartPlanIt.valueOfTone(""));
Assertions.assertEquals(T07PartPlanIt.PART_7, T07PartPlanIt.valueOfTone("˩"));
}
@Test
public void testChinaMap() {
Assertions.assertEquals(T07PartPlanIt.PART_1, T07PartPlanIt.valueOfChina("♎︎"));
Assertions.assertEquals(T07PartPlanIt.PART_2, T07PartPlanIt.valueOfChina("♏︎"));
Assertions.assertEquals(T07PartPlanIt.PART_6, T07PartPlanIt.valueOfChina("♑︎"));
Assertions.assertEquals(T07PartPlanIt.PART_7, T07PartPlanIt.valueOfChina("♈︎"));
}
}