forked from upstream-mirrors/OpenTracks
merge heads
This commit is contained in:
+9
-6
@@ -223,8 +223,9 @@ public class TripStatisticsUpdaterTest extends TestCase {
|
||||
// Each time slice is 10 seconds.
|
||||
Location location = getLocation(i + locationOffset, (i + locationOffset) * .001, MOVING_SPEED,
|
||||
startTime + (timeOffset + i) * TEN_SECONDS);
|
||||
tripStatisticsUpdater.addLocation(
|
||||
location, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT);
|
||||
tripStatisticsUpdater.addLocation(location,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
||||
tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||
|
||||
assertEquals((timeOffset + i) * TEN_SECONDS, tripStatistics.getTotalTime());
|
||||
@@ -269,8 +270,9 @@ public class TripStatisticsUpdaterTest extends TestCase {
|
||||
for (int i = 0; i < points; i++) {
|
||||
Location location = getLocation(
|
||||
locationOffset, locationOffset * .001, 0, startTime + (i + timeOffset) * TEN_SECONDS);
|
||||
tripStatisticsUpdater.addLocation(
|
||||
location, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT);
|
||||
tripStatisticsUpdater.addLocation(location,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
||||
|
||||
tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||
assertEquals((i + timeOffset) * TEN_SECONDS, tripStatistics.getTotalTime());
|
||||
@@ -306,8 +308,9 @@ public class TripStatisticsUpdaterTest extends TestCase {
|
||||
// 99999 means a speed should bigger than given speed.
|
||||
Location location = getLocation(i + locationOffset, (i + locationOffset) * .001, 99999,
|
||||
startTime + (timeOffset + i) * TEN_SECONDS);
|
||||
tripStatisticsUpdater.addLocation(
|
||||
location, PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT);
|
||||
tripStatisticsUpdater.addLocation(location,
|
||||
PreferencesUtils.RECORDING_DISTANCE_INTERVAL_DEFAULT,
|
||||
PreferencesUtils.STATS_WEIGHT_DEFAULT);
|
||||
tripStatistics = tripStatisticsUpdater.getTripStatistics();
|
||||
|
||||
assertTrue(tripStatistics.getMovingTime() <= tripStatistics.getTotalTime());
|
||||
|
||||
@@ -44,9 +44,9 @@ public class CalorieUtilsTest extends TestCase {
|
||||
* Checks using foot calculation equation.
|
||||
*/
|
||||
public void testGetCalories_foot() {
|
||||
double actual = CalorieUtils.getCalories(start, stop, grade, weight,
|
||||
double actual = CalorieUtils.getCalorie(start, stop, grade, weight,
|
||||
CalorieUtils.ActivityType.FOOT);
|
||||
double expected = CalorieUtils.calculateExpenditureFoot(start, stop, grade, weight);
|
||||
double expected = CalorieUtils.calculateCalorieFoot(start, stop, grade, weight);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ public class CalorieUtilsTest extends TestCase {
|
||||
public void testGetCalories_footNegativeGrade() {
|
||||
double actualGrade = -5;
|
||||
double expectGrade = 0;
|
||||
double actual = CalorieUtils.getCalories(start, stop, actualGrade, weight,
|
||||
double actual = CalorieUtils.getCalorie(start, stop, actualGrade, weight,
|
||||
CalorieUtils.ActivityType.FOOT);
|
||||
double expected = CalorieUtils.calculateExpenditureFoot(start, stop, expectGrade, weight);
|
||||
double expected = CalorieUtils.calculateCalorieFoot(start, stop, expectGrade, weight);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ public class CalorieUtilsTest extends TestCase {
|
||||
* Checks using cycling calculation equation.
|
||||
*/
|
||||
public void testGetCalories_cycling() {
|
||||
double actual = CalorieUtils.getCalories(start, stop, grade, weight,
|
||||
double actual = CalorieUtils.getCalorie(start, stop, grade, weight,
|
||||
CalorieUtils.ActivityType.CYCLING);
|
||||
double expected = CalorieUtils.calculateExpenditureCycling(start, stop, grade, weight);
|
||||
double expected = CalorieUtils.calculateCalorieCycling(start, stop, grade, weight);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ public class CalorieUtilsTest extends TestCase {
|
||||
* Checks using running VO2 equation.
|
||||
*/
|
||||
public void testGetVO2_running() {
|
||||
double actual = CalorieUtils.getVo2(CalorieUtils.CRTICAL_SPEED_RUNNING * 2, grade);
|
||||
double expected = CalorieUtils.calculateRunningVo2(CalorieUtils.CRTICAL_SPEED_RUNNING * 2,
|
||||
double actual = CalorieUtils.getFootVo2(CalorieUtils.CRTICAL_SPEED_RUNNING * 2, grade);
|
||||
double expected = CalorieUtils.getHighSpeedFootVo2(CalorieUtils.CRTICAL_SPEED_RUNNING * 2,
|
||||
grade);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
@@ -89,8 +89,8 @@ public class CalorieUtilsTest extends TestCase {
|
||||
// Test at half the critical speed
|
||||
double footSpeed = CalorieUtils.CRTICAL_SPEED_RUNNING / 2.0;
|
||||
|
||||
double actual = CalorieUtils.getVo2(footSpeed, grade);
|
||||
double expected = CalorieUtils.calculateWalkingVo2(footSpeed, grade);
|
||||
double actual = CalorieUtils.getFootVo2(footSpeed, grade);
|
||||
double expected = CalorieUtils.getLowSpeedFootVo2(footSpeed, grade);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user