Skip to content

Commit

Permalink
more tests, fixing char type
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 5, 2019
1 parent bc03efa commit e98dff3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/clib/pio_put_vard.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int
PIOc_put_vard_uchar(int ncid, int varid, int decompid, const PIO_Offset recnum,
const unsigned char *op)
{
return PIOc_put_vard_tc(ncid, varid, decompid, recnum, NC_UBYTE, op);
return PIOc_put_vard_tc(ncid, varid, decompid, recnum, NC_CHAR, op);
}

/**
Expand Down
38 changes: 35 additions & 3 deletions tests/cunit/test_darray_vard.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,41 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor,
test_data) != PIO_ENOTVAR)
ERR(ERR_WRONG);

/* Write the data. */
if ((ret = PIOc_put_vard(ncid, varid, ioid, 0, test_data)))
ERR(ret);
switch (pio_type)
{
case PIO_CHAR:
if ((ret = PIOc_put_vard_uchar(ncid, varid, ioid, 0,
test_data_char)))
ERR(ret);
break;
case PIO_BYTE:
if ((ret = PIOc_put_vard_schar(ncid, varid, ioid, 0,
test_data_byte)))
ERR(ret);
break;
case PIO_SHORT:
if ((ret = PIOc_put_vard_short(ncid, varid, ioid, 0,
test_data_short)))
ERR(ret);
break;
case PIO_INT:
if ((ret = PIOc_put_vard_int(ncid, varid, ioid, 0,
test_data_int)))
ERR(ret);
break;
case PIO_FLOAT:
if ((ret = PIOc_put_vard_float(ncid, varid, ioid, 0,
test_data_float)))
ERR(ret);
break;
case PIO_DOUBLE:
if ((ret = PIOc_put_vard_double(ncid, varid, ioid, 0,
test_data_double)))
ERR(ret);
break;
default:
ERR(ERR_WRONG);
}

/* Close the netCDF file. */
if ((ret = PIOc_closefile(ncid)))
Expand Down

0 comments on commit e98dff3

Please sign in to comment.