/** @param cnt Count. */ private void checkPoll(int cnt) { init(); int step = 10; assert cnt % step == 0; Collection<Long> set = new HashSet<>(step); for (int i = 0; i < cnt; i++) lru.offer(0, i, i); assertEquals(cnt, lru.size()); for (int i = 0; i < cnt; i += step) { for (int j = 0; j < step; j++) { long qAddr = lru.prePoll(); assertTrue(qAddr != 0); assertTrue(set.add(qAddr)); } for (long qAddr : set) lru.poll(qAddr); set.clear(); } assertEquals(0, lru.size()); }
/** @param cnt Count. */ private void checkOffer(int cnt) { init(); for (int i = 0; i < cnt; i++) lru.offer(0, i, i); assertEquals(cnt, lru.size()); info("Finished check offer for stripes count: " + stripes); }
/** @param cnt Count. */ private void checkRemove(int cnt) { init(); Collection<Long> set = new HashSet<>(cnt); for (int i = 0; i < cnt; i++) assertTrue(set.add(lru.offer(0, i, i))); assertEquals(cnt, lru.size()); for (long addr : set) lru.remove(addr); assertEquals(0, lru.size()); }