Check that transient/unnamed types can be queried

This commit is contained in:
Peter Hill 2023-03-10 10:12:56 +00:00
parent 9c18dad567
commit 8589214b93
No known key found for this signature in database
GPG Key ID: 0C6B9742E72848EE

View File

@ -57,10 +57,22 @@ main()
{
int ncid, varid;
double complex read_z;
int num_types, class;
int *typeids;
nc_type base_nc_type;
char name[NC_MAX_NAME];
size_t size, nfields;
nc_set_log_level(4);
if (nc_open(FILE_NAME, NC_NOWRITE, &ncid)) ERR;
if (nc_inq_typeids(ncid, &num_types, NULL)) ERR;
typeids = (int*)malloc((size_t)num_types * sizeof(int));
if (nc_inq_typeids(ncid, NULL, typeids)) ERR;
if (nc_inq_user_type(ncid, typeids[0], name, &size, &base_nc_type, &nfields, &class)) ERR;
/* Verify that the dataset is present */
if (nc_inq_varid(ncid, VAR_NAME, &varid)) ERR;