We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d347cd commit 960b849Copy full SHA for 960b849
others/lru_cache2.cpp
@@ -247,12 +247,17 @@ static void test() {
247
assert(cache.capacity() == 5);
248
assert(!cache.empty());
249
250
- // test retrieval of all items in the cache
251
// fetching 1 throws runtime_error
252
// as 1 was evicted being the least recently used
253
// when 6 was added
254
- // assert(cache.get(1) == 10);
+ try {
+ cache.get(1);
255
+ assert(false);
256
+ } catch (const std::runtime_error &e) {
257
+ std::cout << "Expected - std::runtime_error\n";
258
+ }
259
260
+ // test retrieval of all items in the cache
261
assert(cache.get(-2) == 20);
262
assert(cache.get(-3) == -30);
263
assert(cache.get(4) == 40);
0 commit comments