Mostly fixes for silly compile error, plus an additional test.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@524 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz 2002-07-28 21:49:42 +00:00
parent 7e24e06e2c
commit b1698c8e74
9 changed files with 170 additions and 52 deletions

View File

@ -41,6 +41,7 @@
#include <File.h>
#include <Locker.h>
#include <Path.h>
#include <PropertyInfo.h>
#include <RegistrarDefs.h>
#include <Roster.h>

View File

@ -93,7 +93,7 @@ team_id BLooper::sTeamID = B_ERROR;
static property_info gLooperPropInfo[] =
{
{
"Handler"
"Handler",
{},
{B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER},
// TODO: what is the extra_data for?
@ -103,7 +103,7 @@ static property_info gLooperPropInfo[] =
{}
},
{
"Handlers"
"Handlers",
{B_GET_PROPERTY},
{B_DIRECT_SPECIFIER},
NULL, 0,
@ -112,7 +112,7 @@ static property_info gLooperPropInfo[] =
{}
},
{
"Handler"
"Handler",
{B_COUNT_PROPERTIES},
{B_DIRECT_SPECIFIER},
NULL, 0,

View File

@ -31,7 +31,9 @@ CommonTestLib libapptest.so
HandlerAtTest.cpp
IndexOfTest.cpp
IsMessageWaitingTest.cpp
RemoveHandlerTest.cpp
RemoveHandlerTest.cpp
PerformTest.cpp
RunTest.cpp
# BMessageQueue
MessageQueueTest.cpp

View File

@ -1,23 +1,31 @@
BLooper(const char* name = NULL,
int32 priority = B_NORMAL_PRIORITY,
int32 port_capacity = B_LOOPER_PORT_DEFAULT_CAPACITY);
~BLooper();
BLooper(BMessage* data);
Instantiate(BMessage* data);
Archive(BMessage* data, bool deep = true) const;
PostMessage(uint32 command);
PostMessage(BMessage* message);
PostMessage(uint32 command,
BHandler* handler,
BHandler* reply_to = NULL);
PostMessage(BMessage* message,
BHandler* handler,
BHandler* reply_to = NULL);
DispatchMessage(BMessage* message, BHandler* handler);
MessageReceived(BMessage* msg);
CurrentMessage() const;
DetachCurrentMessage();
MessageQueue() const;
BLooper(const char* name, int32 priority, int32 port_capacity)
--------------
~BLooper()
--------------
BLooper(BMessage* data)
--------------
Instantiate(BMessage* data)
--------------
Archive(BMessage* data, bool deep) const
--------------
PostMessage(uint32 command)
--------------
PostMessage(BMessage* message)
--------------
PostMessage(uint32 command, BHandler* handler, BHandler* reply_to)
--------------
PostMessage(BMessage* message, BHandler* handler, BHandler* reply_to);
--------------
DispatchMessage(BMessage* message, BHandler* handler)
--------------
MessageReceived(BMessage* msg)
--------------
CurrentMessage() const
--------------
DetachCurrentMessage()
--------------
MessageQueue() const
--------------
IsMessageWaiting()
--------------
@ -67,27 +75,45 @@ Run();
--------------
case 1: Attempt to call Run() twice
Quit();
QuitRequested();
Lock();
Unlock();
IsLocked() const;
LockWithTimeout(bigtime_t timeout);
Thread() const;
Team() const;
LooperForThread(thread_id tid);
LockingThread() const;
CountLocks() const;
CountLockRequests() const;
Sem() const;
ResolveSpecifier(BMessage* msg,
int32 index,
BMessage* specifier,
int32 form,
const char* property);
GetSupportedSuites(BMessage* data);
AddCommonFilter(BMessageFilter* filter);
RemoveCommonFilter(BMessageFilter* filter);
SetCommonFilterList(BList* filters);
CommonFilterList() const;
Perform(perform_code d, void* arg);
Quit()
--------------
QuitRequested()
--------------
Lock()
--------------
Unlock()
--------------
IsLocked() const
--------------
LockWithTimeout(bigtime_t timeout)
--------------
Thread() const
--------------
Team() const
--------------
LooperForThread(thread_id tid)
--------------
LockingThread() const
--------------
CountLocks() const
--------------
CountLockRequests() const
--------------
Sem() const
--------------
ResolveSpecifier(BMessage* msg, int32 index, BMessage* specifier, int32 form, const char* property);
--------------
GetSupportedSuites(BMessage* data)
--------------
AddCommonFilter(BMessageFilter* filter)
--------------
RemoveCommonFilter(BMessageFilter* filter)
--------------
SetCommonFilterList(BList* filters)
--------------
CommonFilterList() const
--------------
Perform(perform_code d, void* arg)
--------------
case 1: returns B_ERROR;

View File

@ -6,6 +6,8 @@
#include "CountHandlersTest.h"
#include "HandlerAtTest.h"
#include "AddHandlerTest.h"
#include "PerformTest.h"
#include "RunTest.h"
Test* LooperTestSuite()
{
@ -17,6 +19,8 @@ Test* LooperTestSuite()
tests->addTest(TCountHandlersTest::Suite());
tests->addTest(THandlerAtTest::Suite());
tests->addTest(TAddHandlerTest::Suite());
tests->addTest(TPerformTest::Suite());
tests->addTest(TRunTest::Suite());
return tests;
}

View File

@ -0,0 +1,43 @@
//------------------------------------------------------------------------------
// PerformTest.cpp
//
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
#include <Looper.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
#include "PerformTest.h"
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
void TPerformTest::PerformTest1()
{
BLooper Looper;
CPPUNIT_ASSERT(Looper.Perform(1, NULL) == B_ERROR);
}
//------------------------------------------------------------------------------
TestSuite* TPerformTest::Suite()
{
TestSuite* suite = new TestSuite("BLooper::Perform(perform_code, void*)");
ADD_TEST(BLooper, suite, TPerformTest, PerformTest1);
return suite;
}
//------------------------------------------------------------------------------
/*
* $Log $
*
* $Id $
*
*/

View File

@ -0,0 +1,41 @@
//------------------------------------------------------------------------------
// PerformTest.h
//
//------------------------------------------------------------------------------
#ifndef PERFORMTEST_H
#define PERFORMTEST_H
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
#include "../common.h"
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
class TPerformTest : public TestCase
{
public:
TPerformTest() {;}
TPerformTest(std::string name) : TestCase(name) {;}
void PerformTest1();
static TestSuite* Suite();
};
#endif //PERFORMTEST_H
/*
* $Log $
*
* $Id $
*
*/

View File

@ -27,14 +27,12 @@
strerror(condition),\
__LINE__, __FILE__))
#define ADD_TEST(suitename, classname, funcname) \
(suitename)->addTest(new TestCaller<classname>((#funcname), \
&classname::funcname));
#define ADD_TEST4(classbeingtested, suitename, classname, funcname) \
(suitename)->addTest(new TestCaller<classname>((#classbeingtested "::" #funcname), \
&classname::funcname));
#define ADD_TEST ADD_TEST4
#define CHECK_ERRNO \
cout << endl << "errno == \"" << strerror(errno) << "\" (" << errno \
<< ") in " << __PRETTY_FUNCTION__ << endl

View File

@ -27,6 +27,9 @@
(suitename)->addTest(new CppUnit::TestCaller<classname>(std::string("BArchivable::") + \
std::string((#funcname)), &classname::funcname));
#define ADD_TEST4(classbeingtested, suitename, classname, funcname) \
(suitename)->addTest(new TestCaller<classname>((#classbeingtested "::" #funcname), \
&classname::funcname));
#define CHECK_ERRNO \
cout << endl << "errno == \"" << strerror(errno) << "\" (" << errno \
<< ") in " << __PRETTY_FUNCTION__ << endl