Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lezh1k committed Mar 19, 2018
1 parent 86d2cf9 commit 39a0bfb
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void set_isLogging(boolean isLogging) {
Utils.GEOHASH_DEFAULT_PREC,
Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
Utils.SENSOR_DEFAULT_FREQ_HZ,
this);
this, false);
value.reset(settings); //warning!! here you can adjust your filter behavior
value.start();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static class Settings {
private int geoHashMinPointCount;
private int sensorFfequencyHz;
private ILogger logger;
private boolean filterMockGpsCoordinates;


public Settings(double accelerationDeviation,
Expand All @@ -58,14 +59,16 @@ public Settings(double accelerationDeviation,
int geoHashPrecision,
int geoHashMinPointCount,
int sensorFfequencyHz,
ILogger logger) {
ILogger logger,
boolean filterMockGpsCoordinates) {
this.accelerationDeviation = accelerationDeviation;
this.gpsMinDistance = gpsMinDistance;
this.gpsMinTime = gpsMinTime;
this.geoHashPrecision = geoHashPrecision;
this.geoHashMinPointCount = geoHashMinPointCount;
this.sensorFfequencyHz = sensorFfequencyHz;
this.logger = logger;
this.filterMockGpsCoordinates = filterMockGpsCoordinates;
}
}

Expand All @@ -84,8 +87,12 @@ public Settings(double accelerationDeviation,
public static final int ServicePaused = 4;
protected int m_serviceStatus = ServiceStopped;

public boolean isSensorsEnabled() {
return m_sensorsEnabled;
}

public boolean IsRunning() {
return m_serviceStatus != ServiceStopped && m_serviceStatus != ServicePaused;
return m_serviceStatus != ServiceStopped && m_serviceStatus != ServicePaused && m_sensorsEnabled;
}

public void addInterface(LocationServiceInterface locationServiceInterface) {
Expand Down Expand Up @@ -164,7 +171,7 @@ public GeohashRTFilter getGeoHashRTFilter() {
Utils.GPS_MIN_DISTANCE, Utils.GPS_MIN_TIME,
Utils.GEOHASH_DEFAULT_PREC, Utils.GEOHASH_DEFAULT_MIN_POINT_COUNT,
Utils.SENSOR_DEFAULT_FREQ_HZ,
null);
null, true);

private Settings m_settings;
private LocationManager m_locationManager;
Expand Down Expand Up @@ -511,7 +518,7 @@ public void onAccuracyChanged(Sensor sensor, int accuracy) {
public void onLocationChanged(Location loc) {

if (loc == null) return;
// if (loc.isFromMockProvider()) return;
if (m_settings.filterMockGpsCoordinates && loc.isFromMockProvider()) return;

double x, y, xVel, yVel, posDev, course, speed;
long timeStamp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.example.gpsacckalmanfusion;

import com.example.gpsacckalmanfusion.Lib.Commons.Coordinates;
import com.example.gpsacckalmanfusion.Lib.Commons.GeoPoint;

import org.junit.Test;

import static junit.framework.Assert.assertTrue;
Expand Down Expand Up @@ -36,7 +39,7 @@ public void MetersToGeoPointTest() throws Exception {

@Test
public void MetersBetween2PointsTest() throws Exception {
double distance = Coordinates.geoDistanceMeters(42.312000, 74.819000, 42.312001, 74.819000);
double distance = Coordinates.distanceBetween(42.312000, 74.819000, 42.312001, 74.819000);
assertTrue(distance < 0.1);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.example.gpsacckalmanfusion;

import com.example.gpsacckalmanfusion.Lib.SensorAux.DeviationCalculator;

import org.junit.Test;

import java.util.Random;

import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.assertEquals;

/**
* Created by lezh1k on 2/13/18.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.example.gpsacckalmanfusion;

import com.example.gpsacckalmanfusion.Lib.Commons.GeoPoint;
import com.example.gpsacckalmanfusion.Lib.Filters.GeoHash;

import org.junit.Test;

import java.util.Arrays;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.assertEquals;

/**
* Created by lezh1k on 2/13/18.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.example.gpsacckalmanfusion;

import com.example.gpsacckalmanfusion.Lib.Commons.Matrix;

import org.junit.Test;

import java.util.Random;

import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.assertEquals;

/**
* Created by lezh1k on 2/13/18.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.example.gpsacckalmanfusion;

import com.example.gpsacckalmanfusion.Lib.Commons.SensorGpsDataItem;

import org.junit.Test;

import java.util.Queue;
import java.util.concurrent.PriorityBlockingQueue;

import static org.junit.Assert.assertTrue;
import static junit.framework.Assert.assertEquals;

/**
* Created by lezh1k on 2/13/18.
Expand Down

0 comments on commit 39a0bfb

Please sign in to comment.