1 package net.mograsim.logic.core.tests;
3 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
5 import java.util.function.LongConsumer;
7 import net.mograsim.logic.core.components.CoreBitDisplay;
8 import net.mograsim.logic.core.timeline.Timeline;
9 import net.mograsim.logic.core.timeline.TimelineEventHandler;
10 import net.mograsim.logic.core.types.Bit;
11 import net.mograsim.logic.core.wires.CoreWire.ReadEnd;
13 public final class TestCoreBitDisplay extends CoreBitDisplay
16 public TestCoreBitDisplay(Timeline timeline, ReadEnd in)
21 public void assertDisplays(Bit... expected)
23 assertArrayEquals(expected, getDisplayedValue().getBits());
26 public void assertAfterSimulationIs(Bit... expected)
28 timeline.executeAll();
29 assertDisplays(expected);
32 public void assertAfterSimulationIs(LongConsumer r, Bit... expected)
34 while (timeline.hasNext())
36 timeline.executeNext();
37 r.accept(timeline.getSimulationTime());
39 assertDisplays(expected);
43 protected TimelineEventHandler compute()
45 TimelineEventHandler handler = super.compute();
49 System.out.println("update: value is " + getDisplayedValue());