"""
<Program Name>
  z_test_state_machine_rollback.repy

<Started>
  February 21, 2009

<Purpose>
  To test that TcpStateMachine's rollback() function works.

  Passes quietly
"""
include state_machine.repy

def test_rollback():
  mycontext['sm'].last_state = mycontext['sm'].STATE_SYN_RCVD
  mycontext['sm'].state = mycontext['sm'].STATE_ESTAB
  mycontext['sm'].rollback()
  assert mycontext['sm'].state == mycontext['sm'].STATE_SYN_RCVD

####################
# Test Helper Functions
####################

if callfunc == 'initialize':
  # setup
  mycontext['sm'] = TcpStateMachine()
  
  # Run tests
  test_rollback()

  # teardown
  exitall()
