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.sim
file path and subcircuit name.- See Also:
Subcircuit.fromPath(String,String)
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description String
file
The circuit file to open.String
subcircuit
The name of the subcircuit in which to search for pins.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
resetSimulationBetween
Reset simulation between tests.Class<? extends Restrictor>[]
restrictors
Validate the subcircuit with theseRestrictor
s before running any tests.
-
-
-
Element Detail
-
file
String file
The circuit file to open. Usually a relative path.- Returns:
- the path of a
.sim
file - 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 theseRestrictor
s before running any tests. Useful for checking for banned gates.The idiom is to subclass
Restrictor
inside your test class and then callRestrictor
methods 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
-
-