added a new test case for model analyzer

This commit is contained in:
hneemann 2017-05-24 07:38:24 +02:00
parent 02af7a34ef
commit 11aba9f471
2 changed files with 56 additions and 1 deletions

View File

@ -117,6 +117,17 @@ public class ModelAnalyserTest extends TestCase {
public void testAnalyzerMultiBit2() throws Exception {
Model model = new ToBreakRunner("dig/analyze/multiBitInOut.dig", false).getModel();
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));
final BoolTable r0 = tt.getResult(0);
assertEquals(4,r0.size());
@ -134,5 +145,4 @@ public class ModelAnalyserTest extends TestCase {
assertEquals(one,r1.get(3));
}
}

View 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>