xref: /haiku/headers/tools/cppunit/TestUtils.h (revision 58481f0f6ef1a61ba07283f012cafbc2ed874ead)
1 #ifndef __beos_test_utils_h__
2 #define __beos_test_utils_h__
3 
4 #include <string>
5 #include <SupportDefs.h>
6 
7 #include <cppunit/Portability.h>
8 
9 // Handy defines :-)
10 #define CHK CPPUNIT_ASSERT
11 #define RES DecodeResult
12 
13 // Prints out a description of the given status_t
14 // return code to standard out. Helpful for figuring
15 // out just what the R5 libraries are returning.
16 // Returns the same value passed in, so you can
17 // use it inline in tests if necessary.
18 extern CPPUNIT_API status_t DecodeResult(status_t result);
19 
20 // First parameter is equal to the second or third
21 template<typename A, typename B, typename C>
22 static
23 inline
24 bool
Equals(const A & a,const B & b,const C & c)25 Equals(const A &a, const B &b, const C &c)
26 {
27 	return (a == b || a == c);
28 }
29 
30 // Returns a string version of the given integer
31 extern CPPUNIT_API std::string IntToStr(int i);
32 
33 // Calls system() with the concatenated string of command and parameter.
34 extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter);
35 
36 // Calls system() with the concatenated string of command, parameter1,
37 // " " and parameter2.
38 extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter1,
39 									const char *parameter2);
40 
41 // Calls system() with the given command (kind of silly, but it's consistent :-)
42 extern CPPUNIT_API void ExecCommand(const char *command);
43 
44 #endif	// __beos_test_utils_h__
45