• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ H5_FAILED函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中H5_FAILED函数的典型用法代码示例。如果您正苦于以下问题:C++ H5_FAILED函数的具体用法?C++ H5_FAILED怎么用?C++ H5_FAILED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了H5_FAILED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_1g

/*-------------------------------------------------------------------------
 * Function:	test_1g
 *
 * Purpose:	It should be impossible to define an unlimited external file
 *		and then follow it with another external file.
 *
 * Return:	Success:	0
 *
 *		Failure:	number of errors
 *
 * Programmer:	Robb Matzke
 *              Monday, November 23, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static int
test_1g(void)
{
    hid_t	dcpl=-1;		/*dataset creation properties	*/
    herr_t	status;			/*function return status	*/
    int		n;			/*number of external files	*/

    TESTING("external file following unlimited file");
    if ((dcpl=H5Pcreate (H5P_DATASET_CREATE)) < 0) goto error;
    if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error;
    H5E_BEGIN_TRY {
	status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
    } H5E_END_TRY;
    if (status>=0) {
	H5_FAILED();
	puts ("    H5Pset_external() succeeded when it should have failed.");
	goto error;
    }
    if ((n = H5Pget_external_count(dcpl)) < 0) goto error;
    if (1!=n) {
	H5_FAILED();
	puts("    Wrong external file count returned.");
	goto error;
    }
    if (H5Pclose(dcpl) < 0) goto error;
    PASSED();
    return 0;

 error:
    H5E_BEGIN_TRY {
	H5Pclose(dcpl);
    } H5E_END_TRY;
    return 1;
}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:51,代码来源:external.c


示例2: test_3

/*-------------------------------------------------------------------------
 * Function:	test_3
 *
 * Purpose:	Creates a few global heap objects and then removes them all.
 *		The collection should also be removed.
 *
 * Return:	Success:	0
 *
 *		Failure:	number of errors
 *
 * Programmer:	Robb Matzke
 *              Tuesday, March 31, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static int
test_3 (hid_t fapl)
{
    hid_t	file = -1;
    H5F_t 	*f = NULL;
    H5HG_t	obj[1024];
    uint8_t	out[1024];
    int		i;
    size_t	size;
    herr_t	status;
    int		nerrors = 0;
    char	filename[1024];

    TESTING("complete object removal");

    /* Open a clean file */
    h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
    if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
	goto error;
    if(NULL == (f = (H5F_t *)H5I_object(file))) {
	H5_FAILED();
	puts("    Unable to create file");
	goto error;
    }

    /* Create some stuff */
    for (i=0; i<1024; i++) {
	size = i%30+100;
	memset (out, 'A'+i%26, size);
	H5Eclear2(H5E_DEFAULT);
	status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
	if (status<0) {
	    H5_FAILED();
	    puts("    Unable to insert object into global heap");
	    nerrors++;
	}
    }

    /* Remove everything */
    for (i=0; i<1024; i++) {
	status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i);
	if (status<0) {
	    H5_FAILED();
	    puts("    Unable to remove object");
	    nerrors++;
	}
    }

    if (H5Fclose(file)<0) goto error;
    if (nerrors) goto error;
    PASSED();
    return 0;

 error:
    H5E_BEGIN_TRY {
	H5Fclose(file);
    } H5E_END_TRY;
    return MAX(1, nerrors);
}
开发者ID:worst-nick-ever,项目名称:hdf5,代码行数:76,代码来源:gheap.c


示例3: test_decrement

/*-------------------------------------------------------------------------
 * Function:	test_decrement
 *
 * Purpose:	Test operation to decrement bit vector by 1.
 *
 * Return:	Success:	0
 *
 *		Failure:	-1
 *
 * Programmer:	Raymond Lu
 *              Monday, April 12, 2004
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static herr_t
test_decrement (void)
{
    uint8_t	vector[8];
    size_t	offset, size;
    int	        i, j;
    ssize_t	n;

    TESTING("bit decrement operations");

    for (i=0; i<NTESTS; i++) {
	offset = HDrand() % (8*sizeof vector);
	size = (unsigned)HDrand() % (8*sizeof(vector)-offset);
        /* Don't want size to be 0 */
        if(size == 0) continue;

        /* All-zero sequence will become 111111(size=6) after decrement */
	memset (vector, 0x00, sizeof vector);

	/* decrement the sequence by one */
        H5T_bit_dec (vector, offset, size);

	/* Look for the ones */
	n = H5T_bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_LSB, 1);
	if ((size_t)n!=offset) {
	    H5_FAILED();
	    printf ("    Unable to find first bit in destination "
		    "(n=%d)\n", (int)n);
	    goto failed;
	}

	/*
	 * Look for zeros and ones in reverse order.  This is only to test
	 * that reverse searches work as expected.
	 */
	n = H5T_bit_find (vector, (size_t)0, 8*sizeof(vector), H5T_BIT_MSB, 1);
	if (n!=(ssize_t)(offset+size-1)) {
	    H5_FAILED();
	    printf ("    Unable to find last bit in destination "
		    "(reverse, n=%d)\n", (int)n);
	    goto failed;
	}
    }

    PASSED();
    return 0;

 failed:
    printf ("    i=%d, offset=%lu, size=%lu\n",
	    i, (unsigned long)offset, (unsigned long)size);
    for (j=sizeof(vector)-1; j>=0; --j) printf ("%02x", vector[j]);
    printf ("\n");
    return -1;
}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:70,代码来源:bittests.c


示例4: test_create_close

static int test_create_close(hid_t fid)
{
    herr_t err;
    hid_t table;
    hid_t part_t;

    TESTING("H5PTcreate_fl and H5PTclose");

    /* Create a datatype for the particle struct */
    part_t = make_particle_type();

    HDassert(part_t != -1);

    /* Create the table */
    table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1);
    H5Tclose(part_t);
    if( H5PTis_valid(table) < 0)
	goto error;
    if( H5PTis_varlen(table) != 0)
	goto error;

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto error;

    PASSED();
    return SUCCEED;

error:
      H5_FAILED();
      return FAIL;
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:33,代码来源:test_packet.c


示例5: test_1h

/*-------------------------------------------------------------------------
 * Function:	test_1h
 *
 * Purpose:	It should be impossible to create a set of external files
 *		whose total size overflows a size_t integer.
 *
 * Return:	Success:	0
 *
 *		Failure:	number of errors
 *
 * Programmer:	Robb Matzke
 *              Monday, November 23, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static int
test_1h(void)
{
    hid_t	dcpl=-1;		/*dataset creation properties	*/
    herr_t	status;			/*return status			*/

    TESTING("address overflow in external files");
    if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
    if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) goto error;
    H5E_BEGIN_TRY {
	status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100);
    } H5E_END_TRY;
    if (status>=0) {
	H5_FAILED();
	puts("    H5Pset_external() succeeded when it should have failed.");
	goto error;
    }
    if (H5Pclose(dcpl) < 0) goto error;
    PASSED();
    return 0;

 error:
    H5E_BEGIN_TRY {
	H5Pclose(dcpl);
    } H5E_END_TRY;
    return 1;
}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:44,代码来源:external.c


示例6: test_open

/*-------------------------------------------------------------------------
 * test_open
 *
 * Tests opening and closing a FL packet table
 *
 *-------------------------------------------------------------------------
 */
static int test_open(hid_t fid)
{
    herr_t err;
    hid_t table;

    TESTING("H5PTopen");

    /* Open the table */
    table = H5PTopen(fid, PT_NAME);
    if( H5PTis_valid(table) < 0)
        goto error;
    if( H5PTis_varlen(table) != 0)
        goto error;

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto error;

    PASSED();
    return SUCCEED;

error:
      if (table > 0) H5PTclose(table);
      H5_FAILED();
      return FAIL;
}
开发者ID:ElaraFX,项目名称:hdf5,代码行数:34,代码来源:test_packet.c


示例7: test_create_close

static int test_create_close(hid_t fid)
{
    herr_t err;
    hid_t table;
    hid_t part_t;

    TESTING("H5PTcreate_fl and H5PTclose");

    /* Create a datatype for the particle struct */
    part_t = make_particle_type();

    HDassert(part_t != -1);

    /* Create the table */
    table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1);
    H5Tclose(part_t);
    if( H5PTis_valid(table) < 0)
        goto out;
#ifdef VLPT_REMOVED
    if( H5PTis_varlen(table) != 0)
        goto out;
#endif /* VLPT_REMOVED */

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:35,代码来源:test_packet.c


示例8: test_open

/*-------------------------------------------------------------------------
 * test_open
 *
 * Tests opening and closing a FL packet table
 *
 *-------------------------------------------------------------------------
 */
static int test_open(hid_t fid)
{
    herr_t err;
    hid_t table;

    TESTING("H5PTopen");

    /* Open the table */
    table = H5PTopen(fid, PT_NAME);
    if( H5PTis_valid(table) < 0)
        goto out;
#ifdef VLPT_REMOVED
    if( H5PTis_varlen(table) != 0)
        goto out;
#endif /* VLPT_REMOVED */

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:35,代码来源:test_packet.c


示例9: test_compounds

/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_compounds().
*-------------------------------------------------------------------------
*/
static int test_compounds(void)
{
    hid_t   dtype;
    int     nmembs;
    char    *memb_name = NULL;
    H5T_class_t memb_class;
    H5T_class_t type_class;
    char*   dt_str;
    size_t  str_len;

    TESTING3("        text for compound types");

    if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0)
        goto out;

    if((type_class = H5Tget_class(dtype))<0)
        goto out;
    if(type_class != H5T_COMPOUND)
        goto out;

    if((nmembs = H5Tget_nmembers(dtype))<0)
        goto out;
    if(nmembs != 2)
        goto out;

    if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
        goto out;
    dt_str = (char*)calloc(str_len, sizeof(char));
    if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
        goto out;
    if(strcmp(dt_str, "H5T_COMPOUND {\n      H5T_STD_I16BE \"one_field\" : 2;\n      H5T_STD_U8LE \"two_field\" : 6;\n   }")) {
        printf("dt=\n%s\n", dt_str);
        goto out;
    }
    free(dt_str);

    if(H5Tclose(dtype)<0)
        goto out;

    if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I32BE \"i32_field\"; H5T_STD_I16BE \"i16_field\"; H5T_COMPOUND  { H5T_STD_I16BE \"sec_field\"; H5T_COMPOUND { H5T_STD_I32BE \"thd_field\"; } \"grandchild\"; } \"child_compound\"; H5T_STD_I8BE  \"i8_field\"; }", H5LT_DDL))<0)
        goto out;

    if((memb_name = H5Tget_member_name(dtype, 1)) == NULL)
        goto out;
    if(strcmp(memb_name, "i16_field"))
        goto out;
    free(memb_name);

    if((memb_class = H5Tget_member_class(dtype, 2))<0)
        goto out;
    if(memb_class != H5T_COMPOUND)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:64,代码来源:test_lite.c


示例10: test_duplicatelong_attachscales

static int test_duplicatelong_attachscales(const char *filename)
{
    hid_t   fid = -1;
    hid_t   did = -1;
    char    dsname[32];
    char    scalename[32];
    strcpy(dsname, DATASET_NAME);
    strcat(dsname, "al2");

    TESTING2("test_duplicatelong_attachscales");

    if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
        goto out;

    /* make a dataset 2 */
    if(create_long_dataset(fid, dsname, "al2") < 0)
        goto out;

    if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) {
        strcpy(scalename, DS_1_NAME);
        strcat(scalename, "al");
        if(test_attach_scale(fid, did, scalename, DIM0) < 0)
            goto out;

        strcpy(scalename, DS_2_NAME);
        strcat(scalename, "al");
        if(test_attach_scale(fid, did, scalename, DIM1) < 0)
            goto out;

        strcpy(scalename, DS_3_NAME);
        strcat(scalename, "al");
        if(test_attach_scale(fid, did, scalename, DIM2) < 0)
            goto out;

        strcpy(scalename, DS_4_NAME);
        strcat(scalename, "al");
        if(test_attach_scale(fid, did, scalename, DIM3) < 0)
            goto out;

        if(H5Dclose(did) < 0)
            goto out;
    }
    else
        goto out;

    PASSED();

    H5Fclose(fid);
    return SUCCEED;

out:
    H5E_BEGIN_TRY  {
        H5Dclose(did);
        H5Fclose(fid);
    } H5E_END_TRY;

    H5_FAILED();

    return FAIL;
}
开发者ID:herr-biber,项目名称:hdf5,代码行数:60,代码来源:gen_test_ds.c


示例11: test_read_data

/*-------------------------------------------------------------------------
 * Function:	test_read_data
 *
 * Purpose:	Tests reading data and compares values
 *
 * Return:	Success:	0
 *		Failure:	-1
 *
 * Programmer:	Raymond Lu
 *              14 March 2013
 *
 *-------------------------------------------------------------------------
 */
static herr_t
test_read_data(hid_t dataset, int *origin_data)
{
    int	                check[DSET_DIM1][DSET_DIM2];
    const hsize_t	size[2] = {DSET_DIM1, DSET_DIM2};           /* Dataspace dimensions */
    int                 *data_p = origin_data;
    size_t		i, j;        /* Local index variables */

    /* Read the dataset back */
    if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
        TEST_ERROR;

    /* Check that the values read are the same as the values written */
    for(i=0; i<size[0]; i++) {
        for(j=0; j<size[1]; j++) {
	   if(*data_p != check[i][j]) {
	       H5_FAILED();
	       fprintf(stderr,"    Read different values than written.\n");
	       fprintf(stderr,"    At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
	       fprintf(stderr,"    At original: %d\n", *data_p);
	       fprintf(stderr,"    At returned: %d\n", (int)check[i][j]);
	       goto error;
	   }
           data_p++;
	}
    }

    PASSED();
    return 0;

error:
    return -1;
}
开发者ID:schwehr,项目名称:hdf5,代码行数:46,代码来源:plugin.c


示例12: h5_errors

/*-------------------------------------------------------------------------
 * Function:  h5_errors
 *
 * Purpose:  Displays the error stack after printing "*FAILED*".
 *
 * Return:  Success:  0
 *
 *    Failure:  -1
 *
 * Programmer:  Robb Matzke
 *    Wednesday, March  4, 1998
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static herr_t
h5_errors(hid_t estack, void UNUSED *client_data)
{
    H5_FAILED();
    H5Eprint2(estack, stdout);
    return 0;
}
开发者ID:Hulalazz,项目名称:rnnlib,代码行数:23,代码来源:h5test.c


示例13: test_append

/*-------------------------------------------------------------------------
 * test_append
 *
 * Tests appending packets to a FL packet table
 *
 *-------------------------------------------------------------------------
 */
static int test_append(hid_t fid)
{
    herr_t err;
    hid_t table;
    hsize_t count;

    TESTING("H5PTappend");

    /* Open the table */
    table = H5PTopen(fid, PT_NAME);
    if( H5PTis_valid(table) < 0)
        goto out;

    /* Count the number of packets in the table  */
    err = H5PTget_num_packets(table, &count);
    if( err < 0)
        goto out;
    /* There should be 0 records in the table */
    if( count != 0 )
        goto out;

    /* Append one particle */
    err = H5PTappend(table, (size_t)1, &(testPart[0]));
    if( err < 0)
        goto out;

    /* Append several particles */
    err = H5PTappend(table, (size_t)6, &(testPart[1]));
    if( err < 0)
        goto out;

    /* Append one more particle */
    err = H5PTappend(table, (size_t)1, &(testPart[7]));
    if( err < 0)
        goto out;

    /* Count the number of packets in the table  */
    err = H5PTget_num_packets(table, &count);
    if( err < 0)
        goto out;
    /* There should be 8 records in the table now */
    if( count != 8 )
        goto out;

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    if( H5PTis_valid(table) < 0)
        H5PTclose(table);
    return -1;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:65,代码来源:test_packet.c


示例14: test_opaque

/*-------------------------------------------------------------------------
 * test_opaque
 *
 * Tests that the packet table works with an opaque datatype.
 *
 *-------------------------------------------------------------------------
 */
static int    test_opaque(hid_t fid)
{
    herr_t err;
    hid_t table;
    hid_t part_t;
    size_t c;
    particle_t readBuf[NRECORDS];

    TESTING("opaque data");

    /* Create an opaque datatype for the particle struct */
    if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 )
        return -1;

    HDassert(part_t != -1);

    /* Tag the opaque datatype */
    if ( H5Tset_tag(part_t,  "Opaque Particle"  ) < 0)
        return -1;

    /* Create a new table */
    table = H5PTcreate_fl(fid, "Packet Test Dataset3", part_t, (hsize_t)100, -1);
    H5Tclose(part_t);
    if( H5PTis_valid(table) < 0)
        goto out;

    /* Append several particles, starting at particle 1 */
    err = H5PTappend(table, (size_t)(NRECORDS - 1), &(testPart[1]));
    if( err < 0)
        goto out;

    /* Read the particles back */
    err = H5PTread_packets(table, (hsize_t)0, 7, &(readBuf[0]));
    if( err < 0)
        goto out;

    /* Ensure that particles were read correctly */
    for(c=0; c<NRECORDS - 1; c++)
    {
        if( cmp_par(c+1, c, testPart, readBuf) != 0)
            goto out;
    }

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    if( H5PTis_valid(table) < 0)
        H5PTclose(table);
    return -1;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:64,代码来源:test_packet.c


示例15: test_noconv

/*-------------------------------------------------------------------------
 * Function:	test_noconv
 *
 * Purpose:	Tests creation of datasets when no conversion is present.
 *
 * Return:	Success:	0
 *
 *		Failure:	number of errors
 *
 * Programmer:	Robb Matzke
 *              Monday, January  4, 1999
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
static int
test_noconv(hid_t file)
{
    hid_t	cwg=-1, type=-1, space=-1, dset=-1;
    c_e1	val;
    static c_e1	data1[]={E1_RED,   E1_GREEN, E1_BLUE,  E1_GREEN, E1_WHITE,
			 E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE,  E1_RED,
			 E1_RED,   E1_BLUE,  E1_GREEN, E1_BLACK, E1_WHITE,
			 E1_RED,   E1_WHITE, E1_GREEN, E1_GREEN, E1_BLUE};
    c_e1	data2[NELMTS(data1)];
    hsize_t	ds_size[1]={NELMTS(data1)};
    size_t	i;

    TESTING("no-conversion datasets");
    if ((cwg=H5Gcreate(file, "test_noconv", 0))<0) goto error;

    if ((type = H5Tcreate(H5T_ENUM, sizeof(c_e1)))<0) goto error;
    if (H5Tenum_insert(type, "RED",   CPTR(val, E1_RED  ))<0) goto error;
    if (H5Tenum_insert(type, "GREEN", CPTR(val, E1_GREEN))<0) goto error;
    if (H5Tenum_insert(type, "BLUE",  CPTR(val, E1_BLUE ))<0) goto error;
    if (H5Tenum_insert(type, "WHITE", CPTR(val, E1_WHITE))<0) goto error;
    if (H5Tenum_insert(type, "BLACK", CPTR(val, E1_BLACK))<0) goto error;

    if ((space=H5Screate_simple(1, ds_size, NULL))<0) goto error;
    if ((dset=H5Dcreate(cwg, "color_table", type, space, H5P_DEFAULT))<0)
	goto error;
    if (H5Dwrite(dset, type, space, space, H5P_DEFAULT, data1)<0) goto error;
    if (H5Dread(dset, type, space, space, H5P_DEFAULT, data2)<0) goto error;

    for (i=0; i<ds_size[0]; i++) {
	if (data1[i]!=data2[i]) {
	    H5_FAILED();
	    printf("    data1[%lu]=%d, data2[%lu]=%d (should be same)\n",
		   (unsigned long)i, (int)(data1[i]),
		   (unsigned long)i, (int)(data2[i]));
	    goto error;
	}
    }

    if (H5Dclose(dset)<0) goto error;
    if (H5Sclose(space)<0) goto error;
    if (H5Tclose(type)<0) goto error;
    if (H5Gclose(cwg)<0) goto error;
    PASSED();
    return 0;

 error:
    H5E_BEGIN_TRY {
	H5Dclose(dset);
	H5Sclose(space);
	H5Tclose(type);
	H5Gclose(cwg);
    } H5E_END_TRY;
    return 1;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:71,代码来源:enum.c


示例16: test_misc

/*-------------------------------------------------------------------------
 * Function:	test_misc
 *
 * Purpose:	Test miscellaneous group stuff.
 *
 * Return:	Success:	0
 *
 *		Failure:	number of errors
 *
 * Programmer:	Robb Matzke
 *              Tuesday, November 24, 1998
 *
 * Modifications:
 *              Robb Matzke, 2002-03-28
 *              File is opened by parent instead of here.
 *-------------------------------------------------------------------------
 */
static int
test_misc(hid_t file)
{
    hid_t	g1=-1, g2=-1, g3=-1;
    char	comment[64];

    /* Test current working groups */
    TESTING("miscellaneous group tests");

    /* Create initial groups for testing, then close */
    if ((g1=H5Gcreate(file, "test_1a", 0))<0) goto error;
    if ((g2=H5Gcreate(g1, "sub_1", 0))<0) goto error;
    if ((g3=H5Gcreate(file, "test_1b", 0))<0) goto error;
    if (H5Gset_comment(g3, ".", "hello world")<0) goto error;
    if (H5Gclose(g1)<0) goto error;
    if (H5Gclose(g2)<0) goto error;
    if (H5Gclose(g3)<0) goto error;

    /* Open all groups with absolute names to check for exsistence */
    if ((g1=H5Gopen(file, "/test_1a"))<0) goto error;
    if ((g2=H5Gopen(file, "/test_1a/sub_1"))<0) goto error;
    if ((g3=H5Gopen(file, "/test_1b"))<0) goto error;
    if (H5Gget_comment(g3, "././.", sizeof comment, comment)<0) goto error;
    if (strcmp(comment, "hello world")) {
	H5_FAILED();
	puts("    Read the wrong comment string from the group.");
	printf("    got: \"%s\"\n    ans: \"hello world\"\n", comment);
	goto error;
    }
    if (H5Gclose(g1)<0) goto error;
    if (H5Gclose(g2)<0) goto error;
    if (H5Gclose(g3)<0) goto error;

    /* Check that creating groups with no-op names isn't allowed */
    H5E_BEGIN_TRY {
        g1=H5Gcreate(file, "/", 0);
    } H5E_END_TRY
    if(g1 >= 0) goto error;

    H5E_BEGIN_TRY {
        g1=H5Gcreate(file, "./././", 0);
    } H5E_END_TRY
    if(g1 >= 0) goto error;

    PASSED();
    return 0;

 error:
    H5E_BEGIN_TRY {
	H5Gclose(g1);
	H5Gclose(g2);
	H5Gclose(g3);
    } H5E_END_TRY;
    return 1;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:72,代码来源:stab.c


示例17: test_arrays

/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_arrays().
*-------------------------------------------------------------------------
*/
static int test_arrays(void)
{
    hid_t   dtype;
    int     ndims;
    hsize_t dims[3];
    H5T_class_t type_class;
    char*   dt_str;
    size_t  str_len;

    TESTING3("        text for array types");

    if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0)
        goto out;

    if((type_class = H5Tget_class(dtype))<0)
        goto out;
    if(type_class != H5T_ARRAY)
        goto out;

    if((ndims = H5Tget_array_ndims(dtype))<0)
        goto out;
    if(ndims != 3)
        goto out;

    if(H5Tget_array_dims2(dtype, dims) < 0)
        goto out;
    if(dims[0] != 5 || dims[1] != 7 || dims[2] != 13)
        goto out;

    if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
        goto out;
    dt_str = (char*)calloc(str_len, sizeof(char));
    if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
        goto out;
    if(strcmp(dt_str, "H5T_ARRAY {\n      [5][7][13] H5T_ARRAY {\n         [17][19] H5T_COMPOUND {\n            H5T_STD_I8BE \"arr_compound_1\" : 0;\n            H5T_STD_I32BE \"arr_compound_2\" : 1;\n         }\n      }\n   }")) {
        printf("dt=\n%s\n", dt_str);
        goto out;
    }

    free(dt_str);

    if(H5Tclose(dtype)<0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:55,代码来源:test_lite.c


示例18: test_read

/*-------------------------------------------------------------------------
 * test_read
 *
 * Tests that the packets appended by test_append can be read back.
 *
 *-------------------------------------------------------------------------
 */
static int test_read(hid_t fid)
{
    herr_t err;
    hid_t table;
    particle_t readBuf[NRECORDS];
    size_t c;

    TESTING("H5PTread_packets");

    /* Open the table */
    table = H5PTopen(fid, PT_NAME);
    if( H5PTis_valid(table) < 0)
        goto out;

    /* Read several particles */
    err = H5PTread_packets(table, (hsize_t)0, 3, &(readBuf[0]));
    if( err < 0)
        goto out;

    /* Read one particle */
    err = H5PTread_packets(table, (hsize_t)3, 1, &(readBuf[3]));
    if( err < 0)
        goto out;

    /* Read several particles */
    err = H5PTread_packets(table, (hsize_t)4, (NRECORDS - 4 ), &(readBuf[4]));
    if( err < 0)
        goto out;

    /* Ensure that particles were read correctly */
    for(c=0; c<NRECORDS; c++)
    {
        if( cmp_par(c%8, c, testPart, readBuf) != 0)
            goto out;
    }

    /* Close the table */
    err = H5PTclose(table);
    if( err < 0)
        goto out;

    PASSED();

    return 0;

out:
    H5_FAILED();
    if( H5PTis_valid(table) < 0)
        H5PTclose(table);
    return -1;
}
开发者ID:quinoacomputing,项目名称:HDF5,代码行数:58,代码来源:test_packet.c


示例19: test_variables

/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_variables().
*-------------------------------------------------------------------------
*/
static int test_variables(void)
{
    hid_t   dtype;
    H5T_class_t type_class;
    char*   dt_str;
    size_t  str_len;

    TESTING3("        text for variable types");

    if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL))<0)
        goto out;

    if((type_class = H5Tget_class(dtype))<0)
        goto out;
    if(type_class != H5T_VLEN)
        goto out;

    if(H5Tis_variable_str(dtype))
        goto out;

    if(H5Tclose(dtype)<0)
        goto out;

    if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0)
        goto out;

    if(H5Tis_variable_str(dtype))
        goto out;

    if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
        goto out;
    dt_str = (char*)calloc(str_len, sizeof(char));
    if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
        goto out;
    if(strcmp(dt_str, "H5T_VLEN {\n      H5T_VLEN {\n         H5T_STD_I32BE\n      }\n   }")) {
        printf("dt=\n%s\n", dt_str);
        goto out;
    }
    free(dt_str);

    if(H5Tclose(dtype)<0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:54,代码来源:test_lite.c


示例20: test_integers

/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_integers().
*-------------------------------------------------------------------------
*/
static int test_integers(void)
{
    hid_t   dtype;
    char*   dt_str;
    size_t  str_len;

    TESTING3("\n        text for integer types");

    if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL))<0)
        goto out;
    if(!H5Tequal(dtype, H5T_NATIVE_INT))
        goto out;
    if(H5Tclose(dtype)<0)
        goto out;

    if((dtype = H5LTtext_to_dtype("H5T_STD_I8BE\n", H5LT_DDL))<0)
        goto out;
    if(!H5Tequal(dtype, H5T_STD_I8BE))
        goto out;

    if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
        goto out;
    dt_str = (char*)calloc(str_len, sizeof(char));
    if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0)
        goto out;
    if(strcmp(dt_str, "H5T_STD_I8BE"))
        goto out;
    free(dt_str);

    if(H5Tclose(dtype)<0)
        goto out;

    if((dtype = H5LTtext_to_dtype("H5T_STD_U16LE\n", H5LT_DDL))<0)
        goto out;
    if(!H5Tequal(dtype, H5T_STD_U16LE))
        goto out;
    if(H5Tclose(dtype)<0)
        goto out;

    PASSED();
    return 0;

out:
    H5_FAILED();
    return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:50,代码来源:test_lite.c



注:本文中的H5_FAILED函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAGGLE_DBG函数代码示例发布时间:2022-05-30
下一篇:
C++ H5Tinsert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap