Example #1
0
void test_readonly() {
  {
    state_map_type * map1 = state_map_fread_alloc_readonly("FileDoesNotExist");
    
    test_assert_true(state_map_is_instance(map1));
    test_assert_int_equal(0 , state_map_get_size( map1 ));
    test_assert_true( state_map_is_readonly( map1 ));
    state_map_free(map1);
  }
  {
    test_work_area_type * work_area = test_work_area_alloc("state-map");
    state_map_type * map1 = state_map_alloc();
    
    state_map_iset(map1 , 5 , STATE_INITIALIZED);
    state_map_iset(map1 , 9 , STATE_INITIALIZED);

    state_map_fwrite(map1 , "map1");
    {
      state_map_type * map2 = state_map_fread_alloc_readonly("map1");
      
      test_assert_true(state_map_equal(map1 , map2));
      state_map_free(map2);
    }
    test_work_area_free( work_area );
    state_map_free(map1);
  }
}
Example #2
0
File: enkf_fs.c Project: shulNN/ert
state_map_type * enkf_fs_alloc_readonly_state_map( const char * mount_point ) {
  path_fmt_type * path_fmt = path_fmt_alloc_directory_fmt( DEFAULT_CASE_PATH );
  char * filename = path_fmt_alloc_file( path_fmt , false , mount_point , STATE_MAP_FILE);

  state_map_type * state_map = state_map_fread_alloc_readonly( filename );

  path_fmt_free( path_fmt );
  free( filename );
  return state_map;
}