+ Simulation.TIMELINE.executeAll();
+
+ assertBitArrayEquals(c.getValues(), Bit.ONE, Bit.ONE, Bit.ZERO, Bit.ONE);
+ }
+
+ @Test
+ void xorTest()
+ {
+ Simulation.TIMELINE.reset();
+ WireArray a = new WireArray(3, 1), b = new WireArray(3, 2), c = new WireArray(3, 1), d = new WireArray(3, 1);
+ new XorGate(1, d, a, b, c);
+ a.createInput().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);
+ b.createInput().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
+ c.createInput().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);
+
+ Simulation.TIMELINE.executeAll();
+
+ assertBitArrayEquals(d.getValues(), Bit.ZERO, Bit.ONE, Bit.ONE);
+ }
+
+ @Test
+ void rsLatchCircuitTest()
+ {
+ Simulation.TIMELINE.reset();
+ WireArray r = new WireArray(1, 1), s = new WireArray(1, 1), t1 = new WireArray(1, 15), t2 = new WireArray(1, 1),
+ q = new WireArray(1, 1), nq = new WireArray(1, 1);
+
+ new OrGate(1, t2, r, nq);
+ new OrGate(1, t1, s, q);
+ new NotGate(1, t2, q);
+ new NotGate(1, t1, nq);
+
+ WireArrayEnd sIn = s.createInput(), rIn = r.createInput();
+
+ sIn.feedSignals(Bit.ONE);
+ rIn.feedSignals(Bit.ZERO);
+
+ Simulation.TIMELINE.executeAll();
+
+ assertEquals(Bit.ONE, q.getValue());
+ assertEquals(Bit.ZERO, nq.getValue());
+
+ sIn.feedSignals(Bit.ZERO);