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 {

    private final 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)));
    }

}
