Package edu.gatech.cs2110.circuitsim.api
Annotation Type SubcircuitTest
-
@Retention(RUNTIME) public @interface SubcircuitTest
Marks this JUnit test class as testing a subcircuit with the provided.simfile path and subcircuit name.- See Also:
Subcircuit.fromPath(String,String)
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description StringfileThe circuit file to open.StringsubcircuitThe name of the subcircuit in which to search for pins.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description booleanresetSimulationBetweenReset simulation between tests.Class<? extends Restrictor>[]restrictorsValidate the subcircuit with theseRestrictors before running any tests.
-
-
-
Element Detail
-
file
String file
The circuit file to open. Usually a relative path.- Returns:
- the path of a
.simfile - See Also:
Subcircuit.fromPath(String,String)
-
-
-
subcircuit
String subcircuit
The 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:
Subcircuit.fromPath(String,String)
-
-
-
restrictors
Class<? extends Restrictor>[] restrictors
Validate 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:
Restrictor
- Default:
- {}
-
-
-
resetSimulationBetween
boolean resetSimulationBetween
Reset 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:
Subcircuit.resetSimulation()
- Default:
- false
-
-