diff options
author | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-05-08 16:02:02 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2015-05-19 11:58:37 +0200 |
commit | 6f5d23c55743bd98800148c943880ce00d04441a (patch) | |
tree | 8ef9f5115d47bfba8173b9834475bdf61c7efc10 /core/src/androidTest/java/de | |
parent | 406dab0a24543f4332b338f64689948cdc96c3bc (diff) | |
download | AntennaPod-6f5d23c55743bd98800148c943880ce00d04441a.zip |
Order feeds by number of unread items (descending)
Diffstat (limited to 'core/src/androidTest/java/de')
-rw-r--r-- | core/src/androidTest/java/de/danoeh/antennapod/core/util/LongLongMapTest.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/util/LongLongMapTest.java b/core/src/androidTest/java/de/danoeh/antennapod/core/util/LongLongMapTest.java new file mode 100644 index 000000000..d75cd5c77 --- /dev/null +++ b/core/src/androidTest/java/de/danoeh/antennapod/core/util/LongLongMapTest.java @@ -0,0 +1,59 @@ +package de.danoeh.antennapod.core.util; + +import android.test.AndroidTestCase; + +public class LongLongMapTest extends AndroidTestCase { + + public void testEmptyMap() { + LongIntMap map = new LongIntMap(); + assertEquals(0, map.size()); + assertEquals("LongLongMap{}", map.toString()); + assertEquals(0, map.get(42)); + assertEquals(-1, map.get(42, -1)); + assertEquals(false, map.delete(42)); + assertEquals(-1, map.indexOfKey(42)); + assertEquals(-1, map.indexOfValue(42)); + assertEquals(1, map.hashCode()); + } + + public void testSingleElement() { + LongIntMap map = new LongIntMap(); + map.put(17, 42); + assertEquals(1, map.size()); + assertEquals("LongLongMap{17=42}", map.toString()); + assertEquals(42, map.get(17)); + assertEquals(42, map.get(17, -1)); + assertEquals(0, map.indexOfKey(17)); + assertEquals(0, map.indexOfValue(42)); + assertEquals(true, map.delete(17)); + } + + public void testAddAndDelete() { + LongIntMap map = new LongIntMap(); + for(int i=0; i < 100; i++) { + map.put(i * 17, i * 42); + } + assertEquals(100, map.size()); + assertEquals(0, map.get(0)); + assertEquals(42, map.get(17)); + assertEquals(42, map.get(17, -1)); + assertEquals(1, map.indexOfKey(17)); + assertEquals(1, map.indexOfValue(42)); + for(int i=0; i < 100; i++) { + assertEquals(true, map.delete(i * 17)); + } + } + + public void testOverwrite() { + LongIntMap map = new LongIntMap(); + map.put(17, 42); + assertEquals(1, map.size()); + assertEquals("LongLongMap{17=42}", map.toString()); + assertEquals(42, map.get(17)); + map.put(17, 23); + assertEquals(1, map.size()); + assertEquals("LongLongMap{17=23}", map.toString()); + assertEquals(23, map.get(17)); + } + +} |