File: temptySDSs.c

package info (click to toggle)
libhdf4 4.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,384 kB
  • sloc: ansic: 128,700; sh: 15,015; fortran: 12,444; java: 5,863; xml: 1,205; makefile: 794; yacc: 678; pascal: 418; perl: 360; javascript: 203; lex: 163; csh: 41
file content (565 lines) | stat: -rw-r--r-- 21,382 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF.  The full HDF copyright notice, including       *
 * terms governing use, modification, and redistribution, is contained in    *
 * the COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/.  *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/****************************************************************************
 * temptySDS.c - tests the API SDcheckempty.
 * Structure of the file:
 *    test_checkempty - test driver
 *	  test_nonspecial_SDSs - tests nonspecial SDSs without closing file
 *	  test_compressed_SDSs - tests compressed SDSs without closing file
 *	  test_chunked_SDSs    - tests chunked SDSs without closing file
 *	  test_unlimited_SDSs  - tests unlimited dim SDSs without closing file
 *	  test_with_existing_file - tests all SDSs in file after closing the
 *	  			 file and reopening it
 *    check_empty_SDS - utility routine that calls SDcheckempty and verifies
 *		values
 *    check_getchunkinfo - utility routine that calls SDgetchunkinfo and
 *		verifies that function did not fail on empty SDS and the file
 *		is opened as read-only. (bug HDFFR-171)
 ****************************************************************************/

#include "mfhdf.h"

#include "hdftest.h"

#define FILE_NAME "emptySDSs.hdf" /* data file to test empty SDSs */
#define X_LENGTH  10
#define Y_LENGTH  10
#define RANK      2

/* Utility routine that selects that named SDS, then calls SDcheckempty
 * and verifies the returned values. */
static void
check_empty_SDS(int32       fid,          /* file id */
                const char *sds_name,     /* name of the inquired SDS */
                int32       verify_value, /* expected value of 'emptySDS' from SDcheckempty */
                int        *ret_num_errs /* current number of errors */)
{
    int32 sds_id, sds_index, status_32;
    intn  status, emptySDS;
    int   num_errs = 0;
    char  mesg[80];

    /* Get index of dataset using its name */
    sds_index = SDnametoindex(fid, sds_name);
    sprintf(mesg, "In check_empty_SDS: SDnametoindex (%s)", sds_name);
    CHECK(sds_index, FAIL, mesg);

    /* Select the dataset */
    sds_id = SDselect(fid, sds_index);
    CHECK(sds_id, FAIL, "In check_empty_SDS: SDselect");

    /* The returned value from SDcheckempty is CHECKed for FAIL and
       'emptySDS' is verified to be verify_value, which can be TRUE or FALSE. */
    status_32 = SDcheckempty(sds_id, &emptySDS);
    CHECK(status_32, FAIL, "SDcheckempty");
    VERIFY(emptySDS, verify_value, "SDcheckempty");

    /* Close this SDS */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In check_empty_SDS: SDendaccess");

    *ret_num_errs = num_errs;
} /* check_empty_SDS */

/* Utility routine that selects that named SDS, then calls SDgetchunkinfo and
 * verify the returned values.  The routine also verifies that SDgetchunkinfo
 * did not fail when the file is opened as read-only (bug HDFFR-171) */
