Skip to content

Commit

Permalink
adding more testing, fixing some type stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 5, 2019
1 parent 44030a2 commit bc03efa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/clib/pio_get_vard.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int PIOc_get_vard_text(int ncid, int varid, int decompid,
int PIOc_get_vard_uchar(int ncid, int varid, int decompid,
const PIO_Offset recnum, unsigned char *buf)
{
return PIOc_get_vard_tc(ncid, varid, decompid, recnum, NC_UBYTE, buf);
return PIOc_get_vard_tc(ncid, varid, decompid, recnum, NC_CHAR, buf);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/clib/pio_getput_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,9 @@ PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum,
var_desc_t *vdesc; /* Pointer to var information. */
int ret;

LOG((1, "PIOc_get_vard_tc ncid %d varid %d decompid %d recnum %d "
"xtype %d", ncid, varid, decompid, recnum, xtype));

/* Get file info. */
if ((ret = pio_get_file(ncid, &file)))
return pio_err(NULL, NULL, ret, __FILE__, __LINE__);
Expand All @@ -1465,6 +1468,7 @@ PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum,
/* Get var info. */
if ((ret = get_var_desc(varid, &file->varlist, &vdesc)))
return pio_err(ios, file, ret, __FILE__, __LINE__);
LOG((2, "vdesc->pio_type %d", vdesc->pio_type));

/* Disallow type conversion for now. */
if (xtype != NC_NAT && xtype != vdesc->pio_type)
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 @@ -227,9 +227,41 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor,
ERR(ret);

/* Read the data. */
if ((ret = PIOc_get_vard(ncid2, varid, ioid, 0,
(void *)test_data_in)))
ERR(ret);
switch (pio_type)
{
case PIO_CHAR:
if ((ret = PIOc_get_vard_uchar(ncid2, varid, ioid, 0,
test_data_char_in)))
ERR(ret);
break;
case PIO_BYTE:
if ((ret = PIOc_get_vard_schar(ncid2, varid, ioid, 0,
test_data_byte_in)))
ERR(ret);
break;
case PIO_SHORT:
if ((ret = PIOc_get_vard_short(ncid2, varid, ioid, 0,
test_data_short_in)))
ERR(ret);
break;
case PIO_INT:
if ((ret = PIOc_get_vard_int(ncid2, varid, ioid, 0,
test_data_int_in)))
ERR(ret);
break;
case PIO_FLOAT:
if ((ret = PIOc_get_vard_float(ncid2, varid, ioid, 0,
test_data_float_in)))
ERR(ret);
break;
case PIO_DOUBLE:
if ((ret = PIOc_get_vard_double(ncid2, varid, ioid, 0,
test_data_double_in)))
ERR(ret);
break;
default:
ERR(ERR_WRONG);
}

/* Check the results. */
for (f = 0; f < arraylen; f++)
Expand Down

0 comments on commit bc03efa

Please sign in to comment.