vfs: check userland buffers before reading them.
[haiku.git] / src / tests / kits / app / bhandler / IsWatchedTest.cpp
bloba20bd3a96da500d49a0fd1a93bf617e5d1644264
1 //------------------------------------------------------------------------------
2 // IsWatchedTest.cpp
3 //
4 //------------------------------------------------------------------------------
6 // Standard Includes -----------------------------------------------------------
8 // System Includes -------------------------------------------------------------
10 // Project Includes ------------------------------------------------------------
12 // Local Includes --------------------------------------------------------------
13 #include "IsWatchedTest.h"
15 // Local Defines ---------------------------------------------------------------
17 // Globals ---------------------------------------------------------------------
19 //------------------------------------------------------------------------------
20 /**
21 IsWatched()
22 @case No added watchers
23 @results Returns false
25 void TIsWatchedTest::IsWatched1()
27 CPPUNIT_ASSERT(!fHandler.IsWatched());
29 //------------------------------------------------------------------------------
30 /**
31 IsWatched()
32 @case Add then remove watcher
33 @results Returns true after add, returns false after remove
34 @note Original implementation fails this test. Either the removal
35 doesn't happen (unlikely) or some list-within-a-list doesn't
36 get removed when there's nothing in it anymore.
38 void TIsWatchedTest::IsWatched2()
40 BHandler Watcher;
41 fHandler.StartWatching(&Watcher, '1234');
42 CPPUNIT_ASSERT(fHandler.IsWatched() == true);
44 fHandler.StopWatching(&Watcher, '1234');
45 #ifndef TEST_R5
46 CPPUNIT_ASSERT(fHandler.IsWatched() == false);
47 #endif
49 //------------------------------------------------------------------------------
50 Test* TIsWatchedTest::Suite()
52 TestSuite* SuiteOfTests = new TestSuite("BHandler::IsWatched");
54 ADD_TEST4(BHandler, SuiteOfTests, TIsWatchedTest, IsWatched1);
55 ADD_TEST4(BHandler, SuiteOfTests, TIsWatchedTest, IsWatched2);
57 return SuiteOfTests;
59 //------------------------------------------------------------------------------
62 * $Log $
64 * $Id $