Esempio n. 1
0
ui_return_type * ecl_config_validate_refcase( const ecl_config_type * ecl_config , const char * refcase) {
  if (ecl_sum_case_exists( refcase ))
    return ui_return_alloc( UI_RETURN_OK );
  else {
    ui_return_type * ui_return = ui_return_alloc( UI_RETURN_FAIL );
    char * error_msg = util_alloc_sprintf( "Could not load summary case from:%s \n",refcase);
    ui_return_add_error( ui_return , error_msg );
    free( error_msg );
    return ui_return;
  }
}
Esempio n. 2
0
int main( int argc , char ** argv) {
  const char * existing_case = argv[1];
  const char * missing_header = argv[2];
  const char * missing_data   = argv[3];
  test_assert_false( ecl_sum_case_exists( "/does/not/exist" ));

  test_case( existing_case , true);
  test_case_no_path( existing_case , true);

  test_case( missing_header , false);
  test_case_no_path( missing_header , false);

  test_case( missing_data , false);
  test_case_no_path( missing_data , false);
}
Esempio n. 3
0
void test_case_no_path( const char * sum_case , bool expected_exist) {
  path_stack_type * path_stack = path_stack_alloc();
  path_stack_push_cwd( path_stack );
  {
    char * basename , *path;

    util_alloc_file_components( sum_case , &path , &basename , NULL );
    if (path)
      chdir( path );
    test_assert_bool_equal(expected_exist ,  ecl_sum_case_exists( basename ));

    free( path );
    free( basename );
  }
  path_stack_pop( path_stack );
  path_stack_free( path_stack );
}
Esempio n. 4
0
void test_case( const char * sum_case , bool expected_exist) {
  test_assert_bool_equal( expected_exist , ecl_sum_case_exists( sum_case ));
}