xref: /haiku/src/tests/kits/support/bblockcache/BlockCacheExerciseTest.h (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1 /*
2 	$Id: BlockCacheExerciseTest.h 4522 2003-09-07 11:53:03Z bonefish $
3 
4 	This file defines a class for performing tests on the BBlockCache class.
5 
6 	*/
7 
8 
9 #ifndef BlockCacheExerciseTest_H
10 #define BlockCacheExerciseTest_H
11 
12 
13 #include "cppunit/TestCase.h"
14 #include <List.h>
15 
16 
17 class BBlockCache;
18 
19 
20 class BlockCacheExerciseTest : public CppUnit::TestCase {
21 
22 private:
23 	BBlockCache *theCache;
24 	int numBlocksInCache;
25 	size_t sizeOfBlocksInCache;
26 	size_t sizeOfNonCacheBlocks;
27 
28 	bool isMallocTest;
29 
30 	BList freeList;
31 	BList usedList;
32 	BList nonCacheList;
33 
34 	void BuildLists(void);
35 	void *GetBlock(size_t blockSize);
36 	void SaveBlock(void *, size_t blockSize);
37 	void FreeBlock(void *, size_t blockSize);
38 	void TestBlockCache(void);
39 
40 protected:
41 
42 public:
43 	static CppUnit::Test *suite(void);
44 	BlockCacheExerciseTest(std::string = "");
45 	virtual ~BlockCacheExerciseTest();
46 	virtual void PerformTest(void);
47 };
48 
49 #endif
50