Skip to content

Commit 85be2b4

Browse files
committed
test: modify tests to check negative numbers
1 parent 01438a6 commit 85be2b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

others/lfu_cache.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@ void test1() {
250250
assert(cache.capacity() == 5);
251251
assert(cache.empty());
252252
cache.put(1, 10);
253-
cache.put(2, 20);
253+
cache.put(-2, 20);
254254

255255
assert(cache.size() == 2);
256256
assert(cache.capacity() == 5);
257257
assert(!cache.empty());
258258

259-
cache.put(3, 30);
259+
cache.put(3, -30);
260260
cache.put(4, 40);
261261
cache.put(5, 50);
262262
cache.put(6, 60);
@@ -274,11 +274,11 @@ void test1() {
274274
*/
275275
void test2() {
276276
others::Cache::LFUCache<int, int> cache(5);
277-
cache.put(1, 10);
277+
cache.put(-1, -10);
278278
cache.put(2, 20);
279279
cache.put(3, 30);
280280

281-
assert(cache.get(1) == 10);
281+
assert(cache.get(-1) == -10);
282282
cache.get(2);
283283
cache.get(3);
284284

0 commit comments

Comments
 (0)