netcdf-c/unit_test/tst_nclist.c

49 lines
1.2 KiB
C
Raw Normal View History

2019-08-09 23:31:24 +08:00
/* This is part of the netCDF package. Copyright 2005-2019 University
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file
for conditions of use.
Test list functions in nclistmgr.c.
Ed Hartnett, 8/10/19
*/
#include "config.h"
#include <nc_tests.h>
2019-08-09 23:38:40 +08:00
#include "nc.h"
2019-08-10 03:37:54 +08:00
#include "ncdispatch.h"
2019-08-09 23:31:24 +08:00
#include "err_macros.h"
int
main(int argc, char **argv)
{
2019-08-10 01:13:55 +08:00
printf("\n*** Testing netcdf internal NC list functions.\n");
printf("Testing NC list functions with no open files...");
{
/* These are cases where there are no files, or NULL
* params. */
if (count_NCList()) ERR;
free_NCList();
if (find_in_NCList_by_name("nope")) ERR;
if (iterate_NCList(0, NULL)) ERR;
}
SUMMARIZE_ERR;
printf("Testing adding to NC list...");
{
2019-08-10 03:37:54 +08:00
NC *ncp;
int mode = 0;
NCmodel model;
char path[] = {"file.nc"};
int ret;
2019-08-09 23:31:24 +08:00
2019-08-10 03:37:54 +08:00
/* Create the NC* instance and insert its dispatcher and model. */
if ((ret = new_NC(NULL, path, mode, &model, &ncp))) ERR;
2019-08-10 01:13:55 +08:00
2019-08-10 03:37:54 +08:00
/* Add to list of known open files and define ext_ncid. */
add_to_NCList(ncp);
/* Where is the allocated memory being freed? */
2019-08-10 01:13:55 +08:00
}
SUMMARIZE_ERR;
FINAL_RESULTS;
2019-08-09 23:31:24 +08:00
}