bool gen_data_config_valid_result_format(const char * result_file_fmt) { if (result_file_fmt) { if (util_is_abs_path( result_file_fmt )) return false; else { if (util_int_format_count(result_file_fmt) == 1) return true; else return false; } } else return false; }
bool model_config_runpath_requires_iter( const model_config_type * model_config ) { if (util_int_format_count( model_config_get_runpath_as_char( model_config)) > 1 ) return true; else return false; }
static void test_export_runpath_file(ert_test_context_type * test_context, const char * job_name, const char * job_file, stringlist_type * args, int_vector_type * iens_values, int_vector_type * iter_values) { ert_test_context_install_workflow_job( test_context , job_name , job_file ); test_assert_true( ert_test_context_run_worklow_job( test_context , job_name , args) ); { const enkf_main_type * enkf_main = ert_test_context_get_main(test_context); qc_module_type * qc_module = enkf_main_get_qc_module( enkf_main ); const char * runpath_file_name = qc_module_get_runpath_list_file(qc_module); ecl_config_type * ecl_config = enkf_main_get_ecl_config(enkf_main); const model_config_type * model_config = enkf_main_get_model_config(enkf_main); const char * base_fmt = ecl_config_get_eclbase(ecl_config); const char * runpath_fmt = model_config_get_runpath_as_char(model_config); test_assert_true(util_file_exists(runpath_file_name)); FILE * file = util_fopen(runpath_file_name, "r"); int file_iens = 0; char file_path[256]; char file_base[256]; int file_iter = 0; char * cwd = util_alloc_cwd(); int counter = 0; int iens_index = 0; int iter_index = 0; while (4 == fscanf( file , "%d %s %s %d" , &file_iens , file_path , file_base, &file_iter)) { ++ counter; test_assert_true(int_vector_size(iens_values) >= iens_index+1); test_assert_true(int_vector_size(iter_values) >= iter_index+1); int iens = int_vector_iget(iens_values, iens_index); int iter = int_vector_iget(iter_values, iter_index); test_assert_int_equal(file_iens, iens); test_assert_int_equal(file_iter, iter); char * base = util_alloc_sprintf("--%d", iens); if (base_fmt && (util_int_format_count(base_fmt) == 1)) base = util_alloc_sprintf(base_fmt, iens); test_assert_string_equal(base, file_base); char * runpath = ""; if (util_int_format_count(runpath_fmt) == 1) runpath = util_alloc_sprintf(runpath_fmt, iens); else if (util_int_format_count(runpath_fmt) == 2) runpath = util_alloc_sprintf(runpath_fmt, iens,iter); test_assert_string_equal(runpath, file_path); if (iens_index+1 < int_vector_size(iens_values)) ++iens_index; else if ((iens_index+1 == int_vector_size(iens_values))) { ++iter_index; iens_index = 0; } free(base); free(runpath); } int linecount = int_vector_size(iens_values) * int_vector_size(iter_values); test_assert_int_equal(linecount, counter); free(cwd); fclose(file); } }