예제 #1
0
파일: gen_kw_test.c 프로젝트: Ensembles/ert
void test_read_erroneous_gen_kw_file() {
  const char * parameter_filename = "MULTFLT_with_errors.txt";
  const char * tmpl_filename = "MULTFLT.tmpl";

  {
    FILE * stream = util_fopen(parameter_filename, "w");
    const char * data = util_alloc_sprintf("MULTFLT1 NORMAL 0\nMULTFLT2 RAW\nMULTFLT3 NORMAL 0");
    util_fprintf_string(data, 30, true, stream);
    util_fclose(stream);

    FILE * tmpl_stream = util_fopen(tmpl_filename, "w");
    const char * tmpl_data = util_alloc_sprintf("<MULTFLT1> <MULTFLT2> <MULTFLT3>\n");
    util_fprintf_string(tmpl_data, 30, true, tmpl_stream);
    util_fclose(tmpl_stream);
  }

  gen_kw_config_type * gen_kw_config = gen_kw_config_alloc_empty("MULTFLT", "<%s>");
  vector_type * arg = vector_alloc_new();
  vector_append_ref( arg , gen_kw_config );
  vector_append_ref(arg, parameter_filename);

  test_assert_util_abort("arg_pack_fscanf", read_erroneous_gen_kw_file,  arg);

  vector_free(arg);
  gen_kw_config_free(gen_kw_config);
}
예제 #2
0
int main( int argc , char ** argv) {
  util_install_signals();
  {
    const char * file = argv[1];

    test_fortio_is_instance( file );
    test_fortio_safe_cast( file );
    test_assert_util_abort("fortio_safe_cast", test_fortio_unsafe_cast, NULL);
    test_existing_read( file );
    test_not_existing_read( );
    test_open_close_read( file );
    test_wrapper( file );
    test_fread_truncated_head();
    test_fread_truncated_data();
    test_fread_truncated_tail();
    test_fread_invalid_tail();
    test_fseek();
    test_at_eof();

    test_write( "/tmp/path/does/not/exist" , false );
    {
      test_work_area_type * work_area = test_work_area_alloc("ecl_fortio.write" );
      util_make_path("path");
      test_write( "path/file.x" , true );
      test_work_area_free( work_area );
    }

    exit(0);
  }
}
예제 #3
0
void test_abort_on_add_NULL() {
  ensemble_config_type * ensemble_config = ensemble_config_alloc();

  test_assert_true( ensemble_config_is_instance( ensemble_config ));
  test_assert_util_abort("ensemble_config_add_node" , add_NULL_node , ensemble_config );

  ensemble_config_free( ensemble_config );
}
예제 #4
0
void test_parse_fail_abort() {
  const char * stdout_file = "bsub_abort";
  {
    FILE * stream = util_fopen(stdout_file , "w");
    fprintf(stream , "Job 12345 is submitted to default queue <normal>.\n");
    fclose( stream );
  }
  test_assert_util_abort( "lsf_job_parse_bsub_stdout" , parse_invalid , (void *) stdout_file );
}
예제 #5
0
void test_add_job() {
  job_list_type * list = job_list_alloc();
  job_queue_node_type * node = job_queue_node_alloc_simple("name" , "/tmp" , "/bin/ls" , 0 , NULL);
  job_list_add_job( list , node );
  test_assert_int_equal( job_list_get_size( list ) , 1 );
  test_assert_int_equal( job_queue_node_get_queue_index(node) ,  0 );
  test_assert_ptr_equal( node , job_list_iget_job(list , 0));
  {
    arg_pack_type * arg_pack = arg_pack_alloc( );
    arg_pack_append_ptr( arg_pack , list );
    arg_pack_append_ptr( arg_pack , node );
    test_assert_util_abort("job_queue_node_set_queue_index", call_add_job, arg_pack );
    arg_pack_free( arg_pack );
  }
  test_assert_util_abort("job_list_iget_job", call_iget_job, list);
  job_list_reset( list );
  test_assert_int_equal( 0 , job_list_get_size( list ));
  job_list_free( list );
}
예제 #6
0
int main(int argc , char ** argv) {
  const char * config_file             =  argv[1];
  ert_test_context_type * test_context = ert_test_context_alloc("gen_kw_test" , config_file , NULL);
  enkf_main_type * enkf_main           = ert_test_context_get_main(test_context);
  test_assert_not_NULL(enkf_main);

  test_write_gen_kw_export_file(enkf_main);
  test_assert_util_abort("gen_kw_ecl_write", test_send_fortio_to_gen_kw_ecl_write, enkf_main);

  ert_test_context_free( test_context );
  exit(0);
}
예제 #7
0
void test_intercept() {
  test_assert_util_abort( "call_util_abort" , call_util_abort , NULL );
}
예제 #8
0
void test_queue_index() {
  job_queue_node_type * node = job_queue_node_alloc_simple( "name" , "/tmp" , "/bin/ls" , 0 , NULL );
  test_assert_util_abort("job_queue_node_get_queue_index" , call_get_queue_index , node );
}
예제 #9
0
void test_create_invalid() {
  test_assert_util_abort( "struct_vector_alloc" , alloc_invalid , NULL );
}
예제 #10
0
void test_abort() {
  int_vector_type * ivec = int_vector_alloc(0,0);
  test_assert_util_abort( "int_vector_assert_index" , int_vector_iget_invalid , ivec );
  int_vector_free( ivec );
}