static void
check_getchunkinfo(int32       fid,          /* file id */
                   const char *sds_name,     /* name of the inquired SDS */
                   int32       verify_value, /* expected value of 'flags' from SDgetchunkinfo */
                   int        *ret_num_errs /* current number of errors */)
{
    int32         sds_id, sds_index;
    HDF_CHUNK_DEF c_def_out; /* Chunking definitions */
    int32         c_flags;
    intn          status;
    int           num_errs = 0;
    char          mesg[80];

    /* Get index of dataset using its name */
    sds_index = SDnametoindex(fid, sds_name);
    sprintf(mesg, "In check_getchunkinfo: SDnametoindex (%s)", sds_name);
    CHECK(sds_index, FAIL, mesg);

    /* Select the dataset */
    sds_id = SDselect(fid, sds_index);
    CHECK(sds_id, FAIL, "In check_getchunkinfo: SDselect");

    /* The returned value from SDgetchunkinfo is CHECKed for FAIL and
       'c_flags' is VERIFied to be verify_value, which can be HDF_NONE,
       HDF_CHUNK, or HDF_CHUNK | HDF_COMP. */
    status = SDgetchunkinfo(sds_id, &c_def_out, &c_flags);
    CHECK(status, FAIL, "SDgetchunkinfo");
    VERIFY(c_flags, verify_value, "SDgetchunkinfo");

    /* Close this SDS */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In check_getchunkinfo: SDendaccess");

    *ret_num_errs = num_errs;
} /* check_getchunkinfo */

/* Test non-special SDSs.  This routine creates non-special SDSs, writes
 * data to one of the SDSs, and checks for emptiness on each without closing
 * the file. */
static intn
test_nonspecial_SDSs(int32 fid)
{
    int32 sds_id;
    int32 dimsize[2], start[2], edges[2];
    int32 data[Y_LENGTH][X_LENGTH];
    intn  status;
    int   i, j;
    int   num_errs = 0; /* number of errors so far */

    /* Initialize data for the dataset */
    for (j = 0; j < Y_LENGTH; j++) {
        for (i = 0; i < X_LENGTH; i++)
            data[j][i] = (i + j) + 1;
    }

    /* Create a 2x2 dataset called "EmptyDataset" */
    dimsize[0] = Y_LENGTH;
    dimsize[1] = X_LENGTH;
    sds_id     = SDcreate(fid, "EmptyDataset", DFNT_FLOAT32, 2, dimsize);
    CHECK(sds_id, FAIL, "In test_nonspecial_SDSs: SDcreate 'EmptyDataset'");

    /* Close this SDS */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_nonspecial_SDSs: SDendaccess");

    /* Check that this SDS is empty */
    check_empty_SDS(fid, "EmptyDataset", TRUE, &num_errs);

    /* Create another 2x2 dataset called "WrittenDataset" */
    sds_id = SDcreate(fid, "WrittenDataset", DFNT_INT32, 2, dimsize);
    CHECK(sds_id, FAIL, "In test_nonspecial_SDSs: SDcreate 'WrittenDataset'");

    /* Define the location and size of the data to be written to the dataset */
    start[0] = 0;
    start[1] = 0;
    edges[0] = Y_LENGTH;
    edges[1] = X_LENGTH;

    /* Write the stored data to the dataset */
    status = SDwritedata(sds_id, start, NULL, edges, (void *)data);
    CHECK(sds_id, FAIL, "In test_nonspecial_SDSs: SDwritedata");

    /* Close this SDS */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_nonspecial_SDSs: SDendaccess");

    /* Check that this SDS is NOT empty */
    check_empty_SDS(fid, "WrittenDataset", FALSE, &num_errs);

    /* Return the number of errors that's been kept track of so far */
    return num_errs;
} /* test_nonspecial_SDSs */

/* Test compressed SDSs.  This routine creates compressed SDSs, writes
 * data to one of the SDSs, and checks for emptiness on each without closing
 * the file. */
static intn
test_compressed_SDSs(int32 fid)
{
    int32     sds_id, esds_id;
    int32     start[2], edges[2], dim_sizes[2];
    int32     comp_type; /* Compression flag */
    comp_info c_info;    /* Compression structure */
    int32     data[Y_LENGTH][X_LENGTH];
    intn      status;
    int       i, j;
    int       num_errs = 0; /* number of errors so far */

    /* Buffer array data and define array dimensions */
    for (j = 0; j < Y_LENGTH; j++) {
        for (i = 0; i < X_LENGTH; i++)
            data[j][i] = (i + j) + 1;
    }
    dim_sizes[0] = Y_LENGTH;
    dim_sizes[1] = X_LENGTH;

    /* Create datasets, one to be written with data, the other not */
    sds_id = SDcreate(fid, "CompressedData", DFNT_INT32, RANK, dim_sizes);
    CHECK(sds_id, FAIL, "In test_compressed_SDSs: SDcreate 'CompressedData'");

    esds_id = SDcreate(fid, "Compressed-No-Data", DFNT_INT32, RANK, dim_sizes);
    CHECK(esds_id, FAIL, "In test_compressed_SDSs: SDcreate 'Compressed-No-Data'");

    comp_type            = COMP_CODE_DEFLATE;
    c_info.deflate.level = 6;
    status               = SDsetcompress(sds_id, comp_type, &c_info);
    CHECK(status, FAIL, "In test_compressed_SDSs: SDsetcompress 'CompressedData'");

    status = SDsetcompress(esds_id, comp_type, &c_info);
    CHECK(status, FAIL, "In test_compressed_SDSs: SDsetcompress 'Compressed-No-Data'");

    /* Define the location and size of the dataset to be written to the file */
    start[0] = 0;
    start[1] = 0;
    edges[0] = Y_LENGTH;
    edges[1] = X_LENGTH;

    /* Write the stored data to the dataset */
    status = SDwritedata(sds_id, start, NULL, edges, (void *)data);
    CHECK(status, FAIL, "In test_compressed_SDSs: SDwritedata");

    /* Close the SDSs */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_compressed_SDSs: SDendaccess 'CompressedData'");

    status = SDendaccess(esds_id);
    CHECK(status, FAIL, "In test_compressed_SDSs: SDendaccess 'Compressed-No-Data'");

    /* Check that this SDS is NOT empty */
    check_empty_SDS(fid, "CompressedData", FALSE, &num_errs);

    /* Check that this SDS is empty */
    check_empty_SDS(fid, "Compressed-No-Data", TRUE, &num_errs);

    /* Return the number of errors that's been kept track of so far */
    return num_errs;
} /* test_compressed_SDSs */

/* Test chunked SDSs.  This routine creates chunked SDSs, writes data
 * to one of the SDSs, and checks for emptiness on each without closing
 * the file. */

#define X_CHUNKED_LENGTH 4
#define Y_CHUNKED_LENGTH 9

static intn
test_chunked_SDSs(int32 fid)
{
    int32         sds_id, esds_id, sds_index;
    int32         flag, maxcache, new_maxcache;
    int32         dim_sizes[RANK], origin[RANK];
    HDF_CHUNK_DEF c_def; /* Chunking definitions */
    int32         comp_flag;
    int16         fill_value = 0; /* Fill value */
    intn          status;
    int           num_errs = 0; /* number of errors so far */

    /* Declare chunks data type and initialize some of them. */
    int16 chunk1[3][2] = {{1, 1}, {1, 1}, {1, 1}};

    int16 chunk2[3][2] = {{2, 2}, {2, 2}, {2, 2}};

    int16 chunk3[3][2] = {{3, 3}, {3, 3}, {3, 3}};

    c_def.chunk_lengths[0] = 3;
    c_def.chunk_lengths[1] = 2;

    /* Create Y_CHUNKED_LENGTH x X_CHUNKED_LENGTH SDS */
    dim_sizes[0] = Y_CHUNKED_LENGTH;
    dim_sizes[1] = X_CHUNKED_LENGTH;
    esds_id      = SDcreate(fid, "Chunked-No-Data", DFNT_INT16, RANK, dim_sizes);
    CHECK(esds_id, FAIL, "In test_chunked_SDSs: SDcreate 'Chunked-No-Data'");

    /* Set info for chunking */
    comp_flag = HDF_CHUNK;
    status    = SDsetchunk(esds_id, c_def, comp_flag);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDsetchunk");

    /* Terminate access to the "Chunked-No-Data" dataset */
    status = SDendaccess(esds_id);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDendaccess 'Chunked-No-Data'");

    /* Check that this SDS is empty */
    check_empty_SDS(fid, "Chunked-No-Data", TRUE, &num_errs);

    /* Create another Y_CHUNKED_LENGTH x X_CHUNKED_LENGTH SDS but this
       one will be written with chunks */
    sds_id = SDcreate(fid, "ChunkedData", DFNT_INT16, RANK, dim_sizes);
    CHECK(sds_id, FAIL, "In test_chunked_SDSs: SDcreate 'ChunkedData'");

    /* Fill the SDS array with the fill value */
    status = SDsetfillvalue(sds_id, (void *)&fill_value);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDsetfillvalue");

    /* Set info for chunking */
    comp_flag = HDF_CHUNK;
    status    = SDsetchunk(sds_id, c_def, comp_flag);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDsetchunk");

    /* Set chunk cache to hold maximum of 3 chunks */
    maxcache     = 3;
    flag         = 0;
    new_maxcache = SDsetchunkcache(sds_id, maxcache, flag);
    CHECK(new_maxcache, FAIL, "In test_chunked_SDSs: SDsetchunkcache");

    /* Terminate access to the dataset then check if it's empty - and it
       should be, before writing data to it. */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDendaccess");

    /* Check that this SDS is still empty after the call to SDsetchunk */
    check_empty_SDS(fid, "ChunkedData", TRUE, &num_errs);

    /* Re-select the "ChunkedData" SDS, then write chunks using SDwritechunk
       function */

    /* Get index of dataset using its name */
    sds_index = SDnametoindex(fid, "ChunkedData");
    CHECK(sds_index, FAIL, "In test_chunked_SDSs: SDnametoindex");

    /* Select the dataset */
    sds_id = SDselect(fid, sds_index);
    CHECK(sds_id, FAIL, "In test_chunked_SDSs: SDselect");

    /* Write the chunk with the coordinates (0,0) */
    origin[0] = 0;
    origin[1] = 0;
    status    = SDwritechunk(sds_id, origin, (void *)chunk1);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDwritechunk");

    /* Write the chunk with the coordinates (1,0) */
    origin[0] = 1;
    origin[1] = 0;
    status    = SDwritechunk(sds_id, origin, (void *)chunk3);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDwritechunk");

    /* Write the chunk with the coordinates (0,1) */
    origin[0] = 0;
    origin[1] = 1;
    status    = SDwritechunk(sds_id, origin, (void *)chunk2);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDwritechunk");

    /* Terminate access to the dataset */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_chunked_SDSs: SDendaccess");

    /* Check that this SDS is NOT empty */
    check_empty_SDS(fid, "ChunkedData", FALSE, &num_errs);

    /* Return the number of errors that's been kept track of so far */
    return num_errs;
} /* test_chunked_SDSs */

/* Test unlimited dimension SDSs.  This routine creates unlimited
 * dimension SDSs, writes data to one of the SDSs, and checks for
 * emptiness on each without closing the file. */
static intn
test_unlimited_SDSs(int32 fid)
{
    int32 sds_id, esds_id, sds_index;
    int32 dim_sizes[2];
    int32 data[Y_LENGTH][X_LENGTH], append_data[X_LENGTH];
    int32 start[2], edges[2];
    intn  status;
    int   i, j;
    int   num_errs = 0; /* number of errors so far */

    /* Data initialization */
    for (j = 0; j < Y_LENGTH; j++) {
        for (i = 0; i < X_LENGTH; i++)
            data[j][i] = (i + 1) + (j + 1);
    }

    /* Define dimensions of the array. Make the first dimension
       appendable by defining its length to be unlimited */
    dim_sizes[0] = SD_UNLIMITED;
    dim_sizes[1] = X_LENGTH;

    /* Create the array datasets */
    esds_id = SDcreate(fid, "Appendable-No-Data", DFNT_INT32, RANK, dim_sizes);
    CHECK(esds_id, FAIL, "In test_unlimited_SDSs: SDcreate 'Appendable-No-Data'");

    sds_id = SDcreate(fid, "AppendableData", DFNT_INT32, RANK, dim_sizes);
    CHECK(sds_id, FAIL, "In test_unlimited_SDSs: SDcreate 'AppendableData'");

    /* Terminate access to the dataset "Appendable-No-Data" */
    status = SDendaccess(esds_id);

    /* Define the location and the size of the data to be written
       to the second dataset  */
    start[0] = start[1] = 0;
    edges[0]            = Y_LENGTH;
    edges[1]            = X_LENGTH;

    /* Write the data */
    status = SDwritedata(sds_id, start, NULL, edges, (void *)data);
    CHECK(status, FAIL, "In test_unlimited_SDSs: SDwritedata");

    /* Terminate access to the unlimited dataset */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_unlimited_SDSs: SDendaccess");

    /* Check that this SDS is NOT empty */
    check_empty_SDS(fid, "AppendableData", FALSE, &num_errs);

    /* Store the array values to be appended to the dataset */
    for (i = 0; i < X_LENGTH; i++)
        append_data[i] = 1000 + i;

    /* Get index of the dataset using its name */
    sds_index = SDnametoindex(fid, "AppendableData");
    CHECK(sds_index, FAIL, "In test_unlimited_SDSs: SDnametoindex");

    /* Select the "AppendableData" dataset */
    sds_id = SDselect(fid, sds_index);
    CHECK(sds_id, FAIL, "In test_unlimited_SDSs: SDselect 'AppendableData'");

    /* Check if selected SDS is unlimited. If it is not, then terminate
       access to the SDS */
    if (SDisrecord(sds_id)) {
        /* Define the location of the append to start at the first column
         * of the 11th row of the dataset and to stop at the end of the
         * eleventh row.  */
        start[0] = Y_LENGTH;
        start[1] = 0;
        edges[0] = 1;
        edges[1] = X_LENGTH;

        /* Append data to the dataset */
        status = SDwritedata(sds_id, start, NULL, edges, (void *)append_data);
        CHECK(status, FAIL, "In test_unlimited_SDSs: SDwritedata");
    }

    /* Terminate access to the dataset */
    status = SDendaccess(sds_id);
    CHECK(status, FAIL, "In test_unlimited_SDSs: SDendaccess");

    /* Check that this SDS is NOT empty */
    check_empty_SDS(fid, "AppendableData", FALSE, &num_errs);

    /* Check that this SDS is empty */
    check_empty_SDS(fid, "Appendable-No-Data", TRUE, &num_errs);

    /* Return the number of errors that's been kept track of so far */
    return num_errs;
} /* test_unlimited_SDSs */

/* This function checks which of the SDSs in the file are empty/written,
 * just as in the previous individual tests.  The difference is these
 * SDSs are read back in after the file is closed and reopened. */
static intn
test_with_existing_file()
{
    int32 fid;
    intn  status;
    int   num_errs = 0; /* number of errors so far */

    /* Open the file and initialize the SD interface */
    fid = SDstart(FILE_NAME, DFACC_READ);
    CHECK(fid, FAIL, "In test_with_existing_file: SDstart");

    /* Check that SDS named "EmptyDataset" is empty */
    check_empty_SDS(fid, "EmptyDataset", TRUE, &num_errs);

    /* Check that SDS named "AppendableData" is NOT empty */
    check_empty_SDS(fid, "AppendableData", FALSE, &num_errs);

    /* Check that SDS named "Appendable-No-Data" is empty */
    check_empty_SDS(fid, "Appendable-No-Data", TRUE, &num_errs);

    /* Check that SDS named "CompressedData" is NOT empty */
    check_empty_SDS(fid, "CompressedData", FALSE, &num_errs);

    /* Check that SDS named "Compressed-No-Data" is empty */
    check_empty_SDS(fid, "Compressed-No-Data", TRUE, &num_errs);

    /* Check that SDS named "ChunkedData" is NOT empty */
    check_empty_SDS(fid, "ChunkedData", FALSE, &num_errs);

    /* Check that SDS named "Chunked-No-Data" is empty */
    check_empty_SDS(fid, "Chunked-No-Data", TRUE, &num_errs);

    /* Close the file */
    status = SDend(fid);
    CHECK(status, FAIL, "In test_with_existing_file: SDend");

    /* Return the number of errors that's been kept track of so far */
    return num_errs;
} /* test_with_existing_file */

/* This function verifies that the bug HDFFR-171 is fixed.  It opens
   the file as read-only, then calls SDgetchunkinfo on some empty SDS's.
   SDgetchunkinfo should not fail and should return HDF_NONE for the flag. */
static intn
test_getchunkinfo()
{
    int32 fid;
    intn  status;
    int   num_errs = 0; /* number of errors so far */

    /* Open the file and initialize the SD interface */
    fid = SDstart(FILE_NAME, DFACC_RDONLY);
    CHECK(fid, FAIL, "In check_getchunkinfo: SDstart");

    /* Check that SDS named "EmptyDataset" is empty */
    check_getchunkinfo(fid, "EmptyDataset", HDF_NONE, &num_errs);

    /* Check that SDS named "AppendableData" is NOT empty */
    check_getchunkinfo(fid, "AppendableData", HDF_NONE, &num_errs);

    /* Check that SDS named "Appendable-No-Data" is empty */
    check_getchunkinfo(fid, "Appendable-No-Data", HDF_NONE, &num_errs);

    /* Check that SDS named "CompressedData" is NOT empty */
    check_getchunkinfo(fid, "CompressedData", HDF_NONE, &num_errs);

    /* Check that SDS named "Compressed-No-Data" is empty */
    check_getchunkinfo(fid, "Compressed-No-Data", HDF_NONE, &num_errs);

    /* Check that SDS named "ChunkedData" is NOT empty */
    check_getchunkinfo(fid, "ChunkedData", HDF_CHUNK, &num_errs);

    /* Check that SDS named "Chunked-No-Data" is empty */
    check_getchunkinfo(fid, "Chunked-No-Data", HDF_CHUNK, &num_errs);

    /* Close the file */
    status = SDend(fid);
    CHECK(status, FAIL, "In check_getchunkinfo: SDend");

    /* Return the number of errors that's been kept track of so far */
    return num_errs;
} /* test_getchunkinfo */

/* Test drive for testing the API SDcheckempty. */
extern int
test_checkempty()
{
    int32 fid;
    intn  status;
    int   num_errs = 0;

    /* Output message about test being performed */
    TESTING("functions involving empty data sets (temptySDSs.c)");

    /* Open the file and initialize the SD interface */
    fid = SDstart(FILE_NAME, DFACC_CREATE);
    CHECK(fid, FAIL, "In test_checkempty: SDstart");

    num_errs = num_errs + test_nonspecial_SDSs(fid);
    num_errs = num_errs + test_compressed_SDSs(fid);
    num_errs = num_errs + test_chunked_SDSs(fid);
    num_errs = num_errs + test_unlimited_SDSs(fid);

    /* Close the file */
    status = SDend(fid);
    CHECK(status, FAIL, "In test_checkempty: SDend");

    /* This function will reopen the file and check the SDSs in it */
    num_errs = num_errs + test_with_existing_file();

    /* This function will reopen the file as read-only to test SDgetchunkinfo
       on empty SDS's */
    num_errs = num_errs + test_getchunkinfo();

    if (num_errs == 0)
        PASSED();
    return num_errs;
}