forked from upstream-mirrors/OpenTracks
Merge heads
This commit is contained in:
+4
-3
@@ -2,6 +2,7 @@
|
||||
|
||||
package com.google.android.apps.mytracks.stats;
|
||||
|
||||
import com.google.android.apps.mytracks.util.CalorieUtils.ActivityType;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
|
||||
import android.location.Location;
|
||||
@@ -224,7 +225,7 @@ public class TripStatisticsUpdaterTest extends TestCase {
|
||||
Location location = getLocation(i + locationOffset, (i + locationOffset) * .001, MOVING_SPEED,
|
||||
startTime + (timeOffset + i) * TEN_SECONDS);
|
||||
tripStatisticsUpdater.addLocation(location,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT, ActivityType.FOOT,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
||||
tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||
|
||||
@@ -271,7 +272,7 @@ public class TripStatisticsUpdaterTest extends TestCase {
|
||||
Location location = getLocation(
|
||||
locationOffset, locationOffset * .001, 0, startTime + (i + timeOffset) * TEN_SECONDS);
|
||||
tripStatisticsUpdater.addLocation(location,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT, ActivityType.FOOT,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
||||
|
||||
tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||
@@ -309,7 +310,7 @@ public class TripStatisticsUpdaterTest extends TestCase {
|
||||
Location location = getLocation(i + locationOffset, (i + locationOffset) * .001, 99999,
|
||||
startTime + (timeOffset + i) * TEN_SECONDS);
|
||||
tripStatisticsUpdater.addLocation(location,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT, ActivityType.FOOT,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
||||
tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ public class CalorieUtilsTest extends TestCase {
|
||||
|
||||
Location start = new Location(LocationManager.GPS_PROVIDER);
|
||||
Location stop = new Location(LocationManager.GPS_PROVIDER);
|
||||
private double grade = 10.0;
|
||||
private int weight = 20;
|
||||
private double grade = 0.07;
|
||||
private int weight = 80;
|
||||
private final long TIME_INTERVAL = 1000l;
|
||||
|
||||
@Override
|
||||
@@ -94,4 +94,16 @@ public class CalorieUtilsTest extends TestCase {
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Checks calculating cycling calorie.
|
||||
*/
|
||||
public void testCalculateCalorieCycling() {
|
||||
grade = 0;
|
||||
weight = 90;
|
||||
start.setSpeed(9);
|
||||
stop.setSpeed(9);
|
||||
double expected = 175 / 1000 / UnitConversions.KCAL_TO_J;
|
||||
double actual = CalorieUtils.calculateCalorieCycling(start, stop, grade, weight);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user