1 | // |
2 | // LRUCacheTest.h |
3 | // |
4 | // Tests for LRUCache |
5 | // |
6 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
7 | // and Contributors. |
8 | // |
9 | // SPDX-License-Identifier: BSL-1.0 |
10 | // |
11 | |
12 | #ifndef LRUCacheTest_INCLUDED |
13 | #define LRUCacheTest_INCLUDED |
14 | |
15 | |
16 | #include "Poco/Foundation.h" |
17 | #include "Poco/KeyValueArgs.h" |
18 | #include "Poco/CppUnit/TestCase.h" |
19 | |
20 | |
21 | class LRUCacheTest: public CppUnit::TestCase |
22 | { |
23 | public: |
24 | LRUCacheTest(const std::string& name); |
25 | ~LRUCacheTest(); |
26 | |
27 | void testClear(); |
28 | void testCacheSize0(); |
29 | void testCacheSize1(); |
30 | void testCacheSize2(); |
31 | void testCacheSizeN(); |
32 | void testDuplicateAdd(); |
33 | void testUpdate(); |
34 | |
35 | void setUp(); |
36 | void tearDown(); |
37 | static CppUnit::Test* suite(); |
38 | |
39 | private: |
40 | void onUpdate(const void* pSender, const Poco::KeyValueArgs<int, int>& args); |
41 | void onAdd(const void* pSender, const Poco::KeyValueArgs<int, int>& args); |
42 | void onRemove(const void* pSender, const int& args); |
43 | |
44 | private: |
45 | int addCnt; |
46 | int updateCnt; |
47 | int removeCnt; |
48 | }; |
49 | |
50 | |
51 | #endif // LRUCacheTest_INCLUDED |
52 | |