Files
haiku-beta6/headers/tools/cppunit/TestUtils.h
T
Kacper Kasper dc8424dd5e unittests: Start simplifying test structure
* Rework ByteOrderTest and DateTimeTest to use autoregistration.
* Functional changes in ByteOrderTest are confirmed in git history
  to be R5 compatibility fixes. This doesn't include B_ASCII_TYPE -
  it seems it has never been part of is_type_swapped().
* Autoregistered test names start with a number - this is because
  RTTI is used to create them. Disabling RTTI is not an option
  because CppUnit in our repo has a broken macro which always sets
  the name to "ATestFixtureType". This is probably fixed in newer
  CppUnit versions.

Change-Id: I56ab5df6e998b6f47fca3c3458a56a761c1740a8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10266
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Kacper Kasper <[email protected]>
2026-02-20 19:31:36 +00:00

46 lines
1.4 KiB
C++

#ifndef __beos_test_utils_h__
#define __beos_test_utils_h__
#include <string>
#include <SupportDefs.h>
#include <cppunit/Portability.h>
#include <cppunit/extensions/HelperMacros.h>
// Handy defines :-)
#define CHK CPPUNIT_ASSERT
#define RES DecodeResult
// Prints out a description of the given status_t
// return code to standard out. Helpful for figuring
// out just what the R5 libraries are returning.
// Returns the same value passed in, so you can
// use it inline in tests if necessary.
extern CPPUNIT_API status_t DecodeResult(status_t result);
// First parameter is equal to the second or third
template<typename A, typename B, typename C>
static
inline
bool
Equals(const A &a, const B &b, const C &c)
{
return (a == b || a == c);
}
// Returns a string version of the given integer
extern CPPUNIT_API std::string IntToStr(int i);
// Calls system() with the concatenated string of command and parameter.
extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter);
// Calls system() with the concatenated string of command, parameter1,
// " " and parameter2.
extern CPPUNIT_API void ExecCommand(const char *command, const char *parameter1,
const char *parameter2);
// Calls system() with the given command (kind of silly, but it's consistent :-)
extern CPPUNIT_API void ExecCommand(const char *command);
#endif // __beos_test_utils_h__