/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 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/HDF5/releases.  *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
 * Programmer:  Neil Fortner <nfortne2@hdfgroup.org>
 *              Thursday, August 14, 2008
 *
 * Purpose: Tests closing the library after reference counts have been
 *          manipulated.
 */
#include "h5test.h"
#define APPREF_DSET "test_dset"
#define APPREF_ATTR "test_attr"
#define APPREF_GROUP "test_grp"
#define ERR_WIDTH   40      /* Width of output for the SIGABRT handler */
#define MAX_NINC    16      /* Maximum increments of a reference count */
/* Macro to increment the reference count on id a random number of times (from
 * 1 to MAX_NINC).  Assumes integers i and ninc are in scope. */
#define RAND_INC(id)                                                           \
    ninc = (HDrand() % MAX_NINC) + 1;                                          \
                                                                               \
    for (i=0; i<ninc; i++)                                                     \
        if (H5Iinc_ref(ids[id]) != i + 2)                                      \
            TEST_ERROR                                                         \
                                                                               \
    rc[id] = ninc + 1;
typedef enum {
    T_FILE,
    T_PLIST,
    T_PCLASS,
    T_TYPE,
    T_SPACE,
    T_DSET,
    T_ATTR,
    T_GROUP,
    T_ECLASS,
    T_EMSG,