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);
55 memory.
add(
sizeof(
int));
63 bool newly_computed =
false;
65 newly_computed =
true;
66 return std::make_unique<CachedInt>(4);
68 EXPECT_TRUE(newly_computed);
71 bool newly_computed =
false;
73 newly_computed =
true;
74 return std::make_unique<CachedInt>(4);
76 EXPECT_FALSE(newly_computed);
80 bool newly_computed =
false;
82 newly_computed =
true;
83 return std::make_unique<CachedInt>(4);
85 EXPECT_TRUE(newly_computed);
97 return dynamic_cast<const GenericIntKey *
>(&key)->value() == 1;
101 return std::make_unique<CachedInt>(10);
104 return std::make_unique<CachedInt>(10);
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
unsigned long long int uint64_t
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)
void remove_if(FunctionRef< bool(const GenericKey &)> predicate)
std::shared_ptr< const T > get(const GenericKey &key, FunctionRef< std::unique_ptr< T >()> compute_fn)
uint64_t get_default_hash(const T &v, const Args &...args)