mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-09 12:56:02 -04:00
improved the TestHDLExportFlag testcase
This commit is contained in:
parent
0bf50c38e9
commit
7c2d944856
@ -5,20 +5,59 @@
|
||||
*/
|
||||
package de.neemann.digital.hdl;
|
||||
|
||||
import de.neemann.digital.core.basic.*;
|
||||
import de.neemann.digital.core.element.ElementTypeDescription;
|
||||
import de.neemann.digital.core.io.*;
|
||||
import de.neemann.digital.core.wiring.Clock;
|
||||
import de.neemann.digital.core.wiring.Splitter;
|
||||
import de.neemann.digital.draw.elements.Tunnel;
|
||||
import de.neemann.digital.draw.library.ElementLibrary;
|
||||
import de.neemann.digital.hdl.vhdl2.entities.VHDLTemplate;
|
||||
import de.neemann.digital.testing.TestCaseElement;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class TestHDLExportFlag extends TestCase {
|
||||
|
||||
private static final HashSet<ElementTypeDescription> implicitSupported = new HashSet<>();
|
||||
|
||||
static {
|
||||
implicitSupported.add(And.DESCRIPTION);
|
||||
implicitSupported.add(NAnd.DESCRIPTION);
|
||||
implicitSupported.add(Or.DESCRIPTION);
|
||||
implicitSupported.add(NOr.DESCRIPTION);
|
||||
implicitSupported.add(XOr.DESCRIPTION);
|
||||
implicitSupported.add(XNOr.DESCRIPTION);
|
||||
implicitSupported.add(Not.DESCRIPTION);
|
||||
|
||||
implicitSupported.add(Out.DESCRIPTION);
|
||||
implicitSupported.add(In.DESCRIPTION);
|
||||
implicitSupported.add(Clock.DESCRIPTION);
|
||||
|
||||
implicitSupported.add(Ground.DESCRIPTION);
|
||||
implicitSupported.add(VDD.DESCRIPTION);
|
||||
implicitSupported.add(Const.DESCRIPTION);
|
||||
|
||||
implicitSupported.add(Tunnel.DESCRIPTION);
|
||||
implicitSupported.add(Splitter.DESCRIPTION);
|
||||
|
||||
implicitSupported.add(TestCaseElement.TESTCASEDESCRIPTION);
|
||||
}
|
||||
|
||||
public void testHDLExportFlag() {
|
||||
ElementLibrary lib = new ElementLibrary();
|
||||
for (ElementLibrary.ElementContainer ec : lib) {
|
||||
ElementTypeDescription etd = ec.getDescription();
|
||||
boolean hdlExportFlag = etd.isSupportsHDL();
|
||||
if (VHDLTemplate.isTemplate(etd))
|
||||
boolean isTemplate = VHDLTemplate.isTemplate(etd);
|
||||
if (isTemplate)
|
||||
assertTrue("HDL template available for " + etd.getName(), hdlExportFlag);
|
||||
else {
|
||||
if (hdlExportFlag && !implicitSupported.contains(etd))
|
||||
fail(etd.getName() + " is flagged as supporting HDL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user