MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / run

Function run

fendermint/testing/src/smt.rs:62–80  ·  view source on GitHub ↗

Run a state machine test by generating `max_steps` commands. It is expected to panic if some post condition fails.

(
    u: &mut Unstructured,
    t: &T,
    max_steps: usize,
)

Source from the content-addressed store, hash-verified

60///
61/// It is expected to panic if some post condition fails.
62pub fn run<T: StateMachine>(
63 u: &mut Unstructured,
64 t: &T,
65 max_steps: usize,
66) -> arbitrary::Result<()> {
67 let mut state = t.gen_state(u)?;
68 let mut system = t.new_system(&state);
69 for _ in 0..max_steps {
70 ensure_has_randomness(u)?;
71 let cmd = t.gen_command(u, &state)?;
72 let res = t.run_command(&mut system, &cmd);
73 t.check_result(&cmd, &state, res);
74 state = t.next_state(&cmd, state);
75 if !t.check_system(&cmd, &state, &system) {
76 break;
77 }
78 }
79 Ok(())
80}
81
82/// Once we run out of randomness, most of the arbitrary data generated by it will
83/// be zeroes, which is is not very realistic. Calling this method can highlight

Callers 2

counter_with_bugFunction · 0.70
counter_with_seedFunction · 0.70

Calls 8

ensure_has_randomnessFunction · 0.85
gen_stateMethod · 0.45
new_systemMethod · 0.45
gen_commandMethod · 0.45
run_commandMethod · 0.45
check_resultMethod · 0.45
next_stateMethod · 0.45
check_systemMethod · 0.45

Tested by

no test coverage detected