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