mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-18 09:24:42 -04:00
adds a new backtrack test
This commit is contained in:
parent
249df37bd9
commit
b35cce111e
@ -1,10 +1,20 @@
|
||||
package de.neemann.digital.analyse;
|
||||
|
||||
import de.neemann.digital.core.*;
|
||||
import de.neemann.digital.core.element.Element;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.draw.elements.Circuit;
|
||||
import de.neemann.digital.draw.elements.PinException;
|
||||
import de.neemann.digital.draw.elements.VisualElement;
|
||||
import de.neemann.digital.draw.library.ElementLibrary;
|
||||
import de.neemann.digital.draw.library.ElementNotFoundException;
|
||||
import de.neemann.digital.integration.ToBreakRunner;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author hneemann
|
||||
@ -75,4 +85,26 @@ ExpressionCreator - s0 reduced from 17 to 2 variables ([Q_1n, Q_0n])
|
||||
assertEquals(1, da.getInputs(m.getOutputs().get(1)).size());
|
||||
}
|
||||
|
||||
public void testBacktrackCompleteness() throws Exception {
|
||||
ToBreakRunner toBreakRunner = new ToBreakRunner("dig/backtrack/AllComponents.dig", false);
|
||||
Circuit circuit = toBreakRunner.getCircuit();
|
||||
Set<String> set = new HashSet<>();
|
||||
for (VisualElement e : circuit.getElements())
|
||||
set.add(e.getElementName());
|
||||
|
||||
// ensure all components are included in test circuit
|
||||
for (ElementLibrary.ElementContainer c : toBreakRunner.getLibrary()) {
|
||||
if (!set.contains(c.getDescription().getName())) {
|
||||
// nodes with state are allowed to be missing
|
||||
Element n = c.getDescription().createElement(new ElementAttributes());
|
||||
boolean ok = (n instanceof Node) && ((Node) n).hasState();
|
||||
assertTrue("component " + c.getDescription().getName() + " is missing in test/resources/dig/backtrack/AllComponents.dig!", ok);
|
||||
}
|
||||
}
|
||||
|
||||
// check if backtracking is ok at all components!
|
||||
ModelAnalyser m = new ModelAnalyser(toBreakRunner.getModel());
|
||||
new DependencyAnalyser(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
1511
src/test/resources/dig/backtrack/AllComponents.dig
Normal file
1511
src/test/resources/dig/backtrack/AllComponents.dig
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user