Added unit tests for new switches

This commit is contained in:
Bane Stojkovic
2022-10-06 19:24:06 +02:00
parent 064b4d31ee
commit da0ce8970d
2 changed files with 22 additions and 1 deletions
@@ -506,7 +506,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
(index1 == 1 && (index2 == 5 || (index2 == 3 && position == 1) || (index2 == 7 && position == 3)));
case DP3T_5pos_Import:
positionConnections = DP3T_5pos_Import_CONNECTIONS.get(position);
return false;
break;
case DP5T:
return (index1 == 0 && index2 - index1 == position + 1)
|| (index2 == 11 && index2 - index1 == 5 - position);
@@ -10,6 +10,7 @@ import org.diylc.components.electromechanical.ToggleSwitchType;
import org.diylc.components.guitar.LPSwitch;
import org.diylc.components.guitar.LeverSwitch;
import org.diylc.components.guitar.LeverSwitch.LeverSwitchType;
import org.diylc.components.guitar.S1Switch;
import org.diylc.components.guitar.SchallerMegaSwitch;
import org.diylc.components.guitar.SchallerMegaSwitch.MegaSwitchType;
import org.diylc.core.IDIYComponent;
@@ -50,6 +51,26 @@ public class SwitchTests {
leverSwitch.setType(LeverSwitchType.DP3T_5pos_Import);
testSwitch(leverSwitch, validCombinations);
}
@Test
public void testLeverSwitch6Way() {
LeverSwitch leverSwitch = new LeverSwitch();
String[] validCombinations = new String[] {"0,0,8", "0,2,8", "0,1,3", "1,2,8", "1,1,3", "1,1,5", "2,2,8", "2,4,8", "2,1,5",
"3,4,8", "3,1,5", "3,1,7", "4,4,8", "4,6,8", "4,1,7", "5,6,8", "5,1,7", "5,1,9"};
leverSwitch.setType(LeverSwitchType._6_WAY_OG);
testSwitch(leverSwitch, validCombinations);
}
@Test
public void testS1Switch() {
S1Switch s1Switch = new S1Switch();
String[] validCombinations = new String[] {"0,1,2", "0,4,5", "0,7,8", "0,10,11", "1,2,3", "1,5,6", "1,8,9", "1,11,12"};
testSwitch(s1Switch, validCombinations);
}
@Test
public void testLPSwitch() {