1/* This is part of the netCDF package.
2   Copyright 2010 University Corporation for Atmospheric Research/Unidata
3   See COPYRIGHT file for conditions of use.
4
5   Test netcdf files a bit.
6*/
7
8#include <nc_tests.h>
9#include "err_macros.h"
10#include "netcdf.h"
11
12#define FILE_NAME "tst_files.nc"
13
14int
15main(int argc, char **argv)
16{
17   printf("\n*** Testing netcdf file functions.\n");
18   printf("*** Checking the new inq_path function...");
19   {
20      int ncid;
21      size_t path_len;
22      char path_in[NC_MAX_NAME + 1] = "";
23
24      /* Test with classic file create. */
25      if (nc_create(FILE_NAME, 0, &ncid)) ERR;
26      if (nc_inq_path(ncid, &path_lenpath_in)) ERR;
27      if (path_len != strlen(FILE_NAME) || strcmp(path_inFILE_NAME)) ERR;
28      if (nc_close(ncid)) ERR;
29      strcpy(path_in, "");
30      path_len = 0;
31
32      /* Test with classic file open. */
33      if (nc_open(FILE_NAME, 0, &ncid)) ERR;
34      if (nc_inq_path(ncid, &path_lenpath_in)) ERR;
35      if (path_len != strlen(FILE_NAME) || strcmp(path_inFILE_NAME)) ERR;
36      if (nc_close(ncid)) ERR;
37      strcpy(path_in, "");
38
39      /* Test with netCDF-4 create. */
40      if (nc_create(FILE_NAMENC_NETCDF4, &ncid)) ERR;
41      if (nc_inq_path(ncid, &path_lenpath_in)) ERR;
42      if (path_len != strlen(FILE_NAME) || strcmp(path_inFILE_NAME)) ERR;
43      if (nc_close(ncid)) ERR;
44      strcpy(path_in, "");
45      path_len = 0;
46
47      /* Test with classic file open. */
48      if (nc_open(FILE_NAME, 0, &ncid)) ERR;
49      if (nc_inq_path(ncid, &path_lenpath_in)) ERR;
50      if (path_len != strlen(FILE_NAME) || strcmp(path_inFILE_NAME)) ERR;
51      if (nc_close(ncid)) ERR;
52      strcpy(path_in, "");
53      path_len = 0;
54
55   }
56   SUMMARIZE_ERR;
57   FINAL_RESULTS;
58}


HyperKWIC - Version 7.20DA executed at 11:37 on 27 Oct 2017 | Polyhedron Solutions - INTERNAL USE | COMMERCIAL (Any O/S) SN 4AKIed