9#include "testing/testing.h"
29 if (
const auto *other_typed =
dynamic_cast<const GenericIntKey *
>(&other)) {
30 return other_typed->value_ == value_;
37 return std::make_unique<GenericIntKey>(*
this);
45 CachedInt(
int initial_value) : value(initial_value) {}
49 memory.
add(
sizeof(
int));
57 bool newly_computed =
false;
59 newly_computed =
true;
60 return std::make_unique<CachedInt>(4);
62 EXPECT_TRUE(newly_computed);
65 bool newly_computed =
false;
67 newly_computed =
true;
68 return std::make_unique<CachedInt>(4);
70 EXPECT_FALSE(newly_computed);
74 bool newly_computed =
false;
76 newly_computed =
true;
77 return std::make_unique<CachedInt>(4);
79 EXPECT_TRUE(newly_computed);
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
void count_memory(MemoryCounter &memory) const override
CachedInt(int initial_value)
uint64_t hash() const override
bool equal_to(const GenericKey &other) const override
std::unique_ptr< GenericKey > to_storable() const override
void add(const int64_t bytes)
TEST(memory_cache, Simple)
std::shared_ptr< const T > get(const GenericKey &key, FunctionRef< std::unique_ptr< T >()> compute_fn)
uint64_t get_default_hash(const T &v)
unsigned __int64 uint64_t