libcryfs/test/blockstore/implementations/caching/cache/testutils/CacheTest.h

30 lines
1.0 KiB
C
Raw Normal View History

2015-04-28 11:56:07 +02:00
#pragma once
2015-10-15 13:09:21 +02:00
#ifndef MESSMER_BLOCKSTORE_TEST_IMPLEMENTATIONS_CACHING_CACHE_TESTUTILS_QUEUEMAPTEST_H_
#define MESSMER_BLOCKSTORE_TEST_IMPLEMENTATIONS_CACHING_CACHE_TESTUTILS_QUEUEMAPTEST_H_
2015-04-28 11:56:07 +02:00
#include <gtest/gtest.h>
#include "blockstore/implementations/caching/cache/Cache.h"
2015-04-28 11:56:07 +02:00
#include "MinimalKeyType.h"
#include "MinimalValueType.h"
#include <boost/optional.hpp>
// This class is a parent class for tests on QueueMap.
// It offers functions to work with a QueueMap test object which is built using types having only the minimal type requirements.
// Furthermore, the class checks that there are no memory leaks left after destructing the QueueMap (by counting leftover instances of Keys/Values).
class CacheTest: public ::testing::Test {
public:
2015-10-17 21:10:26 +02:00
CacheTest(): _cache() {}
2015-04-28 11:56:07 +02:00
void push(int key, int value);
boost::optional<int> pop(int key);
2015-10-08 18:05:09 +02:00
static constexpr unsigned int MAX_ENTRIES = 100;
using Cache = blockstore::caching::Cache<MinimalKeyType, MinimalValueType, MAX_ENTRIES>;
2015-04-28 11:56:07 +02:00
private:
Cache _cache;
};
#endif