From ea3cd4c64095f79d9a179adfe24a2784c330ec70 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 1 Sep 2002 23:22:48 +0000 Subject: [PATCH] Unit test add-on for the interface kit. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@953 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kits/interface/InterfaceKitTestAddon.cpp | 14 +++++ src/tests/kits/interface/common.h | 62 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/tests/kits/interface/InterfaceKitTestAddon.cpp create mode 100644 src/tests/kits/interface/common.h diff --git a/src/tests/kits/interface/InterfaceKitTestAddon.cpp b/src/tests/kits/interface/InterfaceKitTestAddon.cpp new file mode 100644 index 0000000000..293faf1a4e --- /dev/null +++ b/src/tests/kits/interface/InterfaceKitTestAddon.cpp @@ -0,0 +1,14 @@ +#include +#include + +// ##### Include headers for your tests here ##### +#include "bbitmap/BitmapTest.h" + +BTestSuite* getTestSuite() { + BTestSuite *suite = new BTestSuite("Interface"); + + // ##### Add test suites here ##### + suite->addTest("BBitmap", BitmapTestSuite()); + + return suite; +} diff --git a/src/tests/kits/interface/common.h b/src/tests/kits/interface/common.h new file mode 100644 index 0000000000..2e9f6b95bf --- /dev/null +++ b/src/tests/kits/interface/common.h @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// common.h +// +//------------------------------------------------------------------------------ + +#ifndef COMMON_H +#define COMMON_H + +// Standard Includes ----------------------------------------------------------- +#include +#include + +// System Includes ------------------------------------------------------------- + +// Project Includes ------------------------------------------------------------ +#include "cppunit/TestCaller.h" +#include "cppunit/TestCase.h" +#include "cppunit/TestResult.h" +#include "cppunit/TestSuite.h" +#include "cppunit/TextTestResult.h" + +// Local Includes -------------------------------------------------------------- + +// Local Defines --------------------------------------------------------------- +#define assert_err(condition) \ + (this->assertImplementation ((condition), std::string((#condition)) + \ + strerror(condition),\ + __LINE__, __FILE__)) + +#define ADD_TEST4(classbeingtested, suitename, classname, funcname) \ + (suitename)->addTest(new TestCaller((#classbeingtested "::" #funcname), \ + &classname::funcname)); + +#define ADD_TEST ADD_TEST4 + +#define CHECK_ERRNO \ + cout << endl << "errno == \"" << strerror(errno) << "\" (" << errno \ + << ") in " << __PRETTY_FUNCTION__ << endl + +#define CHECK_STATUS(status__) \ + cout << endl << "status_t == \"" << strerror((status__)) << "\" (" \ + << (status__) << ") in " << __PRETTY_FUNCTION__ << endl + +#ifdef USE_DEBUGGER_TESTS +#define DEBUGGER_ESCAPE +#else +#define DEBUGGER_ESCAPE return +#endif + +// Globals --------------------------------------------------------------------- + +using namespace CppUnit; + +#endif //COMMON_H + +/* + * $Log $ + * + * $Id $ + * + */ +