summaryrefslogtreecommitdiffstats
path: root/c++/test/tfile.cpp
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2007-03-17 16:26:53 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2007-03-17 16:26:53 (GMT)
commit1c4e6d163f781003ce1151781b3d403dc9b52e66 (patch)
treeb07834021d14510d51e90736877fd938c1a9d904 /c++/test/tfile.cpp
parentc4bbce8be19cd60e7ffd0180194c0e0e92091381 (diff)
downloadhdf5-1c4e6d163f781003ce1151781b3d403dc9b52e66.zip
hdf5-1c4e6d163f781003ce1151781b3d403dc9b52e66.tar.gz
hdf5-1c4e6d163f781003ce1151781b3d403dc9b52e66.tar.bz2
[svn-r13524] Purpose: Cleanup tests
Description: Added extern "C" to cleanup functions as well, forgot last time. Cleaned up/Added comments to some of the newly added tests. Platforms tested AIX 5.1 (copper) Linux 2.6 (kagiso) SunOS 5.8 64-bit (sol)
Diffstat (limited to 'c++/test/tfile.cpp')
-rw-r--r--c++/test/tfile.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index f3d9574..71f0a60 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -91,11 +91,10 @@ const H5std_string FILE4("tfile4.h5");
*
*-------------------------------------------------------------------------
*/
-static void
-test_file_create(void)
+static void test_file_create()
{
// Output message about test being performed
- MESSAGE(5, ("Testing File Creation I/O\n"));
+ SUBTEST("Testing File Creation I/O");
// Test create with various sequences of H5F_ACC_EXCL and
// H5F_ACC_TRUNC flags
@@ -186,7 +185,7 @@ test_file_create(void)
}
catch (InvalidActionException E)
{
- cerr << " FAILED" << endl;
+ cerr << " *FAILED*" << endl;
cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl;
if (file1 != NULL) // clean up
delete file1;
@@ -194,7 +193,7 @@ test_file_create(void)
// catch all other exceptions
catch (Exception E)
{
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
if (file1 != NULL) // clean up
delete file1;
}
@@ -268,11 +267,12 @@ test_file_create(void)
// Release file-creation template
delete tmpl1;
+ PASSED();
}
// catch all exceptions
catch (Exception E)
{
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg());
if (tmpl1 != NULL) // clean up
delete tmpl1;
}
@@ -299,11 +299,10 @@ test_file_create(void)
*
*-------------------------------------------------------------------------
*/
-static void
-test_file_open(void)
+static void test_file_open()
{
// Output message about test being performed
- MESSAGE(5, ("Testing File Opening I/O\n"));
+ SUBTEST("Testing File Opening I/O");
try {
@@ -326,10 +325,11 @@ test_file_open(void)
tmpl1.getSymk( iparm1, iparm2);
verify_val(iparm1, F2_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
verify_val(iparm2, F2_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__);
+ PASSED();
} // end of try block
catch( Exception E ) {
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_file_open()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_file_open()
@@ -348,11 +348,10 @@ test_file_open(void)
*
*-------------------------------------------------------------------------
*/
-static void
-test_file_size(void)
+static void test_file_size()
{
// Output message about test being performed
- MESSAGE(5, ("Testing File Size\n"));
+ SUBTEST("Testing File Size");
hid_t fapl_id;
fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template
@@ -375,11 +374,12 @@ test_file_size(void)
// Check if file size is reasonable. It's supposed to be 2KB now.
if(file_size<1*KB || file_size>4*KB)
- issue_fail_msg("H5File::getFileSize", __LINE__, __FILE__);
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__);
+ PASSED();
} // end of try block
catch( Exception E ) {
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_file_size()", __LINE__, __FILE__, E.getCDetailMsg());
}
// use C test utility routine to close property list.
@@ -416,11 +416,10 @@ typedef struct s1_t {
float b;
} s1_t;
-static void
-test_file_name()
+static void test_file_name()
{
// Output message about test being performed
- MESSAGE(5, ("Testing File Name\n"));
+ SUBTEST("Testing File Name");
H5std_string file_name;
try {
@@ -469,10 +468,11 @@ test_file_name()
// Get and verify file name
comp_type.getFileName();
verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__);
+ PASSED();
} // end of try block
catch (Exception E) {
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_file_name()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_file_name()
@@ -495,7 +495,7 @@ test_file_name()
#ifdef __cplusplus
extern "C"
#endif
-void test_file(void)
+void test_file()
{
// Output message about test being performed
MESSAGE(5, ("Testing File I/O operations\n"));
@@ -520,11 +520,13 @@ void test_file(void)
*
*-------------------------------------------------------------------------
*/
-void
-cleanup_file(void)
+#ifdef __cplusplus
+extern "C"
+#endif
+void cleanup_file()
{
- remove(FILE1.c_str());
- remove(FILE2.c_str());
- remove(FILE3.c_str());
- remove(FILE4.c_str());
+ HDremove(FILE1.c_str());
+ HDremove(FILE2.c_str());
+ HDremove(FILE3.c_str());
+ HDremove(FILE4.c_str());
} // cleanup_file