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