+ @Test\r
+ void xorTest()\r
+ {\r
+ Simulation.TIMELINE.reset();\r
+ Wire a = new Wire(3, 1), b = new Wire(3, 2), c = new Wire(3, 1), d = new Wire(3, 1);\r
+ new XorGate(1, d.createEnd(), a.createReadOnlyEnd(), b.createReadOnlyEnd(), c.createReadOnlyEnd());\r
+ a.createEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);\r
+ b.createEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);\r
+ c.createEnd().feedSignals(Bit.ONE, Bit.ZERO, Bit.ONE);\r
+\r
+ Simulation.TIMELINE.executeAll();\r
+\r
+ assertBitArrayEquals(d.getValues(), Bit.ZERO, Bit.ONE, Bit.ONE);\r
+ }\r
+\r
+ @Test\r
+ void notTest()\r
+ {\r
+ Simulation.TIMELINE.reset();\r
+ Wire a = new Wire(3, 1), b = new Wire(3, 2);\r
+ new NotGate(1, a.createReadOnlyEnd(), b.createEnd());\r
+ a.createEnd().feedSignals(Bit.ZERO, Bit.ONE, Bit.ONE);\r
+\r
+ Simulation.TIMELINE.executeAll();\r
+\r
+ assertBitArrayEquals(b.getValues(), Bit.ONE, Bit.ZERO, Bit.ZERO);\r
+ }\r
+\r
+ @Test\r
+ void rsLatchCircuitTest()\r
+ {\r
+ Simulation.TIMELINE.reset();\r
+ 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);\r
+\r
+ new OrGate(1, t2.createEnd(), r.createReadOnlyEnd(), nq.createReadOnlyEnd());\r
+ new OrGate(1, t1.createEnd(), s.createReadOnlyEnd(), q.createReadOnlyEnd());\r
+ new NotGate(1, t2.createReadOnlyEnd(), q.createEnd());\r
+ new NotGate(1, t1.createReadOnlyEnd(), nq.createEnd());\r
+\r
+ WireEnd sIn = s.createEnd(), rIn = r.createEnd();\r
+\r
+ sIn.feedSignals(Bit.ONE);\r
+ rIn.feedSignals(Bit.ZERO);\r
+\r
+ Simulation.TIMELINE.executeAll();\r