diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-06-25 15:16:15 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-06-25 15:16:15 (GMT) |
commit | 9b84be1422c1455fc0414e5619b9ee142a84cd82 (patch) | |
tree | 132046bb11567ffcef104807fb943cf29af25d41 /c++/test | |
parent | c95b683457c1b47f7095e7a9804db7ce84f8e39b (diff) | |
download | hdf5-9b84be1422c1455fc0414e5619b9ee142a84cd82.zip hdf5-9b84be1422c1455fc0414e5619b9ee142a84cd82.tar.gz hdf5-9b84be1422c1455fc0414e5619b9ee142a84cd82.tar.bz2 |
[svn-r8743] *** empty log message ***
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/tfile.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 82d7338..47d06f7 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -59,6 +59,9 @@ using namespace H5; #define F3_SYM_INTERN_K F2_SYM_INTERN_K #define FILE3 "tfile3.h5" +#define KB 1024 +#define FILE4 "tfile4.h5" + /*------------------------------------------------------------------------- * Function: test_file_create @@ -311,6 +314,61 @@ test_file_open(void) /*------------------------------------------------------------------------- + * Function: test_file_size + * + * Purpose: Test file size. + * + * Return: None + * + * Programmer: Raymond Lu + * June, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +test_file_size(void) +{ + /* Output message about test being performed */ + MESSAGE(5, ("Testing File Size\n")); + + hid_t fapl_id; + fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template + + try { + // Use the file access template id to create a file access prop. + // list object to pass in H5File::H5File + FileAccPropList fapl(fapl_id); + + // Set to sec2 driver. Do we want to test other file drivers? + // They're not tested in C++. + // File drivers seem not implemented. + //fapl.setSec2(); + + // Create a file + H5File fid( FILE4, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); + + // Get file size + haddr_t file_size = fid.getFileSize(); + CHECK(file_size, FAIL, "H5File::getFileSize"); + + // Check if file size is reasonable. It's supposed to be 2KB now. + if(file_size<1*KB || file_size>4*KB) + CHECK(FAIL, FAIL, "H5File::getFileSize"); + } // end of try block + + catch( Exception E ) { + CHECK(FAIL, FAIL, E.getCFuncName()); + } + + // use C test utility routine to close property list. + H5Pclose(fapl_id); + +} /* test_file_size() */ + + +/*------------------------------------------------------------------------- * Function: test_file * * Purpose: Main program @@ -332,6 +390,7 @@ test_file(void) test_file_create(); /* Test file creation (also creation templates) */ test_file_open(); /* Test file opening */ + test_file_size(); /* Test file size */ } /* test_file() */ |