summaryrefslogtreecommitdiffstats
path: root/hl/test/test_table.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-05 21:15:57 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-02-05 21:15:57 (GMT)
commit51875fc8881cdfa0c939fba82b7a00012a2c611e (patch)
tree1ae643e19692541d5e53070a522cc19d1a60784a /hl/test/test_table.c
parenta82e85c2d408386b14859f40c572a3911aaaa682 (diff)
downloadhdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.zip
hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.tar.gz
hdf5-51875fc8881cdfa0c939fba82b7a00012a2c611e.tar.bz2
[svn-r13239]
bug fix on H5TBwrite_fields_index and name functions, the space on the H5Dwrite call was all selected
Diffstat (limited to 'hl/test/test_table.c')
-rw-r--r--hl/test/test_table.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/hl/test/test_table.c b/hl/test/test_table.c
index ff238f7..f0098b4 100644
--- a/hl/test/test_table.c
+++ b/hl/test/test_table.c
@@ -46,9 +46,11 @@
*-------------------------------------------------------------------------
*/
-#define TITLE "Title"
-#define NFIELDS (hsize_t)5
-#define NRECORDS (hsize_t)8
+#define TITLE "Title"
+#define NFIELDS (hsize_t)5
+#define NRECORDS (hsize_t)8
+#define NRECORDS_ADD (hsize_t)3
+
/*-------------------------------------------------------------------------
* structure used for all tests, a particle with properties
@@ -183,15 +185,10 @@ test_table(hid_t fid, int do_write)
float pressure_out [NRECORDS];
int buf_new[NRECORDS] = { 0,1,2,3,4,5,6,7 };
/* buffers for the fields "Latitude,Longitude" */
- position_t position_out[NRECORDS];
- position_t position_in[NRECORDS] = { {0,0},
+ position_t position_out[NRECORDS_ADD];
+ position_t position_in[NRECORDS_ADD] = { {0,0},
{10,10},
- {20,20},
- {30,30},
- {40,40},
- {50,50},
- {60,60},
- {70,70} };
+ {20,20}};
/* buffers for the fields "Name,Pressure" */
namepressure_t namepre_out[NRECORDS];
namepressure_t namepre_in[NRECORDS] =
@@ -906,14 +903,14 @@ test_table(hid_t fid, int do_write)
/* write the pressure field starting at record 2 */
start = 2;
- nrecords = 3;
+ nrecords = NRECORDS_ADD;
if (H5TBwrite_fields_name(fid,"table9","Pressure",start,nrecords,sizeof(float),
0,field_sizes_pre,pressure_in)<0)
goto out;
/* write the new longitude and latitude information starting at record 2 */
start = 2;
- nrecords = 3;
+ nrecords = NRECORDS_ADD;
if (H5TBwrite_fields_name(fid,"table9","Latitude,Longitude",start,nrecords,sizeof(position_t),
field_offset_pos,field_sizes_pos,position_in)<0)
goto out;
@@ -929,9 +926,9 @@ test_table(hid_t fid, int do_write)
{
if ( i >= 2 && i <= 4 )
{
- if ( rbuf[i].lati != position_in[i].lati ||
- rbuf[i].longi != position_in[i].longi ||
- rbuf[i].pressure != pressure_in[i] )
+ if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
+ rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
+ rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] )
{
fprintf(stderr,"%ld %f %d\n",
rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati);
@@ -968,7 +965,7 @@ test_table(hid_t fid, int do_write)
/* write the pressure field to all the records */
start = 0;
- nrecords = NRECORDS;
+ nrecords = NRECORDS_ADD;
if ( H5TBwrite_fields_name(fid,"table10","Pressure",start,nrecords,
sizeof( float ),0,field_sizes_pre,pressure_in)<0)
goto out;
@@ -976,13 +973,13 @@ test_table(hid_t fid, int do_write)
/* read the "Pressure" field */
start = 0;
- nrecords = NRECORDS;
+ nrecords = NRECORDS_ADD;
if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords,
sizeof(float),0,field_sizes_pre,pressure_out)<0)
goto out;
/* Compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
+ for( i = 0; i < NRECORDS_ADD; i++ )
{
if ( pressure_out[i] != pressure_in[i] ) {
goto out;
@@ -997,7 +994,7 @@ test_table(hid_t fid, int do_write)
{
/* Write the new longitude and latitude information to all the records */
start = 0;
- nrecords = NRECORDS;
+ nrecords = NRECORDS_ADD;
if ( H5TBwrite_fields_name(fid,"table10", "Latitude,Longitude", start, nrecords,
sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 )
goto out;
@@ -1005,13 +1002,13 @@ test_table(hid_t fid, int do_write)
/* Read the "Latitude,Longitude" fields */
start = 0;
- nrecords = NRECORDS;
+ nrecords = NRECORDS_ADD;
if ( H5TBread_fields_name( fid, "table10", "Latitude,Longitude",
start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 )
goto out;
/* Compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
+ for( i = 0; i < NRECORDS_ADD; i++ )
{
if ( position_out[i].lati != position_in[i].lati ||
position_out[i].longi != position_in[i].longi )
@@ -1098,7 +1095,7 @@ test_table(hid_t fid, int do_write)
/* write the pressure field starting at record 2 */
nfields = 1;
start = 2;
- nrecords = 3;
+ nrecords = NRECORDS_ADD;
if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pre, start, nrecords,
sizeof( float ), 0, field_sizes_pre, pressure_in ) < 0 )
goto out;
@@ -1107,7 +1104,7 @@ test_table(hid_t fid, int do_write)
/* write the new longitude and latitude information starting at record 2 */
nfields = 2;
start = 2;
- nrecords = 3;
+ nrecords = NRECORDS_ADD;
if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pos, start, nrecords,
sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 )
goto out;
@@ -1125,9 +1122,9 @@ test_table(hid_t fid, int do_write)
{
if ( i >= 2 && i <= 4 )
{
- if ( rbuf[i].lati != position_in[i].lati ||
- rbuf[i].longi != position_in[i].longi ||
- rbuf[i].pressure != pressure_in[i] )
+ if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati ||
+ rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi ||
+ rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] )
goto out;
}
}
@@ -1203,13 +1200,13 @@ test_table(hid_t fid, int do_write)
/* read the "Latitude,Longitude" fields */
nfields = 2;
start = 0;
- nrecords = NRECORDS;
+ nrecords = NRECORDS_ADD;
if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pos,
start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 )
goto out;
/* compare the extracted table with the initial values */
- for( i = 0; i < NRECORDS; i++ )
+ for( i = 0; i < NRECORDS_ADD; i++ )
{
if ( position_out[i].lati != position_in[i].lati ||
position_out[i].longi != position_in[i].longi ) {