diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-01-07 22:04:40 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-01-07 22:04:40 +0100 |
| commit | a7ae68135ecc1c787dd32c82b002060000ba1de5 (patch) | |
| tree | 774471a1e3abcbe781234ae19d4cf229750ed216 /tests | |
| parent | a8b1f92137bbcdf0352fa98910de5afe6c8a6ddb (diff) | |
| download | cgeo-a7ae68135ecc1c787dd32c82b002060000ba1de5.zip cgeo-a7ae68135ecc1c787dd32c82b002060000ba1de5.tar.gz cgeo-a7ae68135ecc1c787dd32c82b002060000ba1de5.tar.bz2 | |
unit test for #946, this may break the build until merging the fix
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java b/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java new file mode 100644 index 0000000..91896a5 --- /dev/null +++ b/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java @@ -0,0 +1,26 @@ +package cgeo.geocaching.sorting; + +import cgeo.geocaching.cgCache; +import cgeo.geocaching.geopoint.Geopoint; + +import android.test.AndroidTestCase; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class DistanceComparatorTest extends AndroidTestCase { + + public static void testCompareCaches() { + final List<cgCache> caches = new ArrayList<cgCache>(); + for (int i = 0; i < 37; i++) { + cgCache cache = new cgCache(); + if (i % 3 == 0) { + cache.setCoords(new Geopoint(i, i)); + } + caches.add(cache); + } + Collections.sort(caches, new DistanceComparator(new Geopoint(0, 0), caches)); + } + +} |
