Macro hotshot_macros::run_test

source ·
run_test!() { /* proc-macro */ }
Expand description

Macro to run the test suite with TaskState scripts at once with the ability to. Randomize the input values using a consistent seed value.

Note When using random! you should use all_predicates in the output to ensure that the test does not fail due to events happening out of order!

Usage:

run_test[inputs, script1, script2, ...]

The generated test will:

  • take the first entry of inputs, which should be a Vec<HotShotEvent<TYPES>>,
  • if the input is random, it’ll generate a seed and shuffle the inputs.
  • if the input is serial, it will execute in order.
  • print the seed being used.
  • feed this to each task in order, validating any output received before moving on to the next one,
  • repeat the previous steps, with the aggregated outputs received from all tasks used as the new input set,
  • repeat until no more output has been generated by any task, and finally
  • proceed to the next entry of inputs.
  • print the seed being used (again) to make finding it a bit easier.

§Panics

The macro panics if the input stream cannot be parsed. The test will panic if the any of the scripts has a different number of stages from the input.