Search in sources :

Example 1 with XOr

use of de.neemann.digital.core.basic.XOr in project Digital by hneemann.

the class TestTrans method testTrans.

public void testTrans() throws Exception {
    Model model = new ToBreakRunner("dig/test/transp/transtest3.dig").getModel();
    assertEquals(2, model.getInputs().size());
    assertEquals(1, model.getOutputs().size());
    assertEquals(1, model.getNodes().size());
    Node node = model.getNodes().get(0);
    assertTrue(node instanceof XOr);
    XOr xor = (XOr) node;
    // The models inputs are the xor input values!
    // All the intermediate transparent stuff is removed!
    ArrayList<ObservableValue> ins = new ArrayList<>();
    for (Signal s : model.getInputs()) ins.add(s.getValue());
    assertTrue(ins.contains(xor.getInputs().get(0)));
    assertTrue(ins.contains(xor.getInputs().get(1)));
}
Also used : Signal(de.neemann.digital.core.Signal) Node(de.neemann.digital.core.Node) Model(de.neemann.digital.core.Model) ObservableValue(de.neemann.digital.core.ObservableValue) ArrayList(java.util.ArrayList) XOr(de.neemann.digital.core.basic.XOr)

Aggregations

Model (de.neemann.digital.core.Model)1 Node (de.neemann.digital.core.Node)1 ObservableValue (de.neemann.digital.core.ObservableValue)1 Signal (de.neemann.digital.core.Signal)1 XOr (de.neemann.digital.core.basic.XOr)1 ArrayList (java.util.ArrayList)1