Search in sources :

Example 26 with ToBreakRunner

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");
}
Also used : ModelAnalyser(de.neemann.digital.analyse.ModelAnalyser) TruthTable(de.neemann.digital.analyse.TruthTable) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner) Circuit(de.neemann.digital.draw.elements.Circuit) VisualElement(de.neemann.digital.draw.elements.VisualElement) BuilderExpressionCreator(de.neemann.digital.gui.components.table.BuilderExpressionCreator) ExpressionListenerStore(de.neemann.digital.gui.components.table.ExpressionListenerStore) ExpressionCreator(de.neemann.digital.gui.components.table.ExpressionCreator) BuilderExpressionCreator(de.neemann.digital.gui.components.table.BuilderExpressionCreator)

Example 27 with ToBreakRunner

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)));
}
Also used : Signal(de.neemann.digital.core.Signal) Model(de.neemann.digital.core.Model) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Example 28 with ToBreakRunner

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)));
}
Also used : Signal(de.neemann.digital.core.Signal) Model(de.neemann.digital.core.Model) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner)

Example 29 with ToBreakRunner

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());
        }
    }
}
Also used : TestExecutor(de.neemann.digital.testing.TestExecutor) ToBreakRunner(de.neemann.digital.integration.ToBreakRunner) VisualElement(de.neemann.digital.draw.elements.VisualElement) File(java.io.File) TestCaseDescription(de.neemann.digital.testing.TestCaseDescription)

Aggregations

ToBreakRunner (de.neemann.digital.integration.ToBreakRunner)29 Model (de.neemann.digital.core.Model)16 CodePrinterStr (de.neemann.digital.hdl.printer.CodePrinterStr)6 VisualElement (de.neemann.digital.draw.elements.VisualElement)3 BoolTable (de.neemann.digital.analyse.quinemc.BoolTable)2 Signal (de.neemann.digital.core.Signal)2 Circuit (de.neemann.digital.draw.elements.Circuit)2 HDLCircuit (de.neemann.digital.hdl.model2.HDLCircuit)2 HDLModel (de.neemann.digital.hdl.model2.HDLModel)2 CodePrinter (de.neemann.digital.hdl.printer.CodePrinter)2 File (java.io.File)2 ModelAnalyser (de.neemann.digital.analyse.ModelAnalyser)1 TruthTable (de.neemann.digital.analyse.TruthTable)1 Element (de.neemann.digital.core.element.Element)1 ElementAttributes (de.neemann.digital.core.element.ElementAttributes)1 ElementLibrary (de.neemann.digital.draw.library.ElementLibrary)1 BuilderExpressionCreator (de.neemann.digital.gui.components.table.BuilderExpressionCreator)1 ExpressionCreator (de.neemann.digital.gui.components.table.ExpressionCreator)1 ExpressionListenerStore (de.neemann.digital.gui.components.table.ExpressionListenerStore)1 TestCaseDescription (de.neemann.digital.testing.TestCaseDescription)1