aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/sorting/DistanceComparatorTest.java
blob: 0cfee49cce080897858a75bf9e905c841ac9ed09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package cgeo.geocaching.sorting;

import cgeo.geocaching.Geocache;
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<Geocache> caches = new ArrayList<Geocache>();
        for (int i = 0; i < 37; i++) {
            Geocache cache = new Geocache();
            if (i % 3 == 0) {
                cache.setCoords(new Geopoint(i, i));
            }
            caches.add(cache);
        }
        Collections.sort(caches, new DistanceComparator(Geopoint.ZERO, caches));
    }

}