/** * Runs a bunch of events on the given state, printing out the * results, and then returning whether it exited cleanly or not. */ int run_events(State *state, const char *name, int *events) { int i = 0; int rc = 0; State_init(state, &test_actions); debug(">>> RUNNING %s", name); for(i = 0; events[i] != 0; i++) { rc = State_exec(state, events[i], (void *)(intptr_t)i); check(State_invariant(state) != -1, "Failed on processing %d event.", events[i]); } debug("<<< FINAL RESULT: %d, finished: %d", rc, State_invariant(state)); return State_invariant(state); error: return 0; }
int State_finish(State *state) { return State_invariant(state, 0); }