Tests.class

Purpose
Sequential circuits [as specified in their Implementation.class method] must manually specify their own test cases and test success conditions. This is done through a compiled Java class Tests.

Getting Started
Define a public class Tests with a no-argument constructor and a config method (if present) which matches the config method of the corresponding Implementation.class. Then define...

numTests - Required
public int numTests:

Returns the total number of test cases that will be ran for the circuit. Unless the test is slowable, one test case will be ran every Circuit Block#Circuit Tick. This method is used to set the progress total in the testing UI.

isSlowable - Optional
public boolean isSlowable:

If specified, and it returns false, the player isn't allowed to set the interval between test cases. Otherwise, the player is allowed to change the interval between test cases to something greater than one circuit tick.

inputk - Required
public long input0

public long input1

...

Each inputk method returns the value of the test case input at the current testing tick at the kth input index to the circuit (in the same order as arguments to the corresponding Implementation.class). Make sure to properly set the initial state of the Tests in the config method, because the first invocation of all inputk methods happens before the first invocation of the test method.

If the input widths to the circuit under test are smaller than 64 bits, the higher-order bits of the values returned from these methods will be truncated off.

test - Required
public boolean test(long output0, long output1, ...):

Given the ordered outputs of a circuit corresponding to the same argument order as the "valuek" methods of the Implementation.class, return true if the test is not failing at the current testing tick after having received the inputs from the "inputk" methods of this class. Otherwise, return false to indicate a test failure.

The parameters are the data values flowing through buses into Output circuits in the testing frame. Any high-order bits beyond the width of the implementation's output widths are replaced with zeros.