package cgeo.geocaching.test;

import cgeo.geocaching.geopoint.GeopointParser;
import junit.framework.Assert;
import android.test.AndroidTestCase;

public class GeoPointParserTest extends AndroidTestCase {

    public void testParseLatitude() throws Throwable {
    	
    	Assert.assertEquals(49.0 + 56.031 / 60.0, GeopointParser.parseLatitude("N 49° 56.031"));
    }

    public void testParseLongitude() throws Throwable {
    	
    	Assert.assertEquals(8.0 + 38.564 / 60.0, GeopointParser.parseLongitude("E 8° 38.564"));
    }
}

@@ -26,16 +26,59 @@
 est;%0D%0A%0D%0A
+import cgeo.geocaching.geopoint.Geopoint;%0D%0A
 import c
@@ -247,28 +247,159 @@
 stCase %7B%0D%0A%0D%0A
-    
+%09private static final double refLongitude = 8.0 + 38.564 / 60.0;%0D%0A%09private static final double refLatitude = 49.0 + 56.031 / 60.0;%0D%0A%0D%0A%09
 public void 
@@ -434,35 +434,27 @@
 hrowable %7B%0D%0A
-    %09%0D%0A    
+%0D%0A%09
 %09Assert.asse
@@ -462,36 +462,27 @@
 tEquals(
-49.0 + 56.031 / 60.0
+refLatitude
 , Geopoi
@@ -523,25 +523,25 @@
 31%22)
-);%0D%0A    
+, 1e-8);%0D%0A%09
 %7D%0D%0A%0D%0A
-    
+%09
 publ
@@ -593,59 +593,549 @@
  %7B%0D%0A
-    %09%0D%0A    %09Assert.assertEquals(8.0 + 38.564 / 60.0
+%0D%0A%09%09Assert.assertEquals(refLongitude, GeopointParser.parseLongitude(%22E 8%C2%B0 38.564%22), 1e-8);%0D%0A%09%7D%0D%0A%0D%0A%09public void testFullCoordinates() throws Throwable %7B%0D%0A%09%09final Geopoint goal = new Geopoint(refLatitude, refLongitude);%0D%0A%09%09Assert.assertTrue(goal.isEqualTo(GeopointParser.parse(%22N 49%C2%B0 56.031 %7C E 8%C2%B0 38.564%22), 1e-6));%0D%0A%09%7D%0D%0A%0D%0A%09public void testSouth() throws Throwable %7B%0D%0A%09%09Assert.assertEquals(-refLatitude, GeopointParser.parseLatitude(%22S 49%C2%B0 56.031%22), 1e-8);%0D%0A%09%7D%0D%0A%0D%0A%09public void testWest() throws Throwable %7B%0D%0A%09%09Assert.assertEquals(-refLongitude
 , Ge
@@ -1155,33 +1155,33 @@
 parseLongitude(%22
-E
+W
  8%C2%B0 38.564%22));%0D%0A
@@ -1180,16 +1180,164 @@
 64%22)
-);%0D%0A    
+, 1e-8);%0D%0A%09%7D%0D%0A%0D%0A%09public void testLowerCase() throws Throwable %7B%0D%0A%09%09Assert.assertEquals(refLongitude, GeopointParser.parseLongitude(%22e 8%C2%B0 38.564%22), 1e-8);%0D%0A%09
 %7D%0D%0A%7D

Add more tests for GeopointParser