use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class CircuitBuilderTest method testBus.
public void testBus() throws Exception {
final ToBreakRunner runner = new ToBreakRunner("dig/circuitBuilder/busTest.dig", false);
// create truth table incl. ModelAnalyzerInfo
TruthTable tt = new ModelAnalyser(runner.getModel()).analyse();
assertEquals(8, tt.getVars().size());
assertEquals(8, tt.getResultCount());
// create expressions based on truth table
ExpressionListenerStore expr = new ExpressionListenerStore(null);
new ExpressionCreator(tt).create(expr);
// build a new circuit
CircuitBuilder circuitBuilder = new CircuitBuilder(runner.getLibrary().getShapeFactory(), false, tt.getVars()).setModelAnalyzerInfo(tt.getModelAnalyzerInfo());
new BuilderExpressionCreator(circuitBuilder).create(expr);
Circuit circuit = circuitBuilder.createCircuit();
// check
List<VisualElement> in = circuit.findElements(v -> v.equalsDescription(In.DESCRIPTION));
assertEquals(2, in.size());
checkPin(in.get(0), "A", "1,2,3,4");
checkPin(in.get(1), "B", "5,6,7,8");
List<VisualElement> out = circuit.findElements(v -> v.equalsDescription(Out.DESCRIPTION));
assertEquals(2, out.size());
checkPin(out.get(0), "S", "9,10,11,12");
checkPin(out.get(1), "U", "13,14,15,16");
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class ProbeTest method testProbeNesting.
public void testProbeNesting() throws Exception {
Model m = new ToBreakRunner("dig/probe/probeNest.dig").getModel();
ArrayList<Signal> signals = m.getSignals();
assertEquals(6, signals.size());
assertTrue(signals.contains(new Signal("M-Probe1", null)));
assertTrue(signals.contains(new Signal("M-Nest-Probe1", null)));
assertTrue(signals.contains(new Signal("M-Nest-Probe2", null)));
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class ProbeTest method testProbe.
public void testProbe() throws Exception {
Model m = new ToBreakRunner("dig/probe/probe.dig").getModel();
ArrayList<Signal> signals = m.getSignals();
assertEquals(5, signals.size());
assertTrue(signals.contains(new Signal("M-Probe1", null)));
assertTrue(signals.contains(new Signal("M-Probe2", null)));
}
use of de.neemann.digital.integration.ToBreakRunner in project Digital by hneemann.
the class JarComponentManagerTest method testJarAvailable.
public void testJarAvailable() throws PinException, NodeException, IOException, ElementNotFoundException, TestingDataException {
ToBreakRunner br = new ToBreakRunner("dig/jarLib/jarLibTest.dig") {
@Override
public void initLibrary(ElementLibrary library) {
library.addExternalJarComponents(new File(Resources.getRoot(), "dig/jarLib/pluginExample-1.0-SNAPSHOT.jar"));
assertNull(library.checkForException());
}
};
for (VisualElement ve : br.getCircuit().getElements()) {
if (ve.equalsDescription(TestCaseElement.TESTCASEDESCRIPTION)) {
TestCaseDescription td = ve.getElementAttributes().get(TestCaseElement.TESTDATA);
TestExecutor tr = new TestExecutor(td).create(br.getModel());
assertTrue(tr.allPassed());
}
}
}
Aggregations