本文整理汇总了C++中PASSED函数的典型用法代码示例。如果您正苦于以下问题:C++ PASSED函数的具体用法?C++ PASSED怎么用?C++ PASSED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PASSED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_sphere_point_depth
int test_sphere_point_depth()
{
int j;
dVector3 p,q;
dMatrix3 R;
dReal r,d;
dSimpleSpace space(0);
dGeomID sphere = dCreateSphere (0,1);
dSpaceAdd (space,sphere);
// ********** make a random sphere of radius r at position p
r = dRandReal()+0.1;
dGeomSphereSetRadius (sphere,r);
dMakeRandomVector (p,3,1.0);
dGeomSetPosition (sphere,p[0],p[1],p[2]);
dRFromAxisAndAngle (R,dRandReal()*2-1,dRandReal()*2-1,
dRandReal()*2-1,dRandReal()*10-5);
dGeomSetRotation (sphere,R);
// ********** test center point has depth r
if (dFabs(dGeomSpherePointDepth (sphere,p[0],p[1],p[2]) - r) > tol) FAILED();
// ********** test point on surface has depth 0
for (j=0; j<3; j++) q[j] = dRandReal()-0.5;
dNormalize3 (q);
for (j=0; j<3; j++) q[j] = q[j]*r + p[j];
if (dFabs(dGeomSpherePointDepth (sphere,q[0],q[1],q[2])) > tol) FAILED();
// ********** test point at random depth
d = (dRandReal()*2-1) * r;
for (j=0; j<3; j++) q[j] = dRandReal()-0.5;
dNormalize3 (q);
for (j=0; j<3; j++) q[j] = q[j]*(r-d) + p[j];
if (dFabs(dGeomSpherePointDepth (sphere,q[0],q[1],q[2])-d) > tol) FAILED();
PASSED();
}
开发者ID:JohnCrash,项目名称:ode,代码行数:42,代码来源:demo_collision.cpp
示例2: test_create
/*-------------------------------------------------------------------------
* Function: test_create
*
* Purpose: Test trivial creating & closing memory pool
*
* Return: Success: 0
*
* Failure: 1
*
* Programmer: Quincey Koziol
* Tuesday, May 3, 2005
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
test_create(void)
{
H5MP_pool_t *mp; /* Memory pool */
H5MP_page_t *page; /* Memory pool page */
size_t free_size; /* Free size in pool */
/*
* Test memory pool creation
*/
TESTING("memory pool creation");
/* Create a memory pool */
if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Check free space */
if(H5MP_get_pool_free_size(mp, &free_size) < 0)
TEST_ERROR;
if(free_size != 0)
TEST_ERROR
/* Check first page */
if (H5MP_get_pool_first_page(mp, &page) < 0)
TEST_ERROR;
if(page != NULL)
TEST_ERROR
/* Close the memory pool */
if (H5MP_close(mp) < 0)
TEST_ERROR
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
} H5E_END_TRY;
return 1;
} /* test_create() */
开发者ID:chaako,项目名称:sceptic3D,代码行数:57,代码来源:pool.c
示例3: test_long
/*-------------------------------------------------------------------------
* Purpose: Creates a group with a very long name
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke <[email protected]> 2002-03-28
*
* Modifications:
*-------------------------------------------------------------------------
*/
static int
test_long(hid_t file)
{
hid_t g1=-1, g2=-1;
char *name1=NULL, *name2=NULL;
size_t namesize=40960, i;
TESTING("long names");
/* Group names */
name1 = malloc(namesize);
for (i=0; i<namesize; i++)
name1[i] = (char)('A' + i%26);
name1[namesize-1] = '\0';
name2 = malloc(2*namesize + 2);
sprintf(name2, "%s/%s", name1, name1);
/* Create groups */
if ((g1=H5Gcreate(file, name1, 0))<0) goto error;
if ((g2=H5Gcreate(g1, name1, 0))<0) goto error;
H5Gclose(g1);
H5Gclose(g2);
/* Open groups */
if ((g1=H5Gopen(file, name1))<0) goto error;
if ((g2=H5Gopen(file, name2))<0) goto error;
H5Gclose(g1);
H5Gclose(g2);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Gclose(g1);
H5Gclose(g2);
} H5E_END_TRY;
return 1;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:51,代码来源:stab.c
示例4: test_1f
/*-------------------------------------------------------------------------
* Function: test_1f
*
* Purpose: Test multiple external files for a dataset.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke
* Monday, November 23, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
test_1f(hid_t file)
{
hid_t dcpl=-1; /*dataset creation properties */
hid_t space=-1; /*data space */
hid_t dset=-1; /*dataset */
hsize_t cur_size[1]; /*data space current size */
hsize_t max_size[1]; /*data space maximum size */
TESTING("multiple external files");
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
cur_size[0] = max_size[0] = 100;
if(H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error;
if(H5Pset_external(dcpl, "ext2.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error;
if(H5Pset_external(dcpl, "ext3.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error;
if(H5Pset_external(dcpl, "ext4.data", (off_t)0,
(hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error;
if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error;
if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
if(H5Dclose(dset) < 0) goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Pclose(dcpl) < 0) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
} H5E_END_TRY;
return 1;
}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:55,代码来源:external.c
示例5: test_1d
/*-------------------------------------------------------------------------
* Function: test_1d
*
* Purpose: Test a single external file which is large enough for the
* current data size but not large enough for the eventual size.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke
* Monday, November 23, 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
test_1d(hid_t file)
{
hid_t dcpl=-1; /*dataset creation properties */
hid_t space=-1; /*data space */
hid_t dset=-1; /*dataset */
hsize_t cur_size[1]; /*current data space size */
hsize_t max_size[1]; /*maximum data space size */
TESTING("extendible dataspace, external storage is too small");
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
cur_size[0] = 100;
max_size[0] = 200;
if(H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) goto error;
if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error;
H5E_BEGIN_TRY {
dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT);
} H5E_END_TRY;
if(dset >= 0) {
H5_FAILED();
puts(" Small external file succeeded instead of failing.");
goto error;
}
if(H5Sclose(space) < 0) goto error;
if(H5Pclose(dcpl) < 0) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Pclose(dcpl);
H5Sclose(space);
} H5E_END_TRY;
return 1;
}
开发者ID:EgoIncarnate,项目名称:appleseed,代码行数:56,代码来源:external.c
示例6: test_szip_compression
/*
* Test drive for testing the szip compression feature with SD interface
*/
extern int
test_szip_compression ()
{
int num_errs = 0;
/* Output message about test being performed */
TESTING("szip compression for datasets (tszip.c)");
#ifdef H4_HAVE_SZIP_ENCODER
/* Test creating and writing SZIP compressed data only when szlib encoder
is available */
num_errs = num_errs + test_szip_SDS8bit();
num_errs = num_errs + test_szip_SDS16bit();
num_errs = num_errs + test_szip_SDS32bit();
num_errs = num_errs + test_szip_SDSfl32bit();
num_errs = num_errs + test_szip_SDSfl64bit();
num_errs = num_errs + test_szip_chunk();
num_errs = num_errs + test_szip_unlimited();
num_errs = num_errs + test_szip_chunk_3d();
#else
/* printf("Test creating and writing SZIP compressed data \tSKIPPED\n"); */
#endif
#ifdef H4_HAVE_LIBSZ
/* Test reading szipped data when szlib is available, either with encoder
or only decoder */
num_errs = num_errs + test_getszipdata();
#else
/* printf("Test reading SZIP compressed data \tSKIPPED\n"); */
#endif
/* Test reading szip compression information and should pass with or
without SZIP library */
num_errs = num_errs + test_getszipinfo();
if (num_errs == 0) PASSED();
return num_errs;
}
开发者ID:Higginbottom,项目名称:zeus_python,代码行数:41,代码来源:tszip.c
示例7: group_version_macros
/*-------------------------------------------------------------------------
*
* Function: group_version_macros
*
* Purpose: Test H5G version compatibility macros.
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Neil Fortner
* Saturday, October 11, 2008
*
*-------------------------------------------------------------------------
*/
static int
group_version_macros(hid_t fapl)
{
hid_t fid, gid;
char filename[NAME_BUF_SIZE];
/* Output message about test being performed */
TESTING("H5G version compatibility macros");
/* Create file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR;
/* Create a group (test H5Gcreate1) */
if ((gid = H5Gcreate1(fid, "group", 0)) < 0) TEST_ERROR;
/* Close group */
if (H5Gclose(gid) < 0) TEST_ERROR;
/* Open group (test H5Gopen1) */
if ((gid = H5Gopen1(fid, "group")) < 0) TEST_ERROR;
/* Close group */
if (H5Gclose(gid) < 0) TEST_ERROR;
/* Close file */
if (H5Fclose(fid) < 0) TEST_ERROR;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(gid);
H5Gclose(fid);
} H5E_END_TRY
return -1;
} /* end group_version_macros() */
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:52,代码来源:links.c
示例8: test_filters_for_groups
/*-------------------------------------------------------------------------
* Function: test_filters_for_groups
*
* Purpose: Tests creating group with dynamically loaded filters
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Raymond Lu
* 1 April 2013
*
*-------------------------------------------------------------------------
*/
static herr_t
test_filters_for_groups(hid_t file)
{
hid_t gcpl, gid, group;
int i;
char gname[256];
TESTING("Testing DYNLIB3 filter for group");
if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto error;
/* Use DYNLIB3 for creating groups */
if(H5Pset_filter (gcpl, H5Z_FILTER_DYNLIB3, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) goto error;
/* Create a group using this filter */
if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) goto error;
/* Create multiple groups under "group1" */
for (i=0; i < GROUP_ITERATION; i++) {
sprintf(gname, "group_%d", i);
if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
if(H5Gclose(group) < 0) goto error;
}
/* Close the group */
if(H5Gclose(gid) < 0) goto error;
/* Clean up objects used for this test */
if(H5Pclose (gcpl) < 0) goto error;
PASSED();
return 0;
error:
return -1;
}
开发者ID:schwehr,项目名称:hdf5,代码行数:50,代码来源:plugin.c
示例9: test03
/*
* Get current value, request timeout for next value, increment counter, check
* notified correctly.
*/
static void
test03(void)
{
uint32_t cur_value;
L4_Word_t result;
L4_Word_t notifybits = 0x1;
L4_MsgTag_t tag;
L4_Word_t mask;
printf("%s: ", __func__);
result = counter_current_value(&cur_value);
if (result == 0) {
FAILED();
return;
}
result = counter_request(cur_value + 1, main_tid, notifybits);
if (result == 0) {
FAILED();
return;
}
result = counter_increment(1);
if (result == 0) {
FAILED();
return;
}
L4_Set_NotifyMask(notifybits);
L4_Accept(L4_NotifyMsgAcceptor);
tag = L4_WaitNotify(&mask);
if (L4_IpcFailed(tag)) {
FAILED();
return;
}
PASSED();
}
开发者ID:BreezeWu,项目名称:okl4_3.0,代码行数:40,代码来源:main.c
示例10: main
/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Exercise private object header behavior and routines
*
* Return: Success: 0
* Failure: 1
*
* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
hid_t fapl = -1, file = -1;
hid_t dset = -1;
H5F_t *f = NULL;
char filename[1024];
H5O_hdr_info_t hdr_info; /* Object info */
H5O_loc_t oh_loc, oh_loc2; /* Object header locations */
time_t time_new, ro;
int chunkno; /* Chunk index for message */
int i; /* Local index variable */
hbool_t b; /* Index for "new format" loop */
herr_t ret; /* Generic return value */
/* Reset library */
h5_reset();
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Loop over old & new formats */
for(b = FALSE; b <= TRUE; b++) {
/* Display info about testing */
if(b)
HDputs("Using new file format:");
else
HDputs("Using default file format:");
/* Set the format to use for the file */
if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* test on object continuation block */
if(test_cont(filename, fapl) < 0)
FAIL_STACK_ERROR
/* Create the file to operate on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
if (H5AC_ignore_tags(f) < 0) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
/*
* Test object header creation
* (using default group creation property list only because it's convenient)
*/
TESTING("object header creation");
HDmemset(&oh_loc, 0, sizeof(oh_loc));
if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
FAIL_STACK_ERROR
PASSED();
/* create a new message */
TESTING("message creation");
time_new = 11111111;
if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT))
FAIL_STACK_ERROR
if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT))
FAIL_STACK_ERROR
if(ro != time_new)
TEST_ERROR
PASSED();
/*
* Test modification of an existing message.
*/
TESTING("message modification");
time_new = 33333333;
if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0)
FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
//.........这里部分代码省略.........
开发者ID:MichaelToal,项目名称:hdf5,代码行数:101,代码来源:ohdr.c
示例11: test_invalid_parameters
//.........这里部分代码省略.........
offset[1] = CHUNK_NY;
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
if(H5Dclose(dataset) < 0)
goto error;
/* Create a chunked dataset with compression filter */
if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0)
goto error;
if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0)
goto error;
/*
* Create a new dataset within the file using cparms
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
cparms, H5P_DEFAULT)) < 0)
goto error;
/* Check invalid dataset ID */
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
/* Check invalid DXPL ID */
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, (hid_t)-1, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
/* Check invalid OFFSET */
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, NULL, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
/* Check when OFFSET is out of dataset range */
offset[0] = NX + 1;
offset[1] = NY;
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
/* Check when OFFSET is not on chunk boundary */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY + 1;
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
/* Check invalid buffer size */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
buf_size = 0;
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
} H5E_END_TRY;
/* Check invalid data buffer */
buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
H5E_BEGIN_TRY {
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, NULL)) != FAIL)
goto error;
} H5E_END_TRY;
if(H5Dclose(dataset) < 0)
goto error;
/*
* Close/release resources.
*/
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
} H5E_END_TRY;
return 1;
}
开发者ID:CommonLibrary,项目名称:hdf5,代码行数:101,代码来源:test_dset_opt.c
示例12: test_data_conv
//.........这里部分代码省略.........
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/* Initialize data for one chunk */
for(i = n = 0; i < CHUNK_NX; i++) {
for(j = 0; j < CHUNK_NY; j++) {
(direct_buf[i][j]).a = i*j+0;
(direct_buf[i][j]).b = i*j+1;
(direct_buf[i][j]).c[0] = i*j+2;
(direct_buf[i][j]).c[1] = i*j+3;
(direct_buf[i][j]).c[2] = i*j+4;
(direct_buf[i][j]).c[3] = i*j+5;
(direct_buf[i][j]).d = i*j+6;
(direct_buf[i][j]).e = i*j+7;
}
}
/* write the chunk data to dataset, using the direct writing function.
* There should be no data conversion involved. */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
if((status = H5DOwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
goto error;
if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
goto error;
if((dataset = H5Dopen2(file, DATASETNAME4, H5P_DEFAULT)) < 0)
goto error;
/*
* Select hyperslab for the chunk just written in the file
*/
start[0] = CHUNK_NX; start[1] = CHUNK_NY;
stride[0] = 1; stride[1] = 1;
count[0] = 1; count[1] = 1;
block[0] = CHUNK_NX; block[1] = CHUNK_NY;
if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0)
goto error;
/* Read the chunk back. Data should be converted */
if((status = H5Dread(dataset, dt, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0)
goto error;
/* Check that the values read are the same as the values written */
for(i = 0; i < CHUNK_NX; i++) {
for(j = 0; j < CHUNK_NY; j++) {
if ((direct_buf[i][j]).a != (check_chunk[i][j]).a ||
(direct_buf[i][j]).c[0] != (check_chunk[i][j]).c[0] ||
(direct_buf[i][j]).c[1] != (check_chunk[i][j]).c[1] ||
(direct_buf[i][j]).c[2] != (check_chunk[i][j]).c[2] ||
(direct_buf[i][j]).c[3] != (check_chunk[i][j]).c[3] ||
(direct_buf[i][j]).e != (check_chunk[i][j]).e) {
printf(" 1. Read different values than written.");
printf(" At index %d,%d\n", i, j);
printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
(direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
(direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
printf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
(check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
(check_chunk[i][j]).c[3], (check_chunk[i][j]).e);
goto error;
}
}
}
/*
* Close/release resources.
*/
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
H5Tclose(st);
H5Tclose(dt);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dataset);
H5Sclose(mem_space);
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
H5Tclose(st);
H5Tclose(dt);
} H5E_END_TRY;
return 1;
}
开发者ID:CommonLibrary,项目名称:hdf5,代码行数:101,代码来源:test_dset_opt.c
示例13: done
void
done()
{
ASSERT(MANGLE(failures) == 0);
PASSED();
}
开发者ID:Derpybunneh,项目名称:cpctelera,代码行数:6,代码来源:rotate4.c
示例14: test_family_compat
/*-------------------------------------------------------------------------
* Function: test_family_compat
*
* Purpose: Tests the backward compatibility for FAMILY driver.
* See if we can open files created with v1.6 library.
* The source file was created by the test/file_handle.c
* of the v1.6 library. Then tools/misc/h5repart.c was
* used to concantenated. The command was "h5repart -m 5k
* family_file%05d.h5 family_v16_%05d.h5".
*
* Return: Success: 0
* Failure: -1
*
* Programmer: Raymond Lu
* June 3, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
test_family_compat(void)
{
hid_t file = (-1), fapl;
hid_t dset;
char dname[]="dataset";
char filename[1024];
char pathname[1024], pathname_individual[1024];
char newname[1024], newname_individual[1024];
FILE *tmp_fp, *old_fp; /* Pointers to temp & old files */
int counter = 0;
TESTING("FAMILY file driver backward compatibility");
/* Set property list and file name for FAMILY driver */
fapl = h5_fileaccess();
if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_SIZE2, H5P_DEFAULT) < 0)
TEST_ERROR;
h5_fixname(COMPAT_BASENAME, fapl, filename, sizeof filename);
h5_fixname(FILENAME[3], fapl, newname, sizeof newname);
pathname[0] = '\0';
HDstrcat(pathname, filename);
/* The following code makes the copies of the family files in the source directory.
* Since we're going to open the files with write mode, this protects the original
* files.
*/
sprintf(newname_individual, newname, counter);
sprintf(pathname_individual, pathname, counter);
while (h5_make_local_copy(pathname_individual, newname_individual) >= 0) {
counter++;
sprintf(newname_individual, newname, counter);
sprintf(pathname_individual, pathname, counter);
}
if ((NULL != (old_fp = HDfopen(pathname_individual,"rb"))) &&
(NULL != (tmp_fp = HDfopen(newname_individual,"wb"))))
TEST_ERROR;
/* Make sure we can open the file. Use the read and write mode to flush the
* superblock. */
if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
TEST_ERROR;
if(H5Dclose(dset) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Open the file again to make sure it isn't corrupted. */
if((file = H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
if((dset = H5Dopen2(file, dname, H5P_DEFAULT)) < 0)
TEST_ERROR;
if(H5Dclose(dset) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
//.........这里部分代码省略.........
开发者ID:chaako,项目名称:sceptic3D,代码行数:101,代码来源:vfd.c
示例15: test_core
//.........这里部分代码省略.........
TEST_ERROR;
/* Read the data back from dset1 */
if(H5Dread(dset1, 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 */
p1 = points;
p2 = check;
for(i = 0; i < DSET1_DIM1; i++)
for(j = 0; j < DSET1_DIM2; j++)
if(*p1++ != *p2++) {
H5_FAILED();
printf(" Read different values than written in data set 1.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Open the file with backing store on for read and write.
* Changes will be saved in file. */
if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
TEST_ERROR;
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Create the dset1 */
if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Reallocate memory for reading buffer. */
if(check)
free(check);
check = (int*)malloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
/* Read the data back from dset1 */
if(H5Dread(dset1, 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 */
p1 = points;
p2 = check;
for(i = 0; i < DSET1_DIM1; i++)
for(j = 0; j < DSET1_DIM2; j++)
if(*p1++ != *p2++) {
H5_FAILED();
printf(" Read different values than written in data set 1.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
/* Check file size API */
if(H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* There is no garantee the size of metadata in file is constant.
* Just try to check if it's reasonable. */
if(file_size<64*KB || file_size>256*KB)
TEST_ERROR;
if(H5Sclose(space1) < 0)
TEST_ERROR;
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
if(points)
free(points);
if(check)
free(check);
h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Pclose (fapl);
H5Fclose(file);
} H5E_END_TRY;
return -1;
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:101,代码来源:vfd.c
示例16: test_allocate_random
//.........这里部分代码省略.........
static int
test_allocate_random(void)
{
H5MP_pool_t *mp; /* Memory pool */
size_t u; /* Local index variable */
time_t curr_time; /* Current time, for seeding random number generator */
size_t *blk_size = NULL; /* Pointer to block sizes */
void **spc = NULL; /* Pointer to space allocated */
size_t swap_idx; /* Location to swap with when shuffling */
void *swap_ptr; /* Pointer to swap when shuffling */
/*
* Test memory pool allocation
*/
TESTING("allocate many random sized blocks");
/* Initialize random number seed */
curr_time=HDtime(NULL);
#ifdef QAK
curr_time=1115412944;
HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
#endif /* QAK */
HDsrandom((unsigned long)curr_time);
/* Create a memory pool */
if(NULL == (mp = H5MP_create((size_t)MPOOL_PAGE_SIZE, MPOOL_FLAGS)))
TEST_ERROR
/* Allocate space for the block sizes */
if(NULL == (blk_size = HDmalloc(sizeof(size_t) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Allocate space for the block pointers */
if(NULL == (spc = HDmalloc(sizeof(void *) * MPOOL_NUM_RANDOM)))
TEST_ERROR
/* Initialize the block sizes with random values */
for(u = 0; u < MPOOL_NUM_RANDOM; u++)
blk_size[u] = (size_t)(HDrandom() % MPOOL_RANDOM_MAX_SIZE) + 1;
/* Allocate space in pool */
for(u = 0; u < MPOOL_NUM_RANDOM; u++)
if(NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
TEST_ERROR
/* Check that free space totals match */
if(H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR;
/* Shuffle pointers to free */
for(u = 0; u < MPOOL_NUM_RANDOM; u++) {
swap_idx = (size_t)(HDrandom() % (MPOOL_NUM_RANDOM - u)) + u;
swap_ptr = spc[u];
spc[u] = spc[swap_idx];
spc[swap_idx] = swap_ptr;
} /* end for */
/* Free blocks in pool */
for(u = 0; u < MPOOL_NUM_RANDOM; u++)
H5MP_free(mp, spc[u]);
/* Check that free space totals match */
if (H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR;
/* Initialize the block sizes with random values */
for(u = 0; u < MPOOL_NUM_RANDOM; u++)
blk_size[u] = (size_t)(HDrandom() % MPOOL_RANDOM_MAX_SIZE) + 1;
/* Allocate space in pool (again) */
/* (Leave allocated to test closing pool with many blocks still allocated) */
for(u = 0; u < MPOOL_NUM_RANDOM; u++)
if(NULL == (spc[u] = H5MP_malloc(mp, blk_size[u])))
TEST_ERROR
/* Check that free space totals match */
if(H5MP_pool_is_free_size_correct(mp) <= 0)
TEST_ERROR;
/* Close the memory pool */
if (H5MP_close(mp) < 0)
TEST_ERROR
/* Free memory for block sizes & pointers */
HDfree(blk_size);
HDfree(spc);
PASSED();
return 0;
error:
if(blk_size)
HDfree(blk_size);
if(spc)
HDfree(spc);
H5E_BEGIN_TRY {
} H5E_END_TRY;
return 1;
} /* test_allocate_random() */
开发者ID:chaako,项目名称:sceptic3D,代码行数:101,代码来源:pool.c
示例17: test_direct
//.........这里部分代码省略.........
/* Create the data space1 */
dims1[0] = DSET1_DIM1;
dims1[1] = DSET1_DIM2;
if((space1 = H5Screate_simple(2, dims1, NULL)) < 0)
TEST_ERROR;
/* Create the dset1 */
if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
TEST_ERROR;
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
if(H5Dread(dset1, 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 */
p1 = points;
p2 = check;
for(i = 0; i < DSET1_DIM1; i++)
for(j = 0; j < DSET1_DIM2; j++)
if(*p1++ != *p2++) {
H5_FAILED();
printf(" Read different values than written in data set 1.\n");
printf(" At index %d,%d\n", i, j);
TEST_ERROR;
} /* end if */
/* Create the data space2. For data set 2, memory address and data size are not aligned. */
dims2[0] = DSET2_DIM;
if((space2 = H5Screate_simple(1, dims2, NULL)) < 0)
TEST_ERROR;
/* Create the dset2 */
if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Write the data to the dset1 */
if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0)
TEST_ERROR;
if(H5Dclose(dset2) < 0)
TEST_ERROR;
if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
/* Read the data back from dset1 */
if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
for(i = 0; i < DSET2_DIM; i++)
if(wdata2[i] != rdata2[i]) {
H5_FAILED();
printf(" Read different values than written in data set 2.\n");
printf(" At index %d\n", i);
TEST_ERROR;
} /* end if */
if(H5Sclose(space1) < 0)
TEST_ERROR;
if(H5Dclose(dset1) < 0)
TEST_ERROR;
if(H5Sclose(space2) < 0)
TEST_ERROR;
if(H5Dclose(dset2) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
TEST_ERROR;
if(points)
free(points);
if(check)
free(check);
h5_cleanup(FILENAME, fapl);
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Pclose (fapl);
H5Sclose(space1);
H5Dclose(dset1);
H5Sclose(space2);
H5Dclose(dset2);
H5Fclose(file);
} H5E_END_TRY;
return -1;
#endif /*H5_HAVE_DIRECT*/
}
开发者ID:chaako,项目名称:sceptic3D,代码行数:101,代码来源:vfd.c
示例18: test_tr2
/*-------------------------------------------------------------------------
* Function: test_tr2
*
* Purpose: Tests conversions that use the O(log N) lookup function.
*
* Return: Success: 0
*
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, January 5, 1999
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static int
test_tr2(hid_t file)
{
hid_t cwg=-1, m_type=-1, f_type=-1, space=-1, dset=-1;
hsize_t ds_size[1]={10};
size_t i;
c_e1 val1;
int val2;
static c_e1 data1[10]={E1_RED, E1_GREEN, E1_BLUE, E1_GREEN, E1_WHITE,
E1_WHITE, E1_BLACK, E1_GREEN, E1_BLUE, E1_RED};
c_e1 data2[10];
TESTING("O(log N) converions");
if ((cwg=H5Gcreate(file, "test_tr2", 0))<0) goto error;
if ((m_type = H5Tcreate(H5T_ENUM, sizeof(c_e1)))<0) goto error;
if (H5Tenum_insert(m_type, "RED", CPTR(val1, E1_RED ))<0) goto error;
if (H5Tenum_insert(m_type, "GREEN", CPTR(val1, E1_GREEN))<0) goto error;
if (H5Tenum_insert(m_type, "BLUE", CPTR(val1, E1_BLUE ))<0) goto error;
if (H5Tenum_insert(m_type, "WHITE", CPTR(val1, E1_WHITE))<0) goto error;
if (H5Tenum_insert(m_type, "BLACK", CPTR(val1, E1_BLACK))<0) goto error;
if ((f_type = H5Tcreate(H5T_ENUM, sizeof(int)))<0) goto error;
if (H5Tenum_insert(f_type, "RED", CPTR(val2, 1050))<0) goto error;
if (H5Tenum_insert(f_type, "GREEN", CPTR(val2, 1040))<0) goto error;
if (H5Tenum_insert(f_type, "BLUE", CPTR(val2, 1030))<0) goto error;
if (H5Tenum_insert(f_type, "WHITE", CPTR(val2, 1020))<0) goto error;
if (H5Tenum_insert(f_type, "BLACK", CPTR(val2, 1010))<0) goto error;
if ((space=H5Screate_simple(1, ds_size, NULL))<0) goto error;
if ((dset=H5Dcreate(cwg, "color_table", f_type, space, H5P_DEFAULT))<0)
goto error;
if (H5Dwrite(dset, m_type, space, space, H5P_DEFAULT, data1)<0) goto error;
if (H5Dread(dset, m_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(m_type)<0) goto error;
if (H5Tclose(f_type)<0) goto error;
if (H5Gclose(cwg)<0) goto error;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Sclose(space);
H5Tclose(m_type);
H5Tclose(f_type);
H5Gclose(cwg);
} H5E_END_TRY;
return 1;
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:79,代码来源:enum.c
示例19: test_family
//.........这里部分代码省略.........
/* Check file size API */
if(H5Fget_filesize(file, &file_size) < 0)
TEST_ERROR;
/* The file size is supposed to be about 800 bytes right now. */
if(file_size < (KB / 2) || file_size > KB)
TEST_ERROR;
/* Create and write dataset */
if((space=H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
if ((access_fapl = H5Fget_access_plist(file)) < 0)
TEST_ERROR;
/* ...and close the property list */
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
for(i=0; i<FAMILY_NUMBER; i++)
for(j=0; j<FAMILY_SIZE; j++)
buf[i][j] = i*10000+j;
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
TEST_ERROR;
/* check file handle API */
if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
if(H5Pset_family_offset(fapl2, (hsize_t)0) < 0)
TEST_ERROR;
if(H5Fget_vfd_handle(file, f
|
请发表评论