vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / app / bhandler / HandlerLooperTest.cpp
blob9f074a75fe7a232a3edac39e3ea3d387058fcd78
1 //------------------------------------------------------------------------------
2 // LooperTest.cpp
3 //
4 //------------------------------------------------------------------------------
6 // Standard Includes -----------------------------------------------------------
8 // System Includes -------------------------------------------------------------
9 #include <Looper.h>
11 // Project Includes ------------------------------------------------------------
13 // Local Includes --------------------------------------------------------------
14 #include "HandlerLooperTest.h"
16 // Local Defines ---------------------------------------------------------------
18 // Globals ---------------------------------------------------------------------
20 //------------------------------------------------------------------------------
21 /**
22 Looper()
23 @case Not added to a BLooper
24 @results Returns NULL
26 void TLooperTest::LooperTest1()
28 CPPUNIT_ASSERT(fHandler.Looper() == NULL);
30 //------------------------------------------------------------------------------
31 /**
32 Looper()
33 @case Add to a BLooper, then remove
34 @results Returns the added-to BLooper; when removed, returns NULL
36 void TLooperTest::LooperTest2()
38 BLooper Looper;
39 Looper.AddHandler(&fHandler);
40 CPPUNIT_ASSERT(fHandler.Looper() == &Looper);
42 CPPUNIT_ASSERT(Looper.RemoveHandler(&fHandler));
43 CPPUNIT_ASSERT(fHandler.Looper() == NULL);
45 //------------------------------------------------------------------------------
46 Test* TLooperTest::Suite()
48 TestSuite* SuiteOfTests = new TestSuite("BHandler::Looper");
50 ADD_TEST4(BHandler, SuiteOfTests, TLooperTest, LooperTest1);
51 ADD_TEST4(BHandler, SuiteOfTests, TLooperTest, LooperTest2);
53 return SuiteOfTests;
55 //------------------------------------------------------------------------------
58 * $Log $
60 * $Id $