Skip to content

Commit

Permalink
working on vard test
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 5, 2019
1 parent 2ec36c7 commit 328afad
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions tests/cunit/test_darray_vard.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
int ncid; /* The ncid of the netCDF file. */
int ncid2; /* The ncid of the re-opened netCDF file. */
int varid; /* The ID of the netCDF varable. */
int varid2; /* The ID of a netCDF varable of different type. */
int ret; /* Return code. */
MPI_Datatype mpi_type;
int type_size; /* size of a variable of type pio_type */
int other_type; /* another variable of the same size but different type */
PIO_Offset arraylen = 4;
void *fillvalue, *ofillvalue;
void *fillvalue;
void *test_data;
void *test_data_in;
int fillvalue_int = NC_FILL_INT;
Expand Down Expand Up @@ -146,38 +142,13 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
if ((ret = PIOc_def_var(ncid, VAR_NAME, pio_type, NDIM, dimids, &varid)))
ERR(ret);

/* Define a variable with a different type but same size. */
if ((ret = find_mpi_type(pio_type, &mpi_type, &type_size)))
ERR(ret);
if (type_size == NETCDF_INT_FLOAT_SIZE)
other_type = pio_type == PIO_INT ? PIO_FLOAT : PIO_INT;
// else if(type_size == NETCDF_DOUBLE_INT64_SIZE)
// other_type = pio_type == PIO_INT64 ? PIO_DOUBLE : PIO_INT64;
else
other_type = 0; /* skip the test */
switch (other_type)
{
case PIO_INT:
ofillvalue = provide_fill ? &fillvalue_int : NULL;
break;
case PIO_FLOAT:
ofillvalue = provide_fill ? &fillvalue_float : NULL;
break;
default:
break;
}
if (other_type && (ret = PIOc_def_var(ncid, VAR_NAME2, other_type, NDIM, dimids, &varid2)))
ERR(ret);

/* End define mode. */
if ((ret = PIOc_enddef(ncid)))
ERR(ret);

/* Set the value of the record dimension. */
if ((ret = PIOc_setframe(ncid, varid, 0)))
ERR(ret);
if (other_type && (ret = PIOc_setframe(ncid, varid2, 0)))
ERR(ret);

/* These should not work. */
if (PIOc_write_darray(ncid + TEST_VAL_42, varid, ioid, arraylen, test_data, fillvalue) != PIO_EBADID)
Expand All @@ -189,10 +160,6 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
if (PIOc_write_darray(ncid, TEST_VAL_42, ioid, arraylen, test_data, fillvalue) != PIO_ENOTVAR)
ERR(ERR_WRONG);

/* This should work - library type conversion */
if (other_type && (ret = PIOc_write_darray(ncid, varid2, ioid, arraylen, test_data, ofillvalue)))
ERR(ret);

/* Write the data. */
if ((ret = PIOc_write_darray(ncid, varid, ioid, arraylen, test_data, fillvalue)))
ERR(ret);
Expand All @@ -201,7 +168,6 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
if ((ret = PIOc_closefile(ncid)))
ERR(ret);


/* Reopen the file. */
if ((ret = PIOc_openfile(iosysid, &ncid2, &flavor[fmt], filename, PIO_NOWRITE)))
ERR(ret);
Expand Down

0 comments on commit 328afad

Please sign in to comment.