Esempio n. 1
0
void test_copy_file( const char * src_file ) {
  char * filename = util_split_alloc_filename( src_file );
  test_work_area_type * work_area = test_work_area_alloc( "copy-file" );
  test_work_area_copy_file( work_area , src_file );

  test_assert_true( util_file_exists( filename ));

  test_work_area_free( work_area );
  free( filename );
}
Esempio n. 2
0
int main( int argc , char ** argv) {
  const char * src_file = argv[1];
  const char * target_file = argv[2];

  {
    test_work_area_type * work_area = test_work_area_alloc("ecl_file");

    test_work_area_copy_file( work_area , src_file );
    test_loadall(src_file , target_file );

    test_close_stream1( src_file , target_file);
    test_close_stream2( src_file , target_file);
    test_writable( src_file );

    test_work_area_free( work_area );
  }
  test_truncated();
  exit(0);
}
Esempio n. 3
0
File: ecl_file.c Progetto: akva2/ert
void test_writable(const char * src_file ) {
  test_work_area_type * work_area = test_work_area_alloc("ecl_file_writable" );
  char * fname = util_split_alloc_filename( src_file );

  test_work_area_copy_file( work_area , src_file );
  {
    ecl_file_type * ecl_file = ecl_file_open( fname , ECL_FILE_WRITABLE);
    ecl_kw_type * swat = ecl_file_iget_named_kw( ecl_file , "SWAT" , 0 );
    ecl_kw_type * swat0 = ecl_kw_alloc_copy( swat );
    test_assert_true( ecl_kw_equal( swat , swat0 ));
    ecl_kw_iset_float( swat , 0 , 1000.0 );
    ecl_file_save_kw( ecl_file , swat );
    test_assert_true( ecl_file_writable( ecl_file ));
    ecl_file_close( ecl_file );

    ecl_file = ecl_file_open( fname , 0);
    swat = ecl_file_iget_named_kw( ecl_file , "SWAT" , 0 );
    test_assert_true( util_double_approx_equal( ecl_kw_iget_float( swat , 0 ) , 1000 ));
  }
  test_work_area_free( work_area );
}