forked from rallat/ImageLoader
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lasse Magnussen
committed
Feb 14, 2013
1 parent
e4adbac
commit 95f956b
Showing
2 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
core/src/test/java/com/novoda/imageloader/core/cache/LruBitmapCacheTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.novoda.imageloader.core.cache; | ||
|
||
import org.junit.Test; | ||
|
||
import static junit.framework.TestCase.assertEquals; | ||
import static junit.framework.TestCase.assertTrue; | ||
|
||
public class LruBitmapCacheTest { | ||
|
||
@Test | ||
public void verifyCalculateCacheSizeDoesNotIntOverflow() { | ||
LruBitmapCache cache = new LruBitmapCacheTestOverride(); | ||
|
||
long undividedResult = 200L * 25L * 1024L * 1024L; | ||
assertTrue(undividedResult > Integer.MAX_VALUE); | ||
|
||
long dividedResult = undividedResult / 100L; | ||
assertTrue(dividedResult < Integer.MAX_VALUE); | ||
|
||
long calculatedResult = cache.calculateCacheSize(200, 25); | ||
assertEquals(dividedResult, calculatedResult); | ||
} | ||
|
||
private class LruBitmapCacheTestOverride extends LruBitmapCache { | ||
|
||
} | ||
} |