Fix MILES.toKilometers() and KILOMETERS.toMiles()
This mistake should have been caught by DistanceUnitTests. But the problem is that the tests in this file does not run during the execution of the test suite, and I don't have a clue why this is so.
This commit is contained in:
parent
2d15cd8009
commit
9b206146e3
|
@ -35,7 +35,7 @@ public enum DistanceUnit {
|
||||||
}@Override public double toMiles(double distance) {
|
}@Override public double toMiles(double distance) {
|
||||||
return distance;
|
return distance;
|
||||||
}@Override public double toKilometers(double distance) {
|
}@Override public double toKilometers(double distance) {
|
||||||
return distance / MILES_KILOMETRES_RATIO;
|
return distance * MILES_KILOMETRES_RATIO;
|
||||||
}
|
}
|
||||||
@Override public String toString(double distance) {
|
@Override public String toString(double distance) {
|
||||||
return distance + "mi";
|
return distance + "mi";
|
||||||
|
@ -44,7 +44,7 @@ public enum DistanceUnit {
|
||||||
@Override public String toString() {
|
@Override public String toString() {
|
||||||
return "km";
|
return "km";
|
||||||
}@Override public double toMiles(double distance) {
|
}@Override public double toMiles(double distance) {
|
||||||
return distance * MILES_KILOMETRES_RATIO;
|
return distance / MILES_KILOMETRES_RATIO;
|
||||||
}@Override public double toKilometers(double distance) {
|
}@Override public double toKilometers(double distance) {
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue