FreeListManager { boolean isSmallEnough(long size) { return size <= Integer.MAX_VALUE; } FreeListManager(MemoryAllocatorImpl ma, final Slab[] slabs); long getUsedMemory(); long getFreeMemory(); @SuppressWarnings("synthetic-access") OffHeapStoredObject allocate(int size); @SuppressWarnings("synthetic-access") void free(long addr); static final int TINY_MULTIPLE; static final int TINY_FREE_LIST_COUNT; static final int HUGE_MULTIPLE; static final int MAX_TINY; }
@Test public void isSmallEnoughBoundaryConditions() { SlabImpl chunk = new SlabImpl(10); this.freeListManager = createFreeListManager(ma, new Slab[] {chunk}); assertThat(this.freeListManager.isSmallEnough(Integer.MAX_VALUE)); assertThat(this.freeListManager.isSmallEnough(Integer.MAX_VALUE - 1)); assertThat(!this.freeListManager.isSmallEnough(Integer.MAX_VALUE + 1L)); assertThat(!this.freeListManager.isSmallEnough(Long.MAX_VALUE)); }