mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-23 16:59:54 +08:00
Cleaned up tst_atts3.c test program. Fixed several bugs in detection
of NC_ERANGE errors, especially with unsigned types, resolving most NCF-172 issues and confusion between long and long long types in llibsrc/ncx.m4. Eliminated some unnecessary tests, e.g. tests for negative values for unsigned types.
This commit is contained in:
parent
1f4eeafcb9
commit
d6d38094c2
@ -627,6 +627,7 @@ AC_C_BIGENDIAN
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(int)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_SIZEOF(float)
|
||||
AC_CHECK_SIZEOF(double)
|
||||
AC_CHECK_SIZEOF(off_t)
|
||||
|
@ -94,6 +94,9 @@
|
||||
#define X_INT_MIN (-2147483647-1)
|
||||
#define X_INT_MAX 2147483647
|
||||
#define X_UINT_MAX 4294967295U
|
||||
#define X_LONGLONG_MIN (-9223372036854775807LL-1LL)
|
||||
#define X_LONGLONG_MAX 9223372036854775807LL
|
||||
#define X_ULONGLONG_MAX 18446744073709551615ULL
|
||||
#define X_FLOAT_MAX 3.402823466e+38f
|
||||
#define X_FLOAT_MIN (-X_FLOAT_MAX)
|
||||
#define X_FLT_MAX X_FLOAT_MAX /* alias compatible with limits.h */
|
||||
|
@ -48,6 +48,9 @@ dnl
|
||||
#define SHORT_MAX SHRT_MAX
|
||||
#define SHORT_MIN SHRT_MIN
|
||||
#define USHORT_MAX USHRT_MAX
|
||||
#define LONG_LONG_MAX LLONG_MAX
|
||||
#define LONG_LONG_MIN LLONG_MIN
|
||||
#define ULONG_LONG_MAX ULLONG_MAX
|
||||
#include <float.h>
|
||||
#ifndef FLT_MAX /* This POSIX macro missing on some systems */
|
||||
# ifndef NO_IEEE_FLOAT
|
||||
@ -345,6 +348,10 @@ typedef int ix_short;
|
||||
typedef long ix_short;
|
||||
#define SIZEOF_IX_SHORT SIZEOF_LONG
|
||||
#define IX_SHORT_MAX LONG_MAX
|
||||
#elif LLONG_MAX >= X_SHORT_MAX
|
||||
typedef long long ix_short;
|
||||
#define SIZEOF_IX_SHORT SIZEOF_LONG_LONG
|
||||
#define IX_SHORT_MAX LLONG_MAX
|
||||
#else
|
||||
#error "ix_short implementation"
|
||||
#endif
|
||||
@ -442,7 +449,7 @@ ncx_get_short_uint(const void *xp, unsigned int *ip)
|
||||
get_ix_short(xp, &xx);
|
||||
*ip = xx;
|
||||
# if IX_SHORT_MAX > INT_MAX
|
||||
if(xx > INT_MAX || xx < INT_MIN)
|
||||
if(xx > UINT_MAX || xx < 0)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
return ENOERR;
|
||||
@ -452,11 +459,11 @@ ncx_get_short_uint(const void *xp, unsigned int *ip)
|
||||
int
|
||||
ncx_get_short_longlong(const void *xp, long long *ip)
|
||||
{
|
||||
#if SIZEOF_IX_SHORT == SIZEOF_LONG && IX_SHORT_MAX == LONG_MAX
|
||||
#if SIZEOF_IX_SHORT == SIZEOF_LONG_LONG && IX_SHORT_MAX == LONG_LONG_MAX
|
||||
get_ix_short(xp, (ix_short *)ip);
|
||||
return ENOERR;
|
||||
#else
|
||||
/* assert(LONG_MAX >= X_SHORT_MAX); */
|
||||
/* assert(LONG_LONG_MAX >= X_SHORT_MAX); */
|
||||
ix_short xx;
|
||||
get_ix_short(xp, &xx);
|
||||
*ip = xx;
|
||||
@ -471,10 +478,12 @@ ncx_get_short_ulonglong(const void *xp, unsigned long long *ip)
|
||||
get_ix_short(xp, (ix_short *)ip);
|
||||
return ENOERR;
|
||||
#else
|
||||
/* assert(LONG_MAX >= X_SHORT_MAX); */
|
||||
/* assert(LONG_LONG_MAX >= X_SHORT_MAX); */
|
||||
ix_short xx;
|
||||
get_ix_short(xp, &xx);
|
||||
*ip = xx;
|
||||
if(xx < 0)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
#endif
|
||||
}
|
||||
@ -567,7 +576,7 @@ ncx_put_short_uint(void *xp, const unsigned int *ip)
|
||||
ix_short xx = (ix_short)*ip;
|
||||
put_ix_short(xp, &xx);
|
||||
# if X_SHORT_MAX < INT_MAX
|
||||
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
|
||||
if(*ip > X_SHORT_MAX)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
return ENOERR;
|
||||
@ -577,13 +586,13 @@ ncx_put_short_uint(void *xp, const unsigned int *ip)
|
||||
int
|
||||
ncx_put_short_longlong(void *xp, const long long *ip)
|
||||
{
|
||||
#if SIZEOF_IX_SHORT == SIZEOF_LONG && X_SHORT_MAX == LONG_MAX
|
||||
#if SIZEOF_IX_SHORT == SIZEOF_LONG_LONG && X_SHORT_MAX == LONG_LONG_MAX
|
||||
put_ix_short(xp, (const ix_short *)ip);
|
||||
return ENOERR;
|
||||
#else
|
||||
ix_short xx = (ix_short)*ip;
|
||||
put_ix_short(xp, &xx);
|
||||
# if X_SHORT_MAX < LONG_MAX
|
||||
# if X_SHORT_MAX < LONG_LONG_MAX
|
||||
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
@ -594,14 +603,14 @@ ncx_put_short_longlong(void *xp, const long long *ip)
|
||||
int
|
||||
ncx_put_short_ulonglong(void *xp, const unsigned long long *ip)
|
||||
{
|
||||
#if SIZEOF_IX_SHORT == SIZEOF_LONG && X_SHORT_MAX == LONG_MAX
|
||||
#if SIZEOF_IX_SHORT == SIZEOF_LONG_LONG && X_SHORT_MAX == LONG_LONG_MAX
|
||||
put_ix_short(xp, (const ix_short *)ip);
|
||||
return ENOERR;
|
||||
#else
|
||||
ix_short xx = (ix_short)*ip;
|
||||
put_ix_short(xp, &xx);
|
||||
# if X_SHORT_MAX < LONG_MAX
|
||||
if(*ip > X_SHORT_MAX || *ip < X_SHORT_MIN)
|
||||
# if X_SHORT_MAX < LONG_LONG_MAX
|
||||
if(*ip > X_SHORT_MAX)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
return ENOERR;
|
||||
@ -738,19 +747,12 @@ ncx_get_int_int(const void *xp, int *ip)
|
||||
int
|
||||
ncx_get_int_uint(const void *xp, unsigned int *ip)
|
||||
{
|
||||
#if SIZEOF_IX_INT == SIZEOF_INT && IX_INT_MAX == INT_MAX
|
||||
get_ix_int(xp, (ix_int *)ip);
|
||||
return ENOERR;
|
||||
#else
|
||||
ix_int xx;
|
||||
get_ix_int(xp, &xx);
|
||||
*ip = xx;
|
||||
# if IX_INT_MAX > INT_MAX
|
||||
if(xx > INT_MAX || xx < INT_MIN)
|
||||
if(xx > UINT_MAX || xx < 0)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
return ENOERR;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
@ -870,10 +872,8 @@ ncx_put_int_uint(void *xp, const unsigned int *ip)
|
||||
#else
|
||||
ix_int xx = (ix_int)(*ip);
|
||||
put_ix_int(xp, &xx);
|
||||
# if IX_INT_MAX < INT_MAX
|
||||
if(*ip > X_INT_MAX || *ip < X_INT_MIN)
|
||||
if(*ip > X_UINT_MAX)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
return ENOERR;
|
||||
#endif
|
||||
}
|
||||
@ -887,7 +887,7 @@ ncx_put_int_longlong(void *xp, const longlong *ip)
|
||||
#else
|
||||
ix_int xx = (ix_int)(*ip);
|
||||
put_ix_int(xp, &xx);
|
||||
# if IX_INT_MAX < LONG_MAX
|
||||
# if IX_INT_MAX < LONG_LONG_MAX
|
||||
if(*ip > X_INT_MAX || *ip < X_INT_MIN)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
@ -905,7 +905,7 @@ ncx_put_int_ulonglong(void *xp, const unsigned long long *ip)
|
||||
ix_int xx = (ix_int)(*ip);
|
||||
put_ix_int(xp, &xx);
|
||||
# if IX_INT_MAX < LONG_MAX
|
||||
if(*ip > X_INT_MAX || *ip < X_INT_MIN)
|
||||
if(*ip > X_INT_MAX)
|
||||
return NC_ERANGE;
|
||||
# endif
|
||||
return ENOERR;
|
||||
@ -1394,7 +1394,7 @@ ncx_get_float_uint(const void *xp, unsigned int *ip)
|
||||
float xx;
|
||||
get_ix_float(xp, &xx);
|
||||
*ip = (unsigned int) xx;
|
||||
if(xx > (double)INT_MAX || xx < (double)INT_MIN)
|
||||
if(xx > (double)UINT_MAX || xx < 0)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
}
|
||||
@ -1405,7 +1405,7 @@ ncx_get_float_longlong(const void *xp, longlong *ip)
|
||||
float xx;
|
||||
get_ix_float(xp, &xx);
|
||||
*ip = (longlong) xx;
|
||||
if(xx > LONG_MAX || xx < LONG_MIN)
|
||||
if(xx > (double)LONG_LONG_MAX || xx < (double)LONG_LONG_MIN)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
}
|
||||
@ -1416,7 +1416,7 @@ ncx_get_float_ulonglong(const void *xp, unsigned long long *ip)
|
||||
float xx;
|
||||
get_ix_float(xp, &xx);
|
||||
*ip = (longlong) xx;
|
||||
if(xx > LONG_MAX || xx < LONG_MIN)
|
||||
if(xx > (double)ULONG_LONG_MAX || xx < 0)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
}
|
||||
@ -1486,7 +1486,7 @@ ncx_put_float_uint(void *xp, const unsigned int *ip)
|
||||
float xx = (float) *ip;
|
||||
put_ix_float(xp, &xx);
|
||||
#if 1 /* TODO: figure this out */
|
||||
if((float)(*ip) > X_FLOAT_MAX || (float)(*ip) < X_FLOAT_MIN)
|
||||
if((float)(*ip) > X_FLOAT_MAX)
|
||||
return NC_ERANGE;
|
||||
#endif
|
||||
return ENOERR;
|
||||
@ -1510,7 +1510,7 @@ ncx_put_float_ulonglong(void *xp, const unsigned long long *ip)
|
||||
float xx = (float) *ip;
|
||||
put_ix_float(xp, &xx);
|
||||
#if 1 /* TODO: figure this out */
|
||||
if((float)(*ip) > X_FLOAT_MAX || (float)(*ip) < X_FLOAT_MIN)
|
||||
if((float)(*ip) > X_FLOAT_MAX)
|
||||
return NC_ERANGE;
|
||||
#endif
|
||||
return ENOERR;
|
||||
@ -1864,7 +1864,7 @@ ncx_get_double_uint(const void *xp, unsigned int *ip)
|
||||
double xx;
|
||||
get_ix_double(xp, &xx);
|
||||
*ip = (unsigned int) xx;
|
||||
if(xx > INT_MAX || xx < INT_MIN)
|
||||
if(xx > UINT_MAX || xx < 0)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
}
|
||||
@ -1875,7 +1875,7 @@ ncx_get_double_longlong(const void *xp, longlong *ip)
|
||||
double xx;
|
||||
get_ix_double(xp, &xx);
|
||||
*ip = (longlong) xx;
|
||||
if(xx > LONG_MAX || xx < LONG_MIN)
|
||||
if(xx > LONG_LONG_MAX || xx < LONG_LONG_MIN)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
}
|
||||
@ -1885,8 +1885,8 @@ ncx_get_double_ulonglong(const void *xp, unsigned long long *ip)
|
||||
{
|
||||
double xx;
|
||||
get_ix_double(xp, &xx);
|
||||
*ip = (longlong) xx;
|
||||
if(xx > LONG_MAX || xx < LONG_MIN)
|
||||
*ip = (unsigned longlong) xx;
|
||||
if(xx > ULONG_LONG_MAX || xx < 0)
|
||||
return NC_ERANGE;
|
||||
return ENOERR;
|
||||
}
|
||||
@ -1896,7 +1896,7 @@ ncx_get_double_float(const void *xp, float *ip)
|
||||
{
|
||||
double xx;
|
||||
get_ix_double(xp, &xx);
|
||||
if(xx > FLT_MAX || xx < (-FLT_MAX))
|
||||
if(xx > FLT_MAX)
|
||||
{
|
||||
*ip = FLT_MAX;
|
||||
return NC_ERANGE;
|
||||
@ -1965,7 +1965,7 @@ ncx_put_double_uint(void *xp, const unsigned int *ip)
|
||||
double xx = (double) *ip;
|
||||
put_ix_double(xp, &xx);
|
||||
#if 0 /* TODO: figure this out */
|
||||
if((double)(*ip) > X_DOUBLE_MAX || (double)(*ip) < X_DOUBLE_MIN)
|
||||
if((double)(*ip) > X_DOUBLE_MAX)
|
||||
return NC_ERANGE;
|
||||
#endif
|
||||
return ENOERR;
|
||||
@ -1989,7 +1989,7 @@ ncx_put_double_ulonglong(void *xp, const unsigned long long *ip)
|
||||
double xx = (double) *ip;
|
||||
put_ix_double(xp, &xx);
|
||||
#if 1 /* TODO: figure this out */
|
||||
if((double)(*ip) > X_DOUBLE_MAX || (double)(*ip) < X_DOUBLE_MIN)
|
||||
if((double)(*ip) > X_DOUBLE_MAX)
|
||||
return NC_ERANGE;
|
||||
#endif
|
||||
return ENOERR;
|
||||
|
@ -175,30 +175,6 @@ main(int argc, char **argv)
|
||||
|
||||
/* This won't work, because classic files can't create these types. */
|
||||
if (nc_create(FILE_NAME, NC_CLOBBER, &ncid)) ERR;
|
||||
if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_USHORT_NAME, NC_USHORT, ATT_LEN,
|
||||
ushort_out) != NC_EBADTYPE) ERR;
|
||||
if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_UINT_NAME, NC_UINT, ATT_LEN,
|
||||
uint_out) != NC_EBADTYPE) ERR;
|
||||
if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT64_NAME, NC_INT64, ATT_LEN,
|
||||
longlong_out) != NC_EBADTYPE) ERR;
|
||||
if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_UINT64_NAME, NC_UINT64, ATT_LEN,
|
||||
ulonglong_out) != NC_EBADTYPE) ERR;
|
||||
/* But it's OK to put classic types like NC_INT converted from
|
||||
* supported C types, though there may be out-of-range errrors
|
||||
* for some values */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_put_att_uint(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
|
||||
uint_out) != NC_EBADTYPE) ERR;
|
||||
/* This works OK with 64-bit, but on 32-bit returns NC_NOERR, which is a bug */
|
||||
/* if (nc_put_att_longlong(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN, */
|
||||
/* longlong_out) != NC_ERANGE) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_put_att_ulonglong(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
|
||||
ulonglong_out) != NC_EBADTYPE) ERR;
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_put_att_ushort(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
|
||||
ushort_out) != NC_EBADTYPE) ERR;
|
||||
/* restore to intended values for subsequent tests */
|
||||
if (nc_put_att_int(ncid, NC_GLOBAL, ATT_INT_NAME, NC_INT, ATT_LEN,
|
||||
int_out)) ERR;
|
||||
/* It is also OK to read classic types converted into
|
||||
@ -208,25 +184,10 @@ main(int argc, char **argv)
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
if (uchar_in[i] != (unsigned char) int_out[i]) ERR;
|
||||
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_INT_NAME, ushort_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ushort_in[i] != (unsigned short) int_out[i]) ERR; */
|
||||
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_INT_NAME, uint_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (uint_in[i] != (unsigned int) int_out[i]) ERR; */
|
||||
|
||||
/* This was bug NCF-171: on 32-bit platforms, bad values returned */
|
||||
if (nc_get_att_longlong(ncid, NC_GLOBAL, ATT_INT_NAME, longlong_in)) ERR;
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
if (longlong_in[i] != (long long) int_out[i]) ERR;
|
||||
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_INT_NAME, ulonglong_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ulonglong_in[i] != (unsigned long long) int_out[i]) ERR; */
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
||||
/* Create a file with a global attribute of each type. */
|
||||
@ -283,11 +244,6 @@ main(int argc, char **argv)
|
||||
if (nc_get_att_int(ncid, NC_GLOBAL, ATT_TEXT_NAME, int_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_float(ncid, NC_GLOBAL, ATT_TEXT_NAME, float_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_double(ncid, NC_GLOBAL, ATT_TEXT_NAME, double_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_TEXT_NAME, ushort_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_TEXT_NAME, uint_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_long(ncid, NC_GLOBAL, ATT_TEXT_NAME, long_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_longlong(ncid, NC_GLOBAL, ATT_TEXT_NAME, longlong_in) != NC_ECHAR) ERR;
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_TEXT_NAME, ulonglong_in) != NC_ECHAR) ERR;
|
||||
|
||||
/* Read all atts (except text) as double. */
|
||||
if (nc_get_att_double(ncid, NC_GLOBAL, ATT_SCHAR_NAME, double_in)) ERR;
|
||||
@ -340,28 +296,6 @@ main(int argc, char **argv)
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
if (int_in[i] != (int) double_out[i]) ERR;
|
||||
|
||||
/* Read all atts (except text) as uint. */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_SCHAR_NAME, uint_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (uint_in[i] != (unsigned int) schar_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_SHORT_NAME, uint_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (uint_in[i] != (unsigned int) short_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_INT_NAME, uint_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (uint_in[i] != (unsigned int) int_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_FLOAT_NAME, uint_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (uint_in[i] != (unsigned int) float_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_uint(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, uint_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (uint_in[i] != (unsigned int) double_out[i]) ERR; */
|
||||
|
||||
/* Read all atts (except text) as short. */
|
||||
if (nc_get_att_short(ncid, NC_GLOBAL, ATT_SCHAR_NAME, short_in)) ERR;
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
@ -379,28 +313,6 @@ main(int argc, char **argv)
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
if (short_in[i] != (short) double_out[i]) ERR;
|
||||
|
||||
/* Read all atts (except text) as ushort. */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_SCHAR_NAME, ushort_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ushort_in[i] != (unsigned short) schar_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_SHORT_NAME, ushort_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ushort_in[i] != (unsigned short) short_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_INT_NAME, ushort_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ushort_in[i] != (unsigned short) int_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_FLOAT_NAME, ushort_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ushort_in[i] != (unsigned short) float_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ushort(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, ushort_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ushort_in[i] != (unsigned short) double_out[i]) ERR; */
|
||||
|
||||
/* Read all atts (except text) as schar. */
|
||||
if (nc_get_att_schar(ncid, NC_GLOBAL, ATT_SCHAR_NAME, schar_in)) ERR;
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
@ -455,28 +367,6 @@ main(int argc, char **argv)
|
||||
for (i = 0; i < ATT_LEN; i++)
|
||||
if (longlong_in[i] != (long long)double_out[i]) ERR;
|
||||
|
||||
/* Read all atts (except text) into unsigned long long variable. */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_SCHAR_NAME, ulonglong_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ulonglong_in[i] != (unsigned long long) schar_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_SHORT_NAME, ulonglong_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ulonglong_in[i] != (unsigned long long) short_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_INT_NAME, ulonglong_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ulonglong_in[i] != (unsigned long long) int_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_FLOAT_NAME, ulonglong_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ulonglong_in[i] != (unsigned long long) float_out[i]) ERR; */
|
||||
/* This should conditionally return NC_ERANGE, but instead always returns NC_EBADTYPE due to a bug */
|
||||
if (nc_get_att_ulonglong(ncid, NC_GLOBAL, ATT_DOUBLE_NAME, ulonglong_in) != NC_EBADTYPE) ERR;
|
||||
/* for (i = 0; i < ATT_LEN; i++) */
|
||||
/* if (ulonglong_in[i] != (unsigned long long) double_out[i]) ERR; */
|
||||
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
|
Loading…
Reference in New Issue
Block a user