You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
58 lines
1.6 KiB
package seng302.Model;
|
|
|
|
import org.junit.Test;
|
|
import seng302.GPSCoordinate;
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
/**
|
|
* Created by esa46 on 29/03/17.
|
|
*/
|
|
public class MarkerTest {
|
|
|
|
GPSCoordinate ORIGIN_COORD = new GPSCoordinate(0, 0);
|
|
|
|
@Test
|
|
public void averageOfSingleMarkAtOriginIsSingleMark() {
|
|
|
|
Marker testMark = new Marker(ORIGIN_COORD);
|
|
assertTrue(testMark.getAverageGPSCoordinate().equals(ORIGIN_COORD));
|
|
|
|
}
|
|
|
|
@Test
|
|
public void averageOfSingleMarkIsSingleMark() {
|
|
|
|
GPSCoordinate testCoord = new GPSCoordinate(20, 25);
|
|
Marker testMark = new Marker(testCoord);
|
|
assertTrue(testMark.getAverageGPSCoordinate().equals(testCoord));
|
|
|
|
}
|
|
|
|
@Test
|
|
public void averageLatOfTwoMarksIsAccurate() {
|
|
|
|
GPSCoordinate testCoord = new GPSCoordinate(10, 0);
|
|
Marker testMark = new Marker(ORIGIN_COORD, testCoord);
|
|
assertTrue(testMark.getAverageGPSCoordinate().equals(new GPSCoordinate(5, 0)));
|
|
}
|
|
|
|
@Test
|
|
public void averageLongOfTwoMarksIsAccurate() {
|
|
|
|
GPSCoordinate testCoord = new GPSCoordinate(0, 10);
|
|
Marker testMark = new Marker(ORIGIN_COORD, testCoord);
|
|
assertTrue(testMark.getAverageGPSCoordinate().equals(new GPSCoordinate(0, 5)));
|
|
}
|
|
|
|
@Test
|
|
public void averageLatAndLongOfTwoMarksIsAccurate() {
|
|
|
|
GPSCoordinate testCoord1 = new GPSCoordinate(10, 30);
|
|
GPSCoordinate testCoord2 = new GPSCoordinate(30, 60);
|
|
Marker testMark = new Marker(testCoord1, testCoord2);
|
|
assertTrue(testMark.getAverageGPSCoordinate().equals(new GPSCoordinate(020.644102, 44.014817)));
|
|
}
|
|
|
|
}
|