00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OPENMS_CONCEPT_CLASSTEST_H
00028 #define OPENMS_CONCEPT_CLASSTEST_H
00029
00035 #define OPENMS_WITHIN_CLASSTEST 1
00036
00037 #include <OpenMS/config.h>
00038 #include <OpenMS/CONCEPT/Exception.h>
00039 #include <OpenMS/DATASTRUCTURES/String.h>
00040 #include <OpenMS/SYSTEM/ProcessResource.h>
00041
00042 #include <string>
00043 #include <list>
00044 #include <iostream>
00045 #include <fstream>
00046 #include <boost/lexical_cast.hpp>
00047
00048 #include <unistd.h>
00049 #include <stdio.h>
00050 #include <math.h>
00051 #include <stdlib.h>
00052
00053 #ifdef OPENMS_HAS_SSTREAM
00054 # include <sstream>
00055 #else
00056 # include <strstream>
00057 #endif
00058
00059
00060
00061 namespace OpenMS
00062 {
00063 }
00064
00085
00097 #define PRECISION(a) \
00098 TEST::precision = (a); \
00099 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00100 { \
00101 if (!TEST::newline) \
00102 { \
00103 TEST::newline = true; \
00104 std::cout << std::endl; \
00105 } \
00106 std::cout << " (line " << __LINE__ << ": PRECISION(" << TEST::precision \
00107 << ") ("#a")" << std::endl; \
00108 } \
00109
00110
00129 #define START_TEST(class_name, version) \
00130 \
00131 \
00132 namespace TEST { \
00133 int verbose = 0; \
00134 bool all_tests = true; \
00135 bool test = true; \
00136 bool this_test; \
00137 int exception = 0; \
00138 std::string exception_name = ""; \
00139 std::string exception_message = ""; \
00140 std::string test_name = ""; \
00141 int check_line = 0; \
00142 int test_line = 0; \
00143 const char* version_string = version; \
00144 bool newline = false; \
00145 std::list<std::string> tmp_file_list; \
00146 std::ifstream infile; \
00147 std::ifstream templatefile; \
00148 bool equal_files; \
00149 double precision = 1e-5; \
00150 char line_buffer[65537]; \
00151 int test_count = 0; \
00152 } \
00153 \
00154 \
00155 int main(int argc, char **argv) \
00156 { \
00157 \
00158 if (argc == 2) { \
00159 if (!strcmp(argv[1], "-v")) \
00160 TEST::verbose = 1; \
00161 if (!strcmp(argv[1], "-V")) \
00162 TEST::verbose = 2; \
00163 }; \
00164 \
00165 if ((argc > 2) || ((argc == 2) && (TEST::verbose == 0))) { \
00166 std::cerr \
00167 << "This is " << argv[0] << ", the test program for the " << std::endl \
00168 << #class_name " class." << std::endl << std::endl \
00169 << "On successful operation it simply returns PASSED," << std::endl \
00170 << "otherwise FAILED is printed." << std::endl \
00171 << "If called with an argument of -v, " << std::endl \
00172 << "prints detailed information about individual tests." << std::endl \
00173 << "Option -V provides verbose information on every subtest." << std::endl; \
00174 return 1; \
00175 } \
00176 \
00177 if (TEST::verbose > 0) \
00178 std::cout << "Version: " << TEST::version_string << std::endl; \
00179 \
00180 char * pPath; \
00181 pPath = getenv ("OPENMS_TESTTIMEOUT"); \
00182 int timeout = 120; \
00183 \
00184 if (pPath!=NULL) \
00185 { \
00186 try \
00187 { \
00188 timeout = boost::lexical_cast<int>(pPath); \
00189 } \
00190 catch (boost::bad_lexical_cast&) \
00191 { \
00192 \
00193 } \
00194 } \
00195 OpenMS::ProcessResource::LimitCPUTime(timeout); \
00196 \
00197 try {
00198
00199
00211 #define END_TEST \
00212 \
00213 } \
00214 \
00215 catch (OpenMS::Exception::FileNotFound e) \
00216 { \
00217 TEST::this_test = false; \
00218 TEST::test = false; \
00219 TEST::all_tests = false; \
00220 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00221 { \
00222 if (TEST::exception == 1) \
00223 TEST::exception++; \
00224 std::cout << std::endl << " (caught exception of type `" \
00225 << e.getName() << "'"; \
00226 if ((e.getLine() > 0) && (std::strcmp(e.getFile(),"")!=0)) \
00227 std::cout << " outside a subtest, which was thrown in line " << e.getLine() \
00228 << " of file " << e.getFile() \
00229 << " in function " << e.getFunction(); \
00230 std::cout << " while looking for file " << e.getFilename(); \
00231 std::cout << " - unexpected!) " << std::endl; \
00232 } \
00233 } \
00234 \
00235 catch (OpenMS::Exception::Base& e) \
00236 { \
00237 TEST::this_test = false; \
00238 TEST::test = false; \
00239 TEST::all_tests = false; \
00240 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00241 { \
00242 if (TEST::exception == 1) \
00243 TEST::exception++; \
00244 std::cout << std::endl << " (caught exception of type `" \
00245 << e.getName() << "'"; \
00246 if ((e.getLine() > 0) && (std::strcmp(e.getFile(),"")!=0)) \
00247 std::cout << " outside a subtest, which was thrown in line " << e.getLine() \
00248 << " of file " << e.getFile() \
00249 << " in function " << e.getFunction(); \
00250 std::cout << " - unexpected!) " << std::endl; \
00251 std::cout << " (message is: " << e.what() << ")" << std::endl; \
00252 } \
00253 } \
00254 \
00255 catch (...) \
00256 { \
00257 TEST::this_test = false; \
00258 TEST::test = false; \
00259 TEST::all_tests = false; \
00260 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00261 { \
00262 std::cout << std::endl \
00263 << " (caught unidentified and unexpected exception outside a subtest!) " \
00264 << std::endl; \
00265 } \
00266 } \
00267 \
00268 \
00269 while (TEST::tmp_file_list.size() > 0 && TEST::verbose < 1) \
00270 { \
00271 unlink(TEST::tmp_file_list.back().c_str()); \
00272 TEST::tmp_file_list.pop_back(); \
00273 } \
00274 \
00275 if (!TEST::all_tests) \
00276 { \
00277 std::cout << "FAILED" << std::endl; \
00278 return 1; \
00279 } else { \
00280 std::cout << "PASSED" << std::endl; \
00281 return 0; \
00282 } \
00283 }
00284
00301 #define CHECK(name_of_test) \
00302 TEST::test = true; \
00303 TEST::newline = false; \
00304 TEST::test_name = #name_of_test; \
00305 TEST::test_count = 0; \
00306 TEST::check_line = __LINE__; \
00307 if (TEST::verbose > 0) \
00308 std::cout << "checking " << TEST::test_name \
00309 << " ... " << std::flush; \
00310 try \
00311 { \
00312 while (true) \
00313 {
00314
00331 #define STATUS(message) \
00332 if (TEST::verbose > 1) \
00333 { \
00334 if (!TEST::newline) \
00335 { \
00336 TEST::newline = true; \
00337 std::cout << std::endl; \
00338 } \
00339 std::cout << " status (line " << __LINE__ << "): " \
00340 << message << std::endl; \
00341 }
00342
00344 #define OK STATUS("ok")
00345
00370 #define RESULT \
00371 break; \
00372 } \
00373 } \
00374 \
00375 catch (OpenMS::Exception::FileNotFound& e) \
00376 { \
00377 TEST::this_test = false; \
00378 TEST::test = false; \
00379 TEST::all_tests = false; \
00380 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00381 { \
00382 if (TEST::exception == 1) \
00383 TEST::exception++; \
00384 std::cout << std::endl << " (caught exception of type `" \
00385 << e.getName() << "'"; \
00386 if ((e.getLine() > 0) && (std::strcmp(e.getFile(),"")!=0)) \
00387 std::cout << " outside a subtest, which was thrown in line " << e.getLine() \
00388 << " of file " << e.getFile() \
00389 << " in function `" << e.getFunction(); \
00390 std::cout << "' while looking for file " << e.getFilename(); \
00391 std::cout << " - unexpected!) " << std::endl; \
00392 } \
00393 } \
00394 catch (::OpenMS::Exception::Base& e) \
00395 { \
00396 TEST::this_test = false; \
00397 TEST::test = false; \
00398 TEST::all_tests = false; \
00399 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00400 { \
00401 if (!TEST::newline) \
00402 { \
00403 TEST::newline = true; \
00404 std::cout << std::endl; \
00405 } \
00406 std::cout << " (caught exception of type `" \
00407 << e.getName() << "'"; \
00408 if ((e.getLine() > 0) && (std::strcmp(e.getFile(),"")!=0)) \
00409 std::cout << " outside a subtest, which was thrown in line " << e.getLine() \
00410 << " of file " << e.getFile() \
00411 << " in function `" << e.getFunction(); \
00412 std::cout << "' - unexpected!) " << std::endl; \
00413 std::cout << " (message is: `" << e.what() << "')" << std::endl; \
00414 } \
00415 } \
00416 catch (std::exception& e) \
00417 { \
00418 TEST::this_test = false; \
00419 TEST::test = false; \
00420 TEST::all_tests = false; \
00421 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00422 { \
00423 if (!TEST::newline) \
00424 { \
00425 TEST::newline = true; \
00426 std::cout << std::endl; \
00427 } \
00428 std::cout << " (caught std::exception. Cause: `" << e.what() << "')" << std::endl; \
00429 } \
00430 } \
00431 catch (std::string& e) \
00432 { \
00433 TEST::this_test = false; \
00434 TEST::test = false; \
00435 TEST::all_tests = false; \
00436 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00437 { \
00438 if (!TEST::newline) \
00439 { \
00440 TEST::newline = true; \
00441 std::cout << std::endl; \
00442 } \
00443 std::cout << " (caught std::string as an exception: `" << e << "')" << std::endl; \
00444 } \
00445 } \
00446 catch (const char* e) \
00447 { \
00448 TEST::this_test = false; \
00449 TEST::test = false; \
00450 TEST::all_tests = false; \
00451 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00452 { \
00453 if (!TEST::newline) \
00454 { \
00455 TEST::newline = true; \
00456 std::cout << std::endl; \
00457 } \
00458 std::cout << " (caught char pointer as an exception: `" << e << "')" << std::endl; \
00459 } \
00460 } \
00461 catch (...) \
00462 { \
00463 TEST::this_test = false; \
00464 TEST::test = false; \
00465 TEST::all_tests = false; \
00466 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00467 { \
00468 if (!TEST::newline) \
00469 { \
00470 TEST::newline = true; \
00471 std::cout << std::endl; \
00472 } \
00473 std::cout << " (caught unidentified and unexpected exception!)" << std::endl; \
00474 } \
00475 } \
00476 \
00477 TEST::all_tests = TEST::all_tests && TEST::test; \
00478 if (TEST::verbose > 0) \
00479 { \
00480 if (TEST::test){ \
00481 std::cout << (TEST::verbose > 1 ? "passed\n" : "passed") << std::endl; \
00482 } else { \
00483 if (TEST::verbose > 1 ) \
00484 { \
00485 std::cout << "############################################################\n"; \
00486 } \
00487 std::cout \
00488 << __FILE__ ":" << TEST::check_line << ": CHECK(" << TEST::test_name << ") failed" \
00489 "\n" __FILE__ ":" << __LINE__ << ": RESULT == failed" << (TEST::verbose > 1 ? "\n" : "" ) \
00490 << std::endl; \
00491 } \
00492 } \
00493 \
00494 if (TEST::test_count==0) \
00495 { \
00496 bool destructor = false; \
00497 for (unsigned int i=0;i!=TEST::test_name.size();++i) \
00498 { \
00499 if (TEST::test_name[i] == '~') \
00500 { \
00501 destructor = true; \
00502 break; \
00503 } \
00504 } \
00505 if (!destructor) std::cerr << "Warning: no subtests performed in '" << TEST::test_name << "' (line " << __LINE__ << ")!" << std::endl;\
00506 } \
00507
00508
00520 #define NEW_TMP_FILE(filename) \
00521 filename = String(__FILE__).prefix('.') + '_' + String(__LINE__) + ".tmp"; \
00522 TEST::tmp_file_list.push_back(filename); \
00523 if (TEST::verbose > 1) \
00524 { \
00525 if (!TEST::newline) \
00526 { \
00527 TEST::newline = true; \
00528 std::cout << std::endl; \
00529 } \
00530 std::cout << " creating new temporary filename '" << filename \
00531 << "' (line " << __LINE__ << ")" << std::endl; \
00532 }
00533
00534
00535
00549 #define TEST_REAL_EQUAL(a,b) \
00550 ++TEST::test_count; \
00551 TEST::test_line = __LINE__; \
00552 TEST::this_test = (fabs((double)(a) - (double)(b)) < TEST::precision); \
00553 TEST::test = TEST::test && TEST::this_test; \
00554 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00555 { \
00556 if (!TEST::newline) \
00557 { \
00558 TEST::newline = true; \
00559 std::cout << std::endl; \
00560 } \
00561 if (TEST::this_test) \
00562 std::cout << " (line " << __LINE__ << ": TEST_REAL_EQUAL(" #a "," #b "): got " \
00563 << (a) << ", expected " << (b) << ") + " << std::endl; \
00564 else \
00565 std::cout << __FILE__ ":" << TEST::test_line << ": TEST_REAL_EQUAL(" #a "," #b "): got " \
00566 << (a) << ", expected " << (b) << " (difference is "<< (double)(a) - (double)(b) << ") - " << std::endl; \
00567 }
00568
00581 #define TEST_STRING_EQUAL(a,b) \
00582 ++TEST::test_count; \
00583 TEST::test_line = __LINE__; \
00584 TEST::this_test = (std::string(a) == std::string(b)); \
00585 TEST::test = TEST::test && TEST::this_test; \
00586 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00587 { \
00588 if (!TEST::newline) \
00589 { \
00590 TEST::newline = true; \
00591 std::cout << std::endl; \
00592 } \
00593 if (TEST::this_test) \
00594 std::cout << " (line " << __LINE__ << " TEST_STRING_EQUAL("<< #a << "," << #b << "): got \"" \
00595 << (a) << "\", expected \"" << (b) << "\") + " << std::endl; \
00596 else \
00597 std::cout << __FILE__ ":" << TEST::test_line << ": TEST_STRING_EQUAL(" #a "," #b "): got \"" \
00598 << (a) << "\", expected \"" << (b) << "\" - " << std::endl; \
00599 }
00600
00616 #define TEST_EQUAL(a,b) \
00617 { \
00618 ++TEST::test_count; \
00619 TEST::test_line = __LINE__; \
00620 TEST::this_test = ((a) == (b)); \
00621 TEST::test = TEST::test && TEST::this_test; \
00622 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00623 { \
00624 if (!TEST::newline) \
00625 { \
00626 TEST::newline = true; \
00627 std::cout << std::endl; \
00628 } \
00629 if (TEST::this_test) \
00630 std::cout << " (line " << __LINE__ << ": TEST_EQUAL(" #a "," #b "): got " \
00631 << (a) << ", expected " << (b) << ") + " << std::endl; \
00632 else \
00633 std::cout << __FILE__ ":" << TEST::test_line << ": TEST_EQUAL(" #a "," #b "): got " \
00634 << (a) << ", expected " << (b) << " - " << std::endl; \
00635 } \
00636 }
00637
00650 #define TEST_NOT_EQUAL(a,b) \
00651 { \
00652 ++TEST::test_count; \
00653 TEST::test_line = __LINE__; \
00654 TEST::this_test = !((a) == (b)); \
00655 TEST::test = TEST::test && TEST::this_test; \
00656 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00657 { \
00658 if (!TEST::newline) \
00659 { \
00660 TEST::newline = true; \
00661 std::cout << std::endl; \
00662 } \
00663 if (TEST::this_test) \
00664 std::cout << " (line " << __LINE__ << " TEST_NOT_EQUAL(" #a "," #b "): got " \
00665 << (a) << ", forbidden is " << (b) << ") + " << std::endl; \
00666 else \
00667 std::cout << __FILE__ ":" << TEST::test_line << ": TEST_NOT_EQUAL(" #a "," #b "): got " \
00668 << (a) << ", forbidden is " << (b) << " - " << std::endl; \
00669 } \
00670 }
00671
00682 #define TEST_EXCEPTION(exception_type,command) \
00683 { \
00684 ++TEST::test_count; \
00685 TEST::test_line = __LINE__; \
00686 TEST::exception = 0; \
00687 try \
00688 { \
00689 command; \
00690 } \
00691 catch (exception_type) \
00692 { \
00693 TEST::exception = 1; \
00694 } \
00695 catch (::OpenMS::Exception::Base e) \
00696 { \
00697 TEST::exception = 2; \
00698 TEST::exception_name = e.getName(); \
00699 } \
00700 catch (...) \
00701 { \
00702 TEST::exception = 3; \
00703 } \
00704 TEST::this_test = (TEST::exception == 1); \
00705 TEST::test = TEST::test && TEST::this_test; \
00706 \
00707 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00708 { \
00709 if (!TEST::newline) \
00710 { \
00711 TEST::newline = true; \
00712 std::cout << std::endl; \
00713 } \
00714 switch (TEST::exception) \
00715 { \
00716 case 0: \
00717 std::cout << __FILE__ ":" << TEST::test_line << \
00718 ": TEST_EXCEPTION(" #exception_type "," #command "): no exception thrown! - " \
00719 << std::endl; break; \
00720 case 1: \
00721 std::cout << " (line " << TEST::test_line << \
00722 " TEST_EXCEPTION(" #exception_type "," #command "): OK) +" \
00723 << std::endl; break; \
00724 case 2: \
00725 std::cout << __FILE__ ":" << TEST::test_line << \
00726 ": TEST_EXCEPTION(" #exception_type "," #command "): wrong exception thrown! \"" \
00727 << TEST::exception_name << "\" - " << std::endl; break; \
00728 case 3: \
00729 std::cout << __FILE__ ":" << TEST::test_line << \
00730 ": TEST_EXCEPTION(" #exception_type "," #command "): wrong exception thrown! - " \
00731 << std::endl; break; \
00732 } \
00733 } \
00734 }
00735
00745 #define NOT_TESTABLE \
00746 TEST::test_count = 1;
00747
00748
00762 #define TEST_EXCEPTION_WITH_MESSAGE(exception_type,command, message) \
00763 { \
00764 ++TEST::test_count; \
00765 TEST::test_line = __LINE__; \
00766 TEST::exception = 0; \
00767 try \
00768 { \
00769 command; \
00770 } \
00771 catch (exception_type et) \
00772 { \
00773 if ( std::string(et.getMessage()) != std::string(message) ) \
00774 { \
00775 TEST::exception = 4; \
00776 TEST::exception_message = et.getMessage(); \
00777 } \
00778 else TEST::exception = 1; \
00779 } \
00780 catch (::OpenMS::Exception::Base e) \
00781 { \
00782 TEST::exception = 2; \
00783 TEST::exception_name = e.getName(); \
00784 } \
00785 catch (...) \
00786 { \
00787 TEST::exception = 3; \
00788 } \
00789 TEST::this_test = (TEST::exception == 1); \
00790 TEST::test = TEST::test && TEST::this_test; \
00791 \
00792 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00793 { \
00794 if (!TEST::newline) \
00795 { \
00796 TEST::newline = true; \
00797 std::cout << std::endl; \
00798 } \
00799 switch (TEST::exception) \
00800 { \
00801 case 0: \
00802 std::cout << __FILE__ ":" << TEST::test_line << \
00803 ": TEST_EXCEPTION(" #exception_type "," #command ", " #message "): no exception thrown! - " \
00804 << std::endl; break; \
00805 case 1: \
00806 std::cout << " (line " << TEST::test_line << \
00807 " TEST_EXCEPTION(" #exception_type "," #command ", " #message "): OK) +" \
00808 << std::endl; break; \
00809 case 2: \
00810 std::cout << __FILE__ ":" << TEST::test_line << \
00811 ": TEST_EXCEPTION(" #exception_type "," #command ", " #message "): wrong exception thrown! \"" \
00812 << TEST::exception_name << "\" - " << std::endl; break; \
00813 case 3: \
00814 std::cout << __FILE__ ":" << TEST::test_line << \
00815 ": TEST_EXCEPTION(" #exception_type "," #command ", " #message "): wrong exception thrown! - " \
00816 << std::endl; break; \
00817 case 4: \
00818 std::cout << __FILE__ ":" << TEST::test_line << \
00819 ": TEST_EXCEPTION(" #exception_type "," #command ", " #message "): exception has wrong message: got '" \
00820 << (TEST::exception_message) << "', expected '" << (message) << "' - "<< std::endl; break; \
00821 } \
00822 } \
00823 }
00824
00832 #define ABORT_IF(condition) \
00833 \
00834 if (condition) \
00835 { \
00836 if (TEST::verbose > 1) \
00837 { \
00838 if (!TEST::newline) \
00839 { \
00840 TEST::newline = true; \
00841 std::cout << std::endl; \
00842 } \
00843 std::cout << __FILE__ ":" << __LINE__ << ": ABORT_IF(" #condition "): TEST ABORTED" \
00844 << std::endl; \
00845 } \
00846 break; \
00847 }
00848
00863 #define TEST_FILE(filename, templatename) \
00864 \
00865 { \
00866 ++TEST::test_count; \
00867 TEST::equal_files = true; \
00868 TEST::infile.open(filename, std::ios::in); \
00869 TEST::templatefile.open(templatename, std::ios::in); \
00870 \
00871 if (TEST::infile.good() && TEST::templatefile.good()) \
00872 { \
00873 std::string TEST_FILE__template_line; \
00874 std::string TEST_FILE__line; \
00875 \
00876 while (TEST::infile.good() && TEST::templatefile.good()) \
00877 { \
00878 TEST::templatefile.getline(TEST::line_buffer, 65535); \
00879 TEST_FILE__template_line = TEST::line_buffer; \
00880 TEST::infile.getline(TEST::line_buffer, 65535); \
00881 TEST_FILE__line = TEST::line_buffer; \
00882 \
00883 TEST::equal_files &= (TEST_FILE__template_line == TEST_FILE__line); \
00884 if (TEST_FILE__template_line != TEST_FILE__line) \
00885 { \
00886 if (TEST::verbose > 0) \
00887 { \
00888 if (!TEST::newline) \
00889 { \
00890 TEST::newline = true; \
00891 std::cout << std::endl; \
00892 } \
00893 \
00894 std::cout << " TEST_FILE: line mismatch:\n got: '" \
00895 << TEST_FILE__line << "'\n expected: '" << TEST_FILE__template_line << "'" << std::endl; \
00896 } \
00897 } \
00898 } \
00899 } else { \
00900 TEST::equal_files = false; \
00901 \
00902 if (TEST::verbose > 0) \
00903 { \
00904 if (!TEST::newline) \
00905 { \
00906 TEST::newline = true; \
00907 std::cout << std::endl; \
00908 } \
00909 \
00910 std::cout << " (line " << __LINE__ << ": TEST_FILE(" << #filename << ", " << #templatename ; \
00911 std::cout << ") : " << " cannot open file: \""; \
00912 if (!TEST::infile.good()) \
00913 { \
00914 std::cout << filename << "\" (input file) "; \
00915 } \
00916 if (!TEST::templatefile.good()) \
00917 { \
00918 std::cout << templatename << "\" (template file) "; \
00919 } \
00920 std::cout << std::endl; \
00921 \
00922 } \
00923 } \
00924 TEST::infile.close(); \
00925 TEST::templatefile.close(); \
00926 TEST::infile.clear(); \
00927 TEST::templatefile.clear(); \
00928 \
00929 TEST::this_test = TEST::equal_files; \
00930 TEST::test = TEST::test && TEST::this_test; \
00931 if ((TEST::verbose > 1) || (!TEST::this_test && (TEST::verbose > 0))) \
00932 { \
00933 if (!TEST::newline) \
00934 { \
00935 TEST::newline = true; \
00936 std::cout << std::endl; \
00937 } \
00938 std::cout << " (line " << __LINE__ << ": TEST_FILE("<< #filename << ", " << #templatename << "): "; \
00939 if (TEST::this_test) \
00940 { \
00941 std::cout << "true + " << std::endl; \
00942 } else { \
00943 std::cout << "false - " << std::endl; \
00944 std::cout << " (different files: "<< filename << " " << templatename << " )\n"; \
00945 } \
00946 } \
00947 }
00948
00950
00951 #endif //OPENMS_CONCEPT_CLASSTEST_H