Ejemplo n.º 1
0
void test_update_matching( ) {
  state_map_type * map = state_map_alloc( );
  
  state_map_iset( map , 10 , STATE_INITIALIZED );
  state_map_iset( map , 3 , STATE_PARENT_FAILURE );
  test_assert_int_equal( STATE_UNDEFINED , state_map_iget( map , 5 ) );
  test_assert_int_equal( STATE_INITIALIZED , state_map_iget( map , 10 ) );

  state_map_update_matching( map , 5 , STATE_UNDEFINED | STATE_LOAD_FAILURE , STATE_INITIALIZED );
  state_map_update_matching( map , 10 , STATE_UNDEFINED | STATE_LOAD_FAILURE , STATE_INITIALIZED );
  state_map_update_matching( map , 3 , STATE_UNDEFINED | STATE_LOAD_FAILURE , STATE_INITIALIZED );
  
  test_assert_int_equal( STATE_INITIALIZED , state_map_iget( map , 5 ) );
  test_assert_int_equal( STATE_INITIALIZED , state_map_iget( map , 10 ) );
  test_assert_int_equal( STATE_PARENT_FAILURE , state_map_iget( map , 3 ) );
  
  state_map_update_undefined( map , 10 , STATE_INITIALIZED );
  test_assert_int_equal( STATE_INITIALIZED , state_map_iget( map , 10 ) );
  
  state_map_free( map );
}
Ejemplo n.º 2
0
void state_map_update_undefined( state_map_type * map , int index , realisation_state_enum new_state) {
  state_map_update_matching( map , index , STATE_UNDEFINED , new_state );
}