Changeset 9727 in josm for trunk/test


Ignore:
Timestamp:
2016-02-03T21:07:14+01:00 (6 years ago)
Author:
simon04
Message:

Add further CorrelateGpxWithImages unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java

    r9726 r9727  
    44import static org.junit.Assert.assertEquals;
    55
     6import java.text.ParseException;
    67import java.util.Arrays;
    78import java.util.Collections;
     
    7475        assertEquals(Pair.create(0.0, -4L), CorrelateGpxWithImages.autoGuess(Collections.singletonList(i0), gpx));
    7576    }
     77
     78    @Test
     79    public void testFormatTimezone() throws Exception {
     80        assertEquals("+1:00", CorrelateGpxWithImages.formatTimezone(1));
     81        assertEquals("+6:30", CorrelateGpxWithImages.formatTimezone(6.5));
     82        assertEquals("-6:30", CorrelateGpxWithImages.formatTimezone(-6.5));
     83        assertEquals("+3:08", CorrelateGpxWithImages.formatTimezone(Math.PI));
     84        assertEquals("+2:43", CorrelateGpxWithImages.formatTimezone(Math.E));
     85    }
     86
     87    @Test
     88    public void testParseTimezone() throws ParseException {
     89        assertEquals(1, CorrelateGpxWithImages.parseTimezone("+01:00"), 1e-3);
     90        assertEquals(1, CorrelateGpxWithImages.parseTimezone("+1:00"), 1e-3);
     91        assertEquals(1.5, CorrelateGpxWithImages.parseTimezone("+01:30"), 1e-3);
     92        assertEquals(11.5, CorrelateGpxWithImages.parseTimezone("+11:30"), 1e-3);
     93    }
     94
     95    @Test
     96    public void testParseOffest() throws ParseException {
     97        assertEquals(0, CorrelateGpxWithImages.parseOffset("0"));
     98        assertEquals(4242L, CorrelateGpxWithImages.parseOffset("4242"));
     99        assertEquals(-4242L, CorrelateGpxWithImages.parseOffset("-4242"));
     100        assertEquals(0L, CorrelateGpxWithImages.parseOffset("-0"));
     101    }
    76102}
Note: See TracChangeset for help on using the changeset viewer.