mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-16 08:25:09 -04:00
added a test case for the new layout shape
This commit is contained in:
parent
5fe6af4655
commit
d0d7750b42
@ -45,8 +45,8 @@ public class TestExamples extends TestCase {
|
||||
public void testTestExamples() throws Exception {
|
||||
File examples = new File(Resources.getRoot(), "/dig/test");
|
||||
testCasesInFiles = 0;
|
||||
assertEquals(137, new FileScanner(TestExamples::check).scan(examples));
|
||||
assertEquals(129, testCasesInFiles);
|
||||
assertEquals(139, new FileScanner(TestExamples::check).scan(examples));
|
||||
assertEquals(131, testCasesInFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
256
src/test/resources/dig/test/shapes/4BitAdder.dig
Normal file
256
src/test/resources/dig/test/shapes/4BitAdder.dig
Normal file
@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<attributes>
|
||||
<entry>
|
||||
<string>shapeType</string>
|
||||
<shapeType>LAYOUT</shapeType>
|
||||
</entry>
|
||||
</attributes>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>splitterSpreading</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>1*5</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>5</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="520" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>splitterSpreading</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>4</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>1*4</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="320" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Splitter</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>splitterSpreading</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Input Splitting</string>
|
||||
<string>4</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Output Splitting</string>
|
||||
<string>1*4</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="280" y="40"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="80"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Bits</string>
|
||||
<int>5</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="580" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>c_i</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="220" y="-40"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Adder.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="0"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Adder.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="80"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Adder.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="160"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Adder.dig</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="380" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A B c_i S
|
||||
loop (a,16)
|
||||
loop (b,16)
|
||||
loop (c,2)
|
||||
(a) (b) (c) (a+b+c)
|
||||
end loop
|
||||
end loop
|
||||
end loop
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="160" y="280"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="220" y="80"/>
|
||||
<p2 x="240" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="340"/>
|
||||
<p2 x="520" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="20"/>
|
||||
<p2 x="380" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="20"/>
|
||||
<p2 x="320" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="20"/>
|
||||
<p2 x="520" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="20"/>
|
||||
<p2 x="580" y="20"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="100"/>
|
||||
<p2 x="380" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="100"/>
|
||||
<p2 x="520" y="100"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="180"/>
|
||||
<p2 x="380" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="180"/>
|
||||
<p2 x="520" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="340" y="260"/>
|
||||
<p2 x="380" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="480" y="260"/>
|
||||
<p2 x="520" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="220" y="-40"/>
|
||||
<p2 x="420" y="-40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="280"/>
|
||||
<p2 x="380" y="280"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="200"/>
|
||||
<p2 x="380" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="120"/>
|
||||
<p2 x="380" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="40"/>
|
||||
<p2 x="380" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="40"/>
|
||||
<p2 x="280" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="240" y="40"/>
|
||||
<p2 x="240" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="60"/>
|
||||
<p2 x="420" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="140"/>
|
||||
<p2 x="420" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="220"/>
|
||||
<p2 x="420" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="-40"/>
|
||||
<p2 x="420" y="0"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="300"/>
|
||||
<p2 x="420" y="340"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
250
src/test/resources/dig/test/shapes/Adder.dig
Normal file
250
src/test/resources/dig/test/shapes/Adder.dig
Normal file
@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<circuit>
|
||||
<version>1</version>
|
||||
<attributes>
|
||||
<entry>
|
||||
<string>shapeType</string>
|
||||
<shapeType>LAYOUT</shapeType>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Width</string>
|
||||
<int>5</int>
|
||||
</entry>
|
||||
</attributes>
|
||||
<visualElements>
|
||||
<visualElement>
|
||||
<elementName>XOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="320" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="320" y="220"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>A</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="260" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>B</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="260" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>XOr</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="480" y="40"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>And</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="480" y="120"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>In</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Description</string>
|
||||
<string>carry in</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>rotation</string>
|
||||
<rotation rotation="3"/>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>c_i</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="440" y="20"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Description</string>
|
||||
<string>sum</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>S</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="600" y="60"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Or</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>rotation</string>
|
||||
<rotation rotation="3"/>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="460" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Out</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Description</string>
|
||||
<string>carry out</string>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>rotation</string>
|
||||
<rotation rotation="3"/>
|
||||
</entry>
|
||||
<entry>
|
||||
<string>Label</string>
|
||||
<string>c_o</string>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="440" y="360"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Testcase</elementName>
|
||||
<elementAttributes>
|
||||
<entry>
|
||||
<string>Testdata</string>
|
||||
<testData>
|
||||
<dataString>A B c_i c_o S
|
||||
loop (a,2)
|
||||
loop (b,2)
|
||||
loop (c,2)
|
||||
(a) (b) (c) bits(2,a+b+c)
|
||||
end loop
|
||||
end loop
|
||||
end loop
|
||||
</dataString>
|
||||
</testData>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="340"/>
|
||||
</visualElement>
|
||||
</visualElements>
|
||||
<wires>
|
||||
<wire>
|
||||
<p1 x="300" y="180"/>
|
||||
<p2 x="280" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="180"/>
|
||||
<p2 x="300" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="80"/>
|
||||
<p2 x="440" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="80"/>
|
||||
<p2 x="460" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="160"/>
|
||||
<p2 x="440" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="160"/>
|
||||
<p2 x="480" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="80"/>
|
||||
<p2 x="480" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="240"/>
|
||||
<p2 x="420" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="240"/>
|
||||
<p2 x="560" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="260"/>
|
||||
<p2 x="280" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="260"/>
|
||||
<p2 x="320" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="180"/>
|
||||
<p2 x="320" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="40"/>
|
||||
<p2 x="480" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="120"/>
|
||||
<p2 x="480" y="120"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="260" y="140"/>
|
||||
<p2 x="280" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="140"/>
|
||||
<p2 x="560" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="140"/>
|
||||
<p2 x="320" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="300" y="220"/>
|
||||
<p2 x="320" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="60"/>
|
||||
<p2 x="600" y="60"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="560" y="140"/>
|
||||
<p2 x="560" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="420" y="240"/>
|
||||
<p2 x="420" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="20"/>
|
||||
<p2 x="440" y="40"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="120"/>
|
||||
<p2 x="440" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="320"/>
|
||||
<p2 x="440" y="360"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="440" y="40"/>
|
||||
<p2 x="440" y="80"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="140"/>
|
||||
<p2 x="280" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="280" y="220"/>
|
||||
<p2 x="280" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="240"/>
|
||||
<p2 x="460" y="260"/>
|
||||
</wire>
|
||||
</wires>
|
||||
</circuit>
|
Loading…
x
Reference in New Issue
Block a user