mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-26 22:41:59 -04:00
added a new test case for model analyzer
This commit is contained in:
parent
02af7a34ef
commit
11aba9f471
@ -117,6 +117,17 @@ public class ModelAnalyserTest extends TestCase {
|
|||||||
public void testAnalyzerMultiBit2() throws Exception {
|
public void testAnalyzerMultiBit2() throws Exception {
|
||||||
Model model = new ToBreakRunner("dig/analyze/multiBitInOut.dig", false).getModel();
|
Model model = new ToBreakRunner("dig/analyze/multiBitInOut.dig", false).getModel();
|
||||||
TruthTable tt = new ModelAnalyser(model).analyse();
|
TruthTable tt = new ModelAnalyser(model).analyse();
|
||||||
|
checkIdent(tt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// test with non zero default values set
|
||||||
|
public void testAnalyzerMultiBit3() throws Exception {
|
||||||
|
Model model = new ToBreakRunner("dig/analyze/multiBitInOutDef.dig", false).getModel();
|
||||||
|
TruthTable tt = new ModelAnalyser(model).analyse();
|
||||||
|
checkIdent(tt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkIdent(TruthTable tt) {
|
||||||
assertEquals("B0",tt.getResultName(0));
|
assertEquals("B0",tt.getResultName(0));
|
||||||
final BoolTable r0 = tt.getResult(0);
|
final BoolTable r0 = tt.getResult(0);
|
||||||
assertEquals(4,r0.size());
|
assertEquals(4,r0.size());
|
||||||
@ -134,5 +145,4 @@ public class ModelAnalyserTest extends TestCase {
|
|||||||
assertEquals(one,r1.get(3));
|
assertEquals(one,r1.get(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
45
src/test/resources/dig/analyze/multiBitInOutDef.dig
Normal file
45
src/test/resources/dig/analyze/multiBitInOutDef.dig
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<circuit>
|
||||||
|
<version>1</version>
|
||||||
|
<attributes/>
|
||||||
|
<visualElements>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>In</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>A</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Bits</string>
|
||||||
|
<int>2</int>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Default</string>
|
||||||
|
<int>1</int>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="280" y="220"/>
|
||||||
|
</visualElement>
|
||||||
|
<visualElement>
|
||||||
|
<elementName>Out</elementName>
|
||||||
|
<elementAttributes>
|
||||||
|
<entry>
|
||||||
|
<string>Label</string>
|
||||||
|
<string>B</string>
|
||||||
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Bits</string>
|
||||||
|
<int>2</int>
|
||||||
|
</entry>
|
||||||
|
</elementAttributes>
|
||||||
|
<pos x="320" y="220"/>
|
||||||
|
</visualElement>
|
||||||
|
</visualElements>
|
||||||
|
<wires>
|
||||||
|
<wire>
|
||||||
|
<p1 x="280" y="220"/>
|
||||||
|
<p2 x="320" y="220"/>
|
||||||
|
</wire>
|
||||||
|
</wires>
|
||||||
|
</circuit>
|
Loading…
x
Reference in New Issue
Block a user