xref: /haiku/src/tests/kits/support/barchivable/common.h (revision b1698c8e74d85bcd43c784832988c988b58eec78)
1a6b33ea3STyler Dauwalder //------------------------------------------------------------------------------
2a6b33ea3STyler Dauwalder 
3a6b33ea3STyler Dauwalder #ifndef COMMON_H
4a6b33ea3STyler Dauwalder #define COMMON_H
5a6b33ea3STyler Dauwalder 
6a6b33ea3STyler Dauwalder // Standard Includes -----------------------------------------------------------
7a6b33ea3STyler Dauwalder #include <posix/string.h>
8a6b33ea3STyler Dauwalder #include <errno.h>
9a6b33ea3STyler Dauwalder 
10a6b33ea3STyler Dauwalder // System Includes -------------------------------------------------------------
11a6b33ea3STyler Dauwalder 
12a6b33ea3STyler Dauwalder // Project Includes ------------------------------------------------------------
13a6b33ea3STyler Dauwalder #include "cppunit/TestCaller.h"
14a6b33ea3STyler Dauwalder #include "TestCase.h"
15a6b33ea3STyler Dauwalder //#include "TestResult.h"
16a6b33ea3STyler Dauwalder #include "cppunit/TestSuite.h"
17a6b33ea3STyler Dauwalder 
18a6b33ea3STyler Dauwalder // Local Includes --------------------------------------------------------------
19a6b33ea3STyler Dauwalder 
20a6b33ea3STyler Dauwalder // Local Defines ---------------------------------------------------------------
21a6b33ea3STyler Dauwalder #define assert_err(condition)	\
22a6b33ea3STyler Dauwalder     (this->assertImplementation ((condition), std::string((#condition)) +	\
23a6b33ea3STyler Dauwalder     	strerror(condition),\
24a6b33ea3STyler Dauwalder         __LINE__, __FILE__))
25a6b33ea3STyler Dauwalder 
26a6b33ea3STyler Dauwalder #define ADD_TEST(suitename, classname, funcname)				\
27a6b33ea3STyler Dauwalder 	(suitename)->addTest(new CppUnit::TestCaller<classname>(std::string("BArchivable::") + \
28a6b33ea3STyler Dauwalder 				std::string((#funcname)), &classname::funcname));
29a6b33ea3STyler Dauwalder 
30*b1698c8eSejakowatz #define ADD_TEST4(classbeingtested, suitename, classname, funcname)				\
31*b1698c8eSejakowatz 	(suitename)->addTest(new TestCaller<classname>((#classbeingtested "::" #funcname),	\
32*b1698c8eSejakowatz 						 &classname::funcname));
33a6b33ea3STyler Dauwalder #define CHECK_ERRNO														\
34a6b33ea3STyler Dauwalder 	cout << endl << "errno == \"" << strerror(errno) << "\" (" << errno	\
35a6b33ea3STyler Dauwalder 		 << ") in " << __PRETTY_FUNCTION__ << endl
36a6b33ea3STyler Dauwalder 
37a6b33ea3STyler Dauwalder #define CHECK_STATUS(status__)											\
38a6b33ea3STyler Dauwalder 	cout << endl << "status_t == \"" << strerror((status__)) << "\" ("	\
39a6b33ea3STyler Dauwalder 		 << (status__) << ") in " << __PRETTY_FUNCTION__ << endl
40a6b33ea3STyler Dauwalder 
41a6b33ea3STyler Dauwalder // Globals ---------------------------------------------------------------------
42a6b33ea3STyler Dauwalder 
43a6b33ea3STyler Dauwalder 
44a6b33ea3STyler Dauwalder #endif	//COMMON_H
45a6b33ea3STyler Dauwalder 
46a6b33ea3STyler Dauwalder /*
47a6b33ea3STyler Dauwalder  * $Log $
48a6b33ea3STyler Dauwalder  *
49a6b33ea3STyler Dauwalder  * $Id  $
50a6b33ea3STyler Dauwalder  *
51a6b33ea3STyler Dauwalder  */
52a6b33ea3STyler Dauwalder 
53