Annotation Interface SubcircuitTest
Marks this JUnit test class as testing a subcircuit with the provided
.sim file path and subcircuit name.- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionThe circuit file to open.The name of the subcircuit in which to search for pins. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanReset simulation between tests.Class<? extends Restrictor>[]Validate the subcircuit with theseRestrictors before running any tests.booleanVerify that the test contains a fixed number of input pins.
-
Element Details
-
file
String fileThe circuit file to open. Usually a relative path.- Returns:
- the path of a
.simfile - See Also:
-
subcircuit
String subcircuitThe name of the subcircuit in which to search for pins. Normalized as described inSubcircuit.fromPath(String,String).- Returns:
- the name of the subcircuit. Normalized before lookup
- See Also:
-
restrictors
Class<? extends Restrictor>[] restrictorsValidate the subcircuit with theseRestrictors before running any tests. Useful for checking for banned gates.The idiom is to subclass
Restrictorinside your test class and then callRestrictormethods as needed inside itsvalidate(), such asRestrictor.whitelistComponents()orRestrictor.blacklistComponents()as follows:@DisplayName("Toy ALU") @ExtendWith(CircuitSimExtension.class) @SubcircuitTest(file="toy-alu.sim", subcircuit="ALU", restrictors={ToyALUTests.BannedGates.class}) public class ToyALUTests { public static class BannedGates extends Restrictor { @Override public void validate(Subcircuit subcircuit) throws AssertionError { blacklistComponents(subcircuit, "XOR"); } } // ... }The default is an empty array, so to perform no validation.- Returns:
- restrictor classes to use to validate the subcircuit
- See Also:
- Default:
{}
-
resetSimulationBetween
boolean resetSimulationBetweenReset simulation between tests.Defaults to false because of possible performance (OOM) issues with this behavior.
- Returns:
- true if the simulation should be reset before each test, false if the simulation should never be reset
- See Also:
- Default:
false
-
verifyInputPinCount
boolean verifyInputPinCountVerify that the test contains a fixed number of input pins. This fixed number is determined by the number of InputPin variables with anSubcircuitComponentannotation.Defaults to true as students frequently use input pins in place of constant pins, leading to undesired behavior.
- Returns:
- true if the number of input pins should be verified false if it should not
- Default:
true
-