import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

public class Aufgabe1Test {

    @Test
    public void testEP2() {
        // create two bodies
        Body sun = new Body(SolSystem.SUN);
        Body earth = new Body(SolSystem.EARTH);

        assertEquals(1.4850000175024106E11, earth.distanceTo(sun));
        assertEquals(1.4850000175024106E11, sun.distanceTo(earth));

        for (int i = 0; i < 3600 * 24; i++) {
            Vector3 f1 = earth.gravitationalForce(sun);
            Vector3 f2 = sun.gravitationalForce(earth);

            earth.move(f1);
            sun.move(f2);
        }

        // a dummy body to check the correct position after 24h of movement
        Body targetPositionEarth = new Body(1, new Vector3(-1.403250141841815E11, 4.859202658875631E10, 0.0), new Vector3(0, 0, 0));

        // check distance to target position (should be zero)
        assertEquals(0, earth.distanceTo(targetPositionEarth));
    }
}
