Add rotary switches

This commit is contained in:
Bane Stojkovic
2022-10-22 18:44:49 +02:00
parent 6100309b3b
commit c30c8da267
34 changed files with 883 additions and 33 deletions
@@ -0,0 +1,70 @@
package org.diylc.netlist;
import org.diylc.components.electromechanical.RotarySwitchOpen;
import org.diylc.components.electromechanical.RotarySwitchOpenType;
import org.junit.Test;
public class RotarySwitchOpenTests extends AbstractSwitchTests {
@Test
public void testRotarySwitch2P5T() {
RotarySwitchOpen sw = new RotarySwitchOpen();
String[] validCombinations = new String[] {
"0,5,11", "0,10,12",
"1,4,11", "1,9,12",
"2,3,11", "2,8,12",
"3,2,11", "3,7,12",
"4,1,11", "4,6,12"};
sw.setValue(RotarySwitchOpenType._2P5T);
testSwitch(sw, validCombinations);
}
@Test
public void testRotarySwitch2P6T() {
RotarySwitchOpen sw = new RotarySwitchOpen();
String[] validCombinations = new String[] {
"0,6,13", "0,12,14",
"1,5,13", "1,11,14",
"2,4,13", "2,10,14",
"3,3,13", "3,9,14",
"4,2,13", "4,8,14",
"5,1,13", "5,7,14"};
sw.setValue(RotarySwitchOpenType._2P6T);
testSwitch(sw, validCombinations);
}
@Test
public void testRotarySwitch4P5T() {
RotarySwitchOpen sw = new RotarySwitchOpen();
String[] validCombinations = new String[] {
"0,5,11", "0,10,12", "0,17,23", "0,22,24",
"1,4,11", "1,9,12", "1,16,23", "1,21,24",
"2,3,11", "2,8,12", "2,15,23", "2,20,24",
"3,2,11", "3,7,12", "3,14,23", "3,19,24",
"4,1,11", "4,6,12", "4,13,23", "4,18,24"};
sw.setValue(RotarySwitchOpenType._4P5T);
testSwitch(sw, validCombinations);
}
@Test
public void testRotarySwitch4P6T() {
RotarySwitchOpen sw = new RotarySwitchOpen();
String[] validCombinations = new String[] {
"0,6,13", "0,12,14", "0,20,27", "0,26,28",
"1,5,13", "1,11,14", "1,19,27", "1,25,28",
"2,4,13", "2,10,14", "2,18,27", "2,24,28",
"3,3,13", "3,9,14", "3,17,27", "3,23,28",
"4,2,13", "4,8,14", "4,16,27", "4,22,28",
"5,1,13", "5,7,14", "5,15,27", "5,21,28",};
sw.setValue(RotarySwitchOpenType._4P6T);
testSwitch(sw, validCombinations);
}
}
@@ -4,7 +4,7 @@ import org.diylc.components.electromechanical.RotarySwitchSealed;
import org.diylc.components.electromechanical.RotarySwitchSealedType;
import org.junit.Test;
public abstract class RotarySwitchTests extends AbstractSwitchTests {
public abstract class RotarySwitchSealedTests extends AbstractSwitchTests {
@Test
public void testRotarySwitchSP12T() {
@@ -25,7 +25,7 @@ public abstract class RotarySwitchTests extends AbstractSwitchTests {
"0,1,13", "1,2,13", "2,3,13", "3,4,13", "4,5,13", "5,6,13",
"0,7,14", "1,8,14", "2,9,14", "3,10,14", "4,11,14", "5,12,14"};
sw.setValue(RotarySwitchSealedType.DP6T);
sw.setValue(RotarySwitchSealedType._2P6T);
testSwitch(sw, validCombinations);
}