Annotation Type SubcircuitTest

    • 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.
      • restrictors

        Class<? extends Restrictor>[] restrictors
        Validate the subcircuit with these Restrictors before running any tests. Useful for checking for banned gates.

        The idiom is to subclass Restrictor inside your test class and then call Restrictor methods as needed inside its validate(), such as Restrictor.whitelistComponents() or Restrictor.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