2015-04-27 23:09:29 +02:00
|
|
|
#pragma once
|
|
|
|
#ifndef BLOCKS_MESSMER_BLOCKSTORE_TEST_IMPLEMENTATIONS_CACHING_CACHE_TESTUTILS_QUEUEMAPTEST_H_
|
|
|
|
#define BLOCKS_MESSMER_BLOCKSTORE_TEST_IMPLEMENTATIONS_CACHING_CACHE_TESTUTILS_QUEUEMAPTEST_H_
|
|
|
|
|
|
|
|
#include <google/gtest/gtest.h>
|
2015-07-21 18:19:34 +02:00
|
|
|
#include <messmer/cpp-utils/pointer/unique_ref.h>
|
2015-04-27 23:09:29 +02:00
|
|
|
#include "../../../../../implementations/caching/cache/QueueMap.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 QueueMapTest: public ::testing::Test {
|
|
|
|
public:
|
|
|
|
QueueMapTest();
|
|
|
|
~QueueMapTest();
|
|
|
|
|
|
|
|
void push(int key, int value);
|
|
|
|
boost::optional<int> pop();
|
|
|
|
boost::optional<int> pop(int key);
|
|
|
|
boost::optional<int> peek();
|
|
|
|
int size();
|
|
|
|
|
|
|
|
private:
|
2015-07-21 18:19:34 +02:00
|
|
|
cpputils::unique_ref<blockstore::caching::QueueMap<MinimalKeyType, MinimalValueType>> _map;
|
2015-04-27 23:09:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|