Ignore:
Timestamp:
2014-05-06T01:24:41+02:00 (10 years ago)
Author:
Don-vip
Message:

test cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java

    r4573 r7068  
     1// License: GPL. For details, see LICENSE file.
    12package org.openstreetmap.josm.data.osm;
     3
     4import static org.junit.Assert.assertTrue;
    25
    36import org.junit.Test;
     
    58import org.openstreetmap.josm.data.coor.LatLonTest;
    69
    7 import static org.junit.Assert.assertTrue;
     10public class RoundingPerformanceTest {
    811
    9 public class RoundingPerformanceTest extends LatLonTest {
    10    
    1112    private static double oldRoundToOsmPrecision(double value) {
    1213        return Math.round(value / LatLon.MAX_SERVER_PRECISION) * LatLon.MAX_SERVER_PRECISION; // Old method, causes rounding errors, but efficient
     
    1819        long start = System.nanoTime();
    1920        for (int i = 0; i < n; i++) {
    20             for (double value : sampleValues) {
     21            for (double value : LatLonTest.SAMPLE_VALUES) {
    2122                oldRoundToOsmPrecision(value);
    2223            }
     
    2526        long oldTime = end-start;
    2627        System.out.println("Old time: "+oldTime/1000000.0 + " ms");
    27        
     28
    2829        start = System.nanoTime();
    2930        for (int i = 0; i < n; i++) {
    30             for (double value : sampleValues) {
     31            for (double value : LatLonTest.SAMPLE_VALUES) {
    3132                LatLon.roundToOsmPrecision(value);
    3233            }
     
    3536        long newTime = end-start;
    3637        System.out.println("New time: "+newTime/1000000.0 + " ms");
    37        
     38
    3839        assertTrue(newTime <= oldTime*10);
    3940    }
Note: See TracChangeset for help on using the changeset viewer.