Search in sources :

Example 1 with BurnException

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

the class DataBusTest method testSimple.

public void testSimple() throws PinException, NodeException {
    ObservableValue a = new ObservableValue("a", 4).setToHighZ();
    ObservableValue b = new ObservableValue("b", 4).setToHighZ();
    Model m = new Model();
    ObservableValue out = new DataBus(null, m, a, b).getReadableOutput();
    a.setValue(1);
    assertEquals(1, out.getValue());
    a.setToHighZ();
    b.setValue(2);
    assertEquals(2, out.getValue());
    b.setToHighZ();
    // try {  ToDo HighZ
    // out.getValue();
    // assertTrue(false);
    // } catch (HighZException e) {
    // assertTrue(true);
    // }
    a.setValue(1);
    b.setValue(1);
    m.doStep();
    a.setValue(0);
    b.setValue(0);
    m.doStep();
    a.setValue(1);
    b.setValue(0);
    try {
        m.doStep();
        assertTrue(true);
    } catch (BurnException e) {
        assertTrue(true);
    }
}
Also used : BurnException(de.neemann.digital.core.BurnException) ObservableValue(de.neemann.digital.core.ObservableValue) Model(de.neemann.digital.core.Model) DataBus(de.neemann.digital.core.wiring.bus.DataBus)

Aggregations

BurnException (de.neemann.digital.core.BurnException)1 Model (de.neemann.digital.core.Model)1 ObservableValue (de.neemann.digital.core.ObservableValue)1 DataBus (de.neemann.digital.core.wiring.bus.DataBus)1