From 9abba8efdf4fbd7a5d3899e7db15b48e0fd9fae4 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Tue, 7 Sep 2004 11:42:56 -0500 Subject: [svn-r9213] Purpose: new test for the native types test Description: on the Cray SV1 an INT type was wrongly converted to a SHORT type by the get_native_integer function Choose the type based on the precision; this is to support cases like the Cray SV1, where the size of short is 8 but precision is 32 (e.g an INT (size 8, prec 64) would be converted to a SHORT (size 8, prec 32) if the size was the deciding factor) Solution: Platforms tested: linux solaris aix Misc. update: --- test/ntypes.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 206 insertions(+), 1 deletion(-) diff --git a/test/ntypes.c b/test/ntypes.c index 1427f85..4fe6842 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -28,6 +28,8 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 +#define DIM3 20 + int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1]; @@ -2341,6 +2343,208 @@ error: /*------------------------------------------------------------------------- + * Function: test_ninteger + * + * Purpose: Test the native integer function; made to check the case + * like the Cray SV1, where the size of short is 8 but precision is 32 + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: pvn@ncsa.uiuc.edu + * September 3, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_ninteger(void) +{ + hid_t fid1; /* file ID */ + hid_t fid2; /* file ID */ + hid_t did1; /* dataset ID */ + hid_t did2; /* dataset ID */ + hid_t sid1; /* dataspace ID */ + hid_t dcpl1; /* dataset creation property list ID */ + hid_t dcpl2; /* dataset creation property list ID */ + hid_t tid1; /* file datatype */ + hid_t tid2; /* file datatype */ + hid_t nid1; /* native datatype */ + hid_t nid2; /* native datatype */ + size_t prec1; /* precision */ + size_t prec2; /* precision */ + hsize_t dims[1]={DIM3}; /* dataspace dimensions */ + size_t nsize; /* size of native type */ + hsize_t nelmts; /* number of elements in dataset */ + int rank=1; /* rank of dataset */ + int buf[DIM3]; + int chk[DIM3]; + int i; + + for (i=0; i