aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/WaypointTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/cgeo/geocaching/WaypointTest.java')
-rw-r--r--tests/src/cgeo/geocaching/WaypointTest.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/WaypointTest.java b/tests/src/cgeo/geocaching/WaypointTest.java
new file mode 100644
index 0000000..273a3bf
--- /dev/null
+++ b/tests/src/cgeo/geocaching/WaypointTest.java
@@ -0,0 +1,41 @@
+package cgeo.geocaching;
+
+import cgeo.geocaching.enumerations.WaypointType;
+
+import android.test.AndroidTestCase;
+
+public class WaypointTest extends AndroidTestCase {
+
+ public static void testOrder() {
+ final Waypoint cache = new Waypoint("Final", WaypointType.FINAL, false);
+ final Waypoint trailhead = new Waypoint("Trail head", WaypointType.TRAILHEAD, false);
+ final Waypoint stage = new Waypoint("stage", WaypointType.STAGE, false);
+ final Waypoint puzzle = new Waypoint("puzzle", WaypointType.PUZZLE, false);
+ final Waypoint own = new Waypoint("own", WaypointType.OWN, true);
+ final Waypoint parking = new Waypoint("parking", WaypointType.PARKING, false);
+
+ assertTrue(trailhead.compareTo(puzzle) < 0);
+ assertTrue(trailhead.compareTo(stage) < 0);
+ assertTrue(trailhead.compareTo(cache) < 0);
+
+ assertTrue(stage.compareTo(cache) < 0);
+ assertTrue(puzzle.compareTo(cache) < 0);
+
+ assertTrue(trailhead.compareTo(own) < 0);
+ assertTrue(puzzle.compareTo(own) < 0);
+ assertTrue(stage.compareTo(own) < 0);
+ assertTrue(cache.compareTo(own) < 0);
+
+ assertTrue(parking.compareTo(puzzle) < 0);
+ assertTrue(parking.compareTo(stage) < 0);
+ assertTrue(parking.compareTo(cache) < 0);
+ assertTrue(parking.compareTo(own) < 0);
+ assertTrue(parking.compareTo(trailhead) < 0);
+ }
+
+ public static void testGeocode() {
+ Waypoint waypoint = new Waypoint("Test waypoint", WaypointType.PARKING, false);
+ waypoint.setGeocode("p1");
+ assertEquals("P1", waypoint.getGeocode());
+ }
+}