add state_machine
add tests for state_machine
Merge remote-tracking branch 'origin/state_machine'