add tests for state.go