24 #include <gtest/gtest.h> 31 template<
typename K,
typename V,
typename MutexT = std::mutex>
33 const std::vector<K>& keys,
34 const std::vector<V>&
values) {
37 size_t cacheCapacity = 10;
39 CacheType cache(filename, cacheCapacity, std::chrono::seconds(150));
42 cache.put(keys[0], values[0]);
43 cache.put(keys[1], values[1]);
45 EXPECT_EQ(cache.get(keys[0]).value(), values[0]);
46 EXPECT_EQ(cache.get(keys[1]).value(), values[1]);
49 CacheType cache(filename, cacheCapacity, std::chrono::seconds(150));
51 EXPECT_EQ(cache.get(keys[0]).value(), values[0]);
52 EXPECT_EQ(cache.get(keys[1]).value(), values[1]);
56 EXPECT_EQ(cache.get(keys[0]).value(), values[0]);
60 CacheType cache(filename, cacheCapacity, std::chrono::seconds(150));
62 EXPECT_EQ(cache.get(keys[0]).value(), values[0]);
70 CacheType cache(filename, cacheCapacity, std::chrono::seconds(150));
#define EXPECT_EQ(val1, val2)
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)
std::string getPersistentCacheFilename()
void testSimplePutGet(const std::vector< K > &keys, const std::vector< V > &values)
std::vector< int > values(1'000)