diff options
Diffstat (limited to 'hl/test/test_table.c')
-rw-r--r-- | hl/test/test_table.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 7bef41d..c475e7f 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -136,8 +136,8 @@ h5file_open(const char *fname, unsigned flags) /* open */ if ((fid = H5Fopen(data_file, flags, H5P_DEFAULT)) < 0) { - HDfprintf(stderr, "Error: Cannot open file <%s>\n", data_file); - HDexit(1); + fprintf(stderr, "Error: Cannot open file <%s>\n", data_file); + exit(1); } return fid; @@ -150,14 +150,14 @@ h5file_open(const char *fname, unsigned flags) static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf) { - if ((HDstrcmp(rbuf[i].name, wbuf[j].name) != 0) || rbuf[i].lati != wbuf[j].lati || + if ((strcmp(rbuf[i].name, wbuf[j].name) != 0) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || !H5_FLT_ABS_EQUAL(rbuf[i].pressure, wbuf[j].pressure) || !H5_DBL_ABS_EQUAL(rbuf[i].temperature, wbuf[j].temperature)) { - HDfprintf(stderr, "read and write buffers have differences\n"); - HDfprintf(stderr, "%s %ld %f %f %d\n", rbuf[i].name, rbuf[i].longi, (double)rbuf[i].pressure, - rbuf[i].temperature, rbuf[i].lati); - HDfprintf(stderr, "%s %ld %f %f %d\n", wbuf[j].name, wbuf[j].longi, (double)wbuf[j].pressure, - wbuf[j].temperature, wbuf[j].lati); + fprintf(stderr, "read and write buffers have differences\n"); + fprintf(stderr, "%s %ld %f %f %d\n", rbuf[i].name, rbuf[i].longi, (double)rbuf[i].pressure, + rbuf[i].temperature, rbuf[i].lati); + fprintf(stderr, "%s %ld %f %f %d\n", wbuf[j].name, wbuf[j].longi, (double)wbuf[j].pressure, + wbuf[j].temperature, wbuf[j].lati); return -1; } return 0; @@ -477,9 +477,9 @@ test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ if (do_write) - HDstrcpy(tname, "table2"); + strcpy(tname, "table2"); else - HDstrcpy(tname, "table1"); + strcpy(tname, "table1"); rstart = 0; rrecords = 8; @@ -617,7 +617,7 @@ test_table(hid_t fid, int do_write) wbufd[i].longi = wbuf[i].longi; wbufd[i].pressure = wbuf[i].pressure; wbufd[i].temperature = wbuf[i].temperature; - HDstrcpy(wbufd[i].name, wbuf[i].name); + strcpy(wbufd[i].name, wbuf[i].name); } if (H5TBmake_table(TITLE, fid, "table3", FIELDS, RECORDS, type_size_mem, field_names, field_offset, @@ -1023,10 +1023,9 @@ test_table(hid_t fid, int do_write) if (rbuf[i].lati != position_in[i - NRECORDS_ADD + 1].lati || rbuf[i].longi != position_in[i - NRECORDS_ADD + 1].longi || !H5_FLT_ABS_EQUAL(rbuf[i].pressure, pressure_in[i - NRECORDS_ADD + 1])) { - HDfprintf(stderr, "%ld %f %d\n", rbuf[i].longi, (double)rbuf[i].pressure, - rbuf[i].lati); - HDfprintf(stderr, "%ld %f %d\n", position_in[i].longi, (double)pressure_in[i], - position_in[i].lati); + fprintf(stderr, "%ld %f %d\n", rbuf[i].longi, (double)rbuf[i].pressure, rbuf[i].lati); + fprintf(stderr, "%ld %f %d\n", position_in[i].longi, (double)pressure_in[i], + position_in[i].lati); goto out; } } @@ -1131,7 +1130,7 @@ test_table(hid_t fid, int do_write) /* Compare the extracted table with the initial values */ for (i = 0; i < NRECORDS; i++) { - if ((HDstrcmp(namepre_out[i].name, namepre_in[i].name) != 0) || + if ((strcmp(namepre_out[i].name, namepre_in[i].name) != 0) || !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[i].pressure)) { goto out; } @@ -1139,7 +1138,7 @@ test_table(hid_t fid, int do_write) /* reset buffer */ for (i = 0; i < NRECORDS; i++) { - HDstrcpy(namepre_out[i].name, "\0"); + strcpy(namepre_out[i].name, "\0"); namepre_out[i].pressure = -1; } @@ -1156,7 +1155,7 @@ test_table(hid_t fid, int do_write) /* Compare the extracted table with the initial values */ for (i = 0; i < 3; i++) { hsize_t iistart = start; - if ((HDstrcmp(namepre_out[i].name, namepre_in[iistart + i].name) != 0) || + if ((strcmp(namepre_out[i].name, namepre_in[iistart + i].name) != 0) || !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart + i].pressure)) { goto out; } @@ -1319,7 +1318,7 @@ test_table(hid_t fid, int do_write) /* compare the extracted table with the initial values */ for (i = 0; i < NRECORDS; i++) { - if ((HDstrcmp(namepre_out[i].name, namepre_in[i].name) != 0) || + if ((strcmp(namepre_out[i].name, namepre_in[i].name) != 0) || !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[i].pressure)) { goto out; } @@ -1327,7 +1326,7 @@ test_table(hid_t fid, int do_write) /* reset buffer */ for (i = 0; i < NRECORDS; i++) { - HDstrcpy(namepre_out[i].name, "\0"); + strcpy(namepre_out[i].name, "\0"); namepre_out[i].pressure = -1; } @@ -1348,7 +1347,7 @@ test_table(hid_t fid, int do_write) /* compare the extracted table with the initial values */ for (i = 0; i < 3; i++) { int iistart = (int)start; - if ((HDstrcmp(namepre_out[i].name, wbuf[iistart + (int)i].name) != 0) || + if ((strcmp(namepre_out[i].name, wbuf[iistart + (int)i].name) != 0) || !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart + (int)i].pressure)) { goto out; } @@ -1384,7 +1383,7 @@ test_table(hid_t fid, int do_write) /* compare the extracted table with the original array */ for (i = 0; i < NRECORDS; i++) { - if ((HDstrcmp(rbuf2[i].name, wbuf[i].name) != 0) || rbuf2[i].lati != wbuf[i].lati || + if ((strcmp(rbuf2[i].name, wbuf[i].name) != 0) || rbuf2[i].lati != wbuf[i].lati || rbuf2[i].longi != wbuf[i].longi || !H5_FLT_ABS_EQUAL(rbuf2[i].pressure, wbuf[i].pressure) || !H5_DBL_ABS_EQUAL(rbuf2[i].temperature, wbuf[i].temperature) || rbuf2[i].new_field != buf_new[i]) { @@ -1420,7 +1419,7 @@ test_table(hid_t fid, int do_write) /* compare the extracted table with the original array */ for (i = 0; i < NRECORDS; i++) { - if ((HDstrcmp(rbuf3[i].name, wbuf[i].name) != 0) || rbuf3[i].lati != wbuf[i].lati || + if ((strcmp(rbuf3[i].name, wbuf[i].name) != 0) || rbuf3[i].lati != wbuf[i].lati || rbuf3[i].longi != wbuf[i].longi || !H5_DBL_ABS_EQUAL(rbuf3[i].temperature, wbuf[i].temperature)) { goto out; @@ -1464,9 +1463,9 @@ test_table(hid_t fid, int do_write) HL_TESTING2("getting field info"); /* allocate */ - names_out = (char **)HDmalloc(sizeof(char *) * (size_t)NFIELDS); + names_out = (char **)malloc(sizeof(char *) * (size_t)NFIELDS); for (i = 0; i < NFIELDS; i++) { - names_out[i] = (char *)HDmalloc(sizeof(char) * 255); + names_out[i] = (char *)malloc(sizeof(char) * 255); } /* Get field info */ @@ -1474,16 +1473,16 @@ test_table(hid_t fid, int do_write) goto out; for (i = 0; i < NFIELDS; i++) { - if ((HDstrcmp(field_names[i], names_out[i]) != 0)) { + if ((strcmp(field_names[i], names_out[i]) != 0)) { goto out; } } /* release */ for (i = 0; i < NFIELDS; i++) { - HDfree(names_out[i]); + free(names_out[i]); } - HDfree(names_out); + free(names_out); PASSED(); @@ -1516,7 +1515,7 @@ main(void) /* create a file using default properties */ fid = H5Fcreate("test_table.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - HDputs("Testing table with file creation mode (read/write in native architecture):"); + puts("Testing table with file creation mode (read/write in native architecture):"); /* test, do write */ if (test_table(fid, 1) < 0) @@ -1529,7 +1528,7 @@ main(void) * test2: open a file written in test1 on a big-endian machine *------------------------------------------------------------------------- */ - HDputs("Testing table with file open mode (read big-endian data):"); + puts("Testing table with file open mode (read big-endian data):"); fid = h5file_open(TEST_FILE_BE, flags); @@ -1544,7 +1543,7 @@ main(void) * test3: open a file written in test1 on a little-endian machine *------------------------------------------------------------------------- */ - HDputs("Testing table with file open mode (read little-endian data):"); + puts("Testing table with file open mode (read little-endian data):"); fid = h5file_open(TEST_FILE_LE, flags); @@ -1559,7 +1558,7 @@ main(void) * test4: open a file written in test1 on the Cray T3 machine *------------------------------------------------------------------------- */ - HDputs("Testing table with file open mode (read Cray data):"); + puts("Testing table with file open mode (read Cray data):"); fid = h5file_open(TEST_FILE_CRAY, flags); |