-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* This is part of the netCDF package. Copyright 2017 University | ||
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for | ||
conditions of use. See www.unidata.ucar.edu for more info. | ||
Test proper elatefill return when fillvalue is assigned outside of | ||
the initial define. | ||
Contributed by wkliao, see the following for more information: | ||
* https://github.com/Unidata/netcdf-c/issues/384 | ||
* https://github.com/Unidata/netcdf-c/pull/387 | ||
* https://github.com/Unidata/netcdf-c/issues/390 | ||
*/ | ||
|
||
#include "config.h" | ||
#include <nc_tests.h> | ||
#include "err_macros.h" | ||
#include <stdio.h> | ||
#include <netcdf.h> | ||
|
||
#define FILE_NAME "tst_elatefill.nc" | ||
|
||
int | ||
main(int argc, char **argv) | ||
{ | ||
int ncid, dimid, varid, err; | ||
int no_fill, fillv, buf[10]; | ||
|
||
err = nc_create(FILE_NAME, NC_NETCDF4, &ncid); ERR; | ||
err = nc_def_dim(ncid, "dim", 10, &dimid); ERR; | ||
err = nc_def_var(ncid, "var", NC_INT, 1, &dimid, &varid); ERR; | ||
err = nc_enddef(ncid); ERR; | ||
|
||
err = nc_redef(ncid); ERR; | ||
|
||
/* try put attribute _FillValue and expect NC_ELATEFILL */ | ||
fillv = 9; | ||
err = nc_put_att_int(ncid, varid, _FillValue, NC_INT, 1, &fillv); | ||
if (err != NC_ELATEFILL) | ||
printf("line %d expecting NC_ELATEFILL but got %d\n",__LINE__,err); | ||
err = nc_close(ncid); ERR; | ||
return 0; | ||
} |