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

28 lines
1009 B
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 <google/gtest/gtest.h>
#include "../../../../../implementations/caching/cache/Cache.h"
#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:
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