コード例 #1
0
ファイル: state_tests.c プロジェクト: derdewey/mongrel2
/**
 * 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;
}
コード例 #2
0
ファイル: state.c プロジェクト: bnoordhuis/mongrel2
int State_finish(State *state)
{
    return State_invariant(state, 0);
}