aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/cgeo/geocaching/geopoint
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-02-21 08:03:28 +0100
committerBananeweizen <bananeweizen@gmx.de>2012-02-21 08:03:28 +0100
commit61b3c7758e4602495c8f356a832a10b2a4e59a2d (patch)
tree6a5cab003328eb2c01aa887233de171a652a3186 /tests/src/cgeo/geocaching/geopoint
parentcfbf1b6507cf62382ccf71b04232fd6be963701c (diff)
downloadcgeo-61b3c7758e4602495c8f356a832a10b2a4e59a2d.zip
cgeo-61b3c7758e4602495c8f356a832a10b2a4e59a2d.tar.gz
cgeo-61b3c7758e4602495c8f356a832a10b2a4e59a2d.tar.bz2
refactoring: code cleanup
* move human distance code to own class * remove warning suppression * fix several compiler warnings
Diffstat (limited to 'tests/src/cgeo/geocaching/geopoint')
-rw-r--r--tests/src/cgeo/geocaching/geopoint/HumanDistanceTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/src/cgeo/geocaching/geopoint/HumanDistanceTest.java b/tests/src/cgeo/geocaching/geopoint/HumanDistanceTest.java
new file mode 100644
index 0000000..3c7cb98
--- /dev/null
+++ b/tests/src/cgeo/geocaching/geopoint/HumanDistanceTest.java
@@ -0,0 +1,19 @@
+package cgeo.geocaching.geopoint;
+
+import cgeo.geocaching.Settings;
+
+import android.test.AndroidTestCase;
+
+public class HumanDistanceTest extends AndroidTestCase {
+
+ public static void testHumanDistance() {
+ assertEquals("?", HumanDistance.getHumanDistance(null));
+ if (Settings.isUseMetricUnits()) {
+ assertEquals("123 km", HumanDistance.getHumanDistance(123.456f));
+ assertEquals("123 m", HumanDistance.getHumanDistance(0.123456f));
+ }
+ else {
+ assertEquals("77 mi", HumanDistance.getHumanDistance(123.456f));
+ }
+ }
+}