From 610f00bad978e323355daa53e16dd2783f32accd Mon Sep 17 00:00:00 2001 From: hneemann Date: Tue, 26 Feb 2019 18:41:40 +0100 Subject: [PATCH] added additional test cases, see #255 --- .../digital/core/switching/PlainSwitch.java | 2 +- .../digital/integration/TestExamples.java | 4 +- src/test/resources/dig/test/switch/const2.dig | 598 ++++++++++++++++++ 3 files changed, 601 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/dig/test/switch/const2.dig diff --git a/src/main/java/de/neemann/digital/core/switching/PlainSwitch.java b/src/main/java/de/neemann/digital/core/switching/PlainSwitch.java index 23bfb8e23..dc7cfd705 100644 --- a/src/main/java/de/neemann/digital/core/switching/PlainSwitch.java +++ b/src/main/java/de/neemann/digital/core/switching/PlainSwitch.java @@ -94,7 +94,7 @@ public final class PlainSwitch implements NodeInterface { else { constant = in2.searchConstant(); if (constant != null) - return new UniDirectionalSwitch(constant, output1, true); + return new UniDirectionalSwitch(constant, output1); else return new RealSwitch(in1, in2); } diff --git a/src/test/java/de/neemann/digital/integration/TestExamples.java b/src/test/java/de/neemann/digital/integration/TestExamples.java index 2345cc4b5..425ca85e9 100644 --- a/src/test/java/de/neemann/digital/integration/TestExamples.java +++ b/src/test/java/de/neemann/digital/integration/TestExamples.java @@ -43,8 +43,8 @@ public class TestExamples extends TestCase { */ public void testTestExamples() throws Exception { File examples = new File(Resources.getRoot(), "/dig/test"); - assertEquals(151, new FileScanner(this::check).scan(examples)); - assertEquals(145, testCasesInFiles); + assertEquals(152, new FileScanner(this::check).scan(examples)); + assertEquals(150, testCasesInFiles); } /** diff --git a/src/test/resources/dig/test/switch/const2.dig b/src/test/resources/dig/test/switch/const2.dig new file mode 100644 index 000000000..0700bf918 --- /dev/null +++ b/src/test/resources/dig/test/switch/const2.dig @@ -0,0 +1,598 @@ + + + 1 + + + + Const + + + + + RelayDT + + + rotation + + + + + + + Ground + + + + + In + + + Label + A_1 + + + + + + Out + + + Label + Y_1 + + + + + + Testcase + + + Label + 1 + + + Testdata + + A_1 Y_1 X_1 +0 0 0 +1 z 1 +0 0 0 +1 z 1 + + + + + + + + Const + + + + + RelayDT + + + rotation + + + + + + + Ground + + + + + In + + + Label + A_2 + + + + + + Out + + + Label + Y_2 + + + + + + Const + + + + + RelayDT + + + rotation + + + + + + + Ground + + + + + In + + + Label + A_3 + + + + + + Out + + + Label + Y_3 + + + + + + Out + + + Label + X_1 + + + + + + Out + + + Label + X_2 + + + + + + Out + + + Label + X_3 + + + + + + Testcase + + + Label + 2 + + + Testdata + + A_2 Y_2 X_2 +0 z 1 +1 0 0 +0 z 1 +1 0 0 + + + + + + + + Testcase + + + Label + 3 + + + Testdata + + A_3 Y_3 X_3 +0 z 1 +1 1 z +0 z 1 +1 1 z + + + + + + + + Text + + + Description + see issue #255 + + + + + + PullDown + + + + + Const + + + + + RelayDT + + + rotation + + + + + + + Ground + + + + + In + + + Label + A_4 + + + + + + Out + + + Label + Y_4 + + + + + + Testcase + + + Label + 4 + + + Testdata + + A_4 Y_4 X_4 +0 0 0 +1 0 1 +0 0 0 +1 0 1 + + + + + + + + Out + + + Label + X_4 + + + + + + PullDown + + + + + PullDown + + + + + Const + + + + + RelayDT + + + rotation + + + + + + + Ground + + + + + In + + + Label + A_5 + + + + + + Out + + + Label + Y_5 + + + + + + Testcase + + + Label + 5 + + + Testdata + + A_5 Y_5 X_5 +0 0 0 +1 0 1 +0 0 0 +1 0 1 + + + + + + + + Out + + + Label + X_5 + + + + + + PullDown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file