
Write next_state, the transition function of a download state machine: it returns the state reached from current when e fires, and current unchanged when that pair has no entry in the table.
next_state(IDLE, START)Expected result
IDLE -> RUNNINGFor your own tracking. Tests grade your code.
next_state(PAUSED, FINISH)Expected result
PAUSED -> PAUSEDnext_state(DONE, START)Expected result
DONE -> DONEnext_state x3 from IDLE: START, PAUSE, RESUMEExpected result
IDLE -> RUNNING -> PAUSED -> RUNNINGExpected files
enum_state.cAllowed functions
None. Write every helper yourself.

Write next_state, the transition function of a download state machine: it returns the state reached from current when e fires, and current unchanged when that pair has no entry in the table.
next_state(IDLE, START)Expected result
IDLE -> RUNNINGFor your own tracking. Tests grade your code.
next_state(PAUSED, FINISH)Expected result
PAUSED -> PAUSEDnext_state(DONE, START)Expected result
DONE -> DONEnext_state x3 from IDLE: START, PAUSE, RESUMEExpected result
IDLE -> RUNNING -> PAUSED -> RUNNINGExpected files
enum_state.cAllowed functions
None. Write every helper yourself.

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.
v0.40: Create exercises. Challenge the community.
Meet Studio →