Action2<State, System, T1, T2, R> constructor

Action2<State, System, T1, T2, R>(
  1. String description,
  2. Arbitrary<T1> arbitrary1,
  3. Arbitrary<T2> arbitrary2, {
  4. required void nextState(
    1. State,
    2. T1,
    3. T2
    ),
  5. required R run(
    1. System,
    2. T1,
    3. T2
    ),
  6. bool precondition(
    1. State,
    2. T1,
    3. T2
    )?,
  7. bool postcondition(
    1. State,
    2. T1,
    3. T2,
    4. R,
    )?,
})

Creates a new action command with 2 arbitraries.

Parameters:

  • description: The description of the action.
  • arbitrary1: The arbitrary used to generate the first value.
  • arbitrary2: The arbitrary used to generate the second value.
  • run: A function to perform the action.
  • precondition: A function to test the precondition of the action.
  • postcondition: A function to test the postcondition of the action.

Implementation

Action2(
  String description,
  Arbitrary<T1> arbitrary1,
  Arbitrary<T2> arbitrary2, {
  required void Function(State, T1, T2) nextState,
  required R Function(System, T1, T2) run,
  bool Function(State, T1, T2)? precondition,
  bool Function(State, T1, T2, R)? postcondition,
}) : super(
        description,
        combine2(arbitrary1, arbitrary2, (a, b) => (a, b)),
        nextState: (s, args) => nextState(s, args.$1, args.$2),
        run: (sys, args) => run(sys, args.$1, args.$2),
        precondition: (s, args) =>
            precondition?.call(s, args.$1, args.$2) ?? true,
        postcondition: (s, args, r) =>
            postcondition?.call(s, args.$1, args.$2, r) ?? true,
      );