From 9f079883a681268a312f0f8a6872622fa2bd8ad5 Mon Sep 17 00:00:00 2001 From: hneemann Date: Mon, 2 Jan 2017 16:21:29 +0100 Subject: [PATCH] improved tests in PAL and PLA --- src/main/dig/pld/PAL.dig | 20 ++-- src/main/dig/pld/PLA.dig | 106 ++++++++++++++---- .../digital/integration/TestExamples.java | 2 +- 3 files changed, 95 insertions(+), 33 deletions(-) diff --git a/src/main/dig/pld/PAL.dig b/src/main/dig/pld/PAL.dig index 0e0e483ab..520f3956e 100644 --- a/src/main/dig/pld/PAL.dig +++ b/src/main/dig/pld/PAL.dig @@ -311,11 +311,11 @@ werden. Testdata - A B Y_0 -0 0 0 -0 1 1 -1 0 1 -1 1 0 + A B C Y_0 +0 0 x 0 +0 1 x 1 +1 0 x 1 +1 1 x 0 @@ -536,11 +536,11 @@ werden. Testdata - A B Y_1 -0 0 1 -0 1 0 -1 0 0 -1 1 1 + A B C Y_1 +0 0 x 1 +0 1 x 0 +1 0 x 0 +1 1 x 1 diff --git a/src/main/dig/pld/PLA.dig b/src/main/dig/pld/PLA.dig index 9179c1b40..414ebb126 100644 --- a/src/main/dig/pld/PLA.dig +++ b/src/main/dig/pld/PLA.dig @@ -434,36 +434,25 @@ werden. Testcase + + Label + Y_3 = A or C + Testdata - # y_0 = A xor B -# y_1 = C and D -# y_2 = A or (C and D) -# y_3 = A or C + # y_3 = A or C -A B C D Y_0 Y_1 Y_2 Y_3 -0 0 0 0 0 0 0 0 -0 0 0 1 0 0 0 0 -0 0 1 0 0 0 0 1 -0 0 1 1 0 1 1 1 -0 1 0 0 1 0 0 0 -0 1 0 1 1 0 0 0 -0 1 1 0 1 0 0 1 -0 1 1 1 1 1 1 1 -1 0 0 0 1 0 1 1 -1 0 0 1 1 0 1 1 -1 0 1 0 1 0 1 1 -1 0 1 1 1 1 1 1 -1 1 0 0 0 0 1 1 -1 1 0 1 0 0 1 1 -1 1 1 0 0 0 1 1 -1 1 1 1 0 1 1 1 +A B C D Y_3 +0 x 0 x 0 +0 x 1 x 1 +1 x 0 x 1 +1 x 1 x 1 - + DiodeForeward @@ -994,6 +983,79 @@ A B C D Y_0 Y_1 Y_2 Y_3 + + Testcase + + + Label + Y_0=A xor B + + + Testdata + + # y_0 = A xor B + +A B C D Y_0 +0 0 x x 0 +0 1 x x 1 +1 0 x x 1 +1 1 x x 0 + + + + + + + + Testcase + + + Label + Y_1 = C and D + + + Testdata + + # y_1 = C and D + +A B C D Y_1 +x x 0 0 0 +x x 0 1 0 +x x 1 0 0 +x x 1 1 1 + + + + + + + + Testcase + + + Label + Y_2 = A or (C and D) + + + Testdata + + # Y_2 = A or (C and D) + +A B C D Y_2 +0 x 0 0 0 +0 x 0 1 0 +0 x 1 0 0 +0 x 1 1 1 +1 x 0 0 1 +1 x 0 1 1 +1 x 1 0 1 +1 x 1 1 1 + + + + + + diff --git a/src/test/java/de/neemann/digital/integration/TestExamples.java b/src/test/java/de/neemann/digital/integration/TestExamples.java index 8b5ffd0d0..72821e650 100644 --- a/src/test/java/de/neemann/digital/integration/TestExamples.java +++ b/src/test/java/de/neemann/digital/integration/TestExamples.java @@ -29,7 +29,7 @@ public class TestExamples extends TestCase { public void testDistExamples() throws Exception { File examples = new File(Resources.getRoot().getParentFile().getParentFile(), "/main/dig"); assertEquals(94, new FileScanner(this::check).scan(examples)); - assertEquals(43, testCasesInFiles); + assertEquals(46, testCasesInFiles); } /**