+ @Test
+ void rsLatchCircuitTest()
+ {
+ Simulation.TIMELINE.reset();
+ Wire r = new Wire(1, 1), s = new Wire(1, 1), t1 = new Wire(1, 15), t2 = new Wire(1, 1),
+ q = new Wire(1, 1), nq = new Wire(1, 1);
+
+ new OrGate(1, t2.createEnd(), r.createEnd(), nq.createEnd());
+ new OrGate(1, t1.createEnd(), s.createEnd(), q.createEnd());
+ new NotGate(1, t2.createEnd(), q.createEnd());
+ new NotGate(1, t1.createEnd(), nq.createEnd());
+
+ WireEnd sIn = s.createEnd(), rIn = r.createEnd();
+
+ 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);
+
+ Simulation.TIMELINE.executeAll();
+ assertEquals(Bit.ONE, q.getValue());
+ assertEquals(Bit.ZERO, nq.getValue());