porting tests

This commit is contained in:
edwardhartnett 2019-09-16 11:38:48 -06:00
parent 2cd228bcd4
commit c296a3deb8
2 changed files with 57 additions and 25 deletions

View File

@ -265,36 +265,37 @@ main(int argc, char **argv)
free_NC(ncp);
}
SUMMARIZE_ERR;
/* printf("Testing changing ncid..."); */
/* { */
/* NC *ncp, *ncp2; */
/* int mode = 0; */
/* NCmodel model; */
/* int ret; */
printf("Testing changing ncid...");
{
NC *ncp;
NCmodel model;
NC_GRP_INFO_T *grp;
NC_FILE_INFO_T *h5;
int old_ncid;
/* /\* Create the NC* instance and insert its dispatcher and model. *\/ */
/* if ((ret = new_NC(NULL, FILE_NAME, mode, &model, &ncp))) ERR; */
/* Create the NC, add it to nc_filelist array, add and init
* NC_FILE_INFO_T. */
if (new_NC(NC3_dispatch_table, FILE_NAME, 0, &model, &ncp)) ERR;
add_to_NCList(ncp);
if (nc4_file_list_add(ncp->ext_ncid, FILE_NAME, 0, NULL)) ERR;
if (nc4_find_nc_grp_h5(ncp->ext_ncid, NULL, &grp, &h5)) ERR;
/* /\* Add to list of known open files and define ext_ncid. *\/ */
/* add_to_NCList(ncp); */
/* Change the ncid. */
old_ncid = ncp->ext_ncid;
if (nc4_file_change_ncid(ncp->ext_ncid, TEST_VAL_42)) ERR;
/* /\* Find it in the list. *\/ */
/* if (!(ncp2 = find_in_NCList(ncp->ext_ncid))) ERR; */
/* if (!(ncp2 = find_in_NCList_by_name(FILE_NAME))) ERR; */
/* if ((ret = iterate_NCList(1, &ncp2))) ERR; */
/* if (count_NCList() != 1) ERR; */
/* Can't find old ncid. */
if (nc4_find_nc_grp_h5(old_ncid, NULL, NULL, NULL) != NC_EBADID) ERR;
/* /\* Change the ncid. *\/ */
/* if (nc4_file_change_ncid(ncp->ext_ncid, TEST_VAL_42)) ERR; */
/* Delete it. */
if (nc4_file_list_del(ncp->ext_ncid)) ERR;
del_from_NCList(ncp); /* Will free empty list. */
free_NC(ncp);
/* /\* Delete it. *\/ */
/* del_from_NCList(ncp); /\* Will free empty list. *\/ */
/* free_NC(ncp); */
/* Ensure it is no longer in list. */
/* if (find_in_NCList(ncp->ext_ncid)) ERR; */
/* /\* Ensure it is no longer in list. *\/ */
/* /\* if (find_in_NCList(ncp->ext_ncid)) ERR; *\/ */
/* } */
/* SUMMARIZE_ERR; */
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -77,6 +77,37 @@ main(int argc, char **argv)
if (find_in_NCList(ncid)) ERR;
}
SUMMARIZE_ERR;
printf("Testing moving in NC list (needed for PIO)...");
{
int ncid;
NC *ncp, *ncp2;
int mode = 0;
NCmodel model;
int ret;
/* Create the NC* instance and add it to list. */
if ((ret = new_NC(NULL, FILE_NAME, mode, &model, &ncp))) ERR;
add_to_NCList(ncp);
/* Find it in the list. */
if (!(ncp2 = find_in_NCList(ncp->ext_ncid))) ERR;
/* Move it. */
ncid = ncp->ext_ncid;
if (move_in_NCList(ncp, TEST_VAL_42)) ERR;
/* Now we won't find old ncid in the list. */
if (find_in_NCList(ncid)) ERR;
/* Delete it. */
ncid = ncp->ext_ncid;
del_from_NCList(ncp); /* Will free empty list. */
free_NC(ncp);
/* Ensure it is no longer in list. */
if (find_in_NCList(ncid)) ERR;
}
SUMMARIZE_ERR;
#ifdef LARGE_FILE_TESTS
/* This test is slow, only run it on large file test builds. */
printf("Testing maxing out NC list...");