package voogasalad_can18_cw223;

import api.IEntity;
import api.ILevel;
import api.IPhysicsEngine;
import javafx.geometry.Point2D;
import model.component.movement.Position;
import model.component.movement.Velocity;
import model.component.physics.Mass;
import model.entity.Entity;
import model.entity.Level;
import model.physics.PhysicsEngine;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class VoogaTesting {

    @Test
    public void testMovement () {
        Position pos = new Position(0.0, 0.0);
        Velocity v = new Velocity(1.0, 1.0);
        IEntity e = new Entity();
        e.forceAddComponent(pos, true);
        e.forceAddComponent(v, true);
        IPhysicsEngine p = new PhysicsEngine();
        ILevel universe = new Level();
        universe.addEntity(e);
        p.update(universe, 2);
       // System.out.println(pos.getX() + " " + pos.getY());
        assertEquals(Math.abs(pos.getX() - 2.0) < 0.0001, true);
        assertEquals(Math.abs(pos.getY() - 2.0) < 0.0001, true);
    }

<<<<<<< HEAD
	@Test
	public void testImpulse() {
		Position pos = new Position(0.0, 0.0);
		Velocity v = new Velocity(1.0, 1.0);
		IEntity e = new Entity();
		e.forceAddComponent(new Mass(1), true);
		e.forceAddComponent(pos, true);
		e.forceAddComponent(v, true);
		IPhysicsEngine p = new PhysicsEngine(new RealisticVelocityCalculator());
		ILevel universe = new Level();
		universe.addEntity(e);
		p.applyImpulse(e, new Point2D(10, 20));
		System.out.println(v.getVX() + " " + v.getVY());
		assertEquals(Math.abs(v.getVX() - 11.0) < 0.0001, true);
		assertEquals(Math.abs(v.getVY() - 21.0) < 0.0001, true);
	}
=======
    @Test
    public void testImpulse () {
        Position pos = new Position(0.0, 0.0);
        Velocity v = new Velocity(1.0, 1.0);
        IEntity e = new Entity();
        e.forceAddComponent(new Mass(1), true);
        e.forceAddComponent(pos, true);
        e.forceAddComponent(v, true);
        IPhysicsEngine p = new PhysicsEngine();
        ILevel universe = new Level();
        universe.addEntity(e);
        //p.applyImpulse(e, new Vector(10, 20));
        System.out.println(v.getVX() + " " + v.getVY());
        assertEquals(Math.abs(v.getVX() - 11.0) < 0.0001, true);
        assertEquals(Math.abs(v.getVY() - 21.0) < 0.0001, true);
    }
>>>>>>> de3d6a453d1ef89127c3c55d5c38b2326bb361f7

}

@@ -1034,627 +1034,8 @@
  %7D%0A%0A
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A%09@Test%0A%09public void testImpulse() %7B%0A%09%09Position pos = new Position(0.0, 0.0);%0A%09%09Velocity v = new Velocity(1.0, 1.0);%0A%09%09IEntity e = new Entity();%0A%09%09e.forceAddComponent(new Mass(1), true);%0A%09%09e.forceAddComponent(pos, true);%0A%09%09e.forceAddComponent(v, true);%0A%09%09IPhysicsEngine p = new PhysicsEngine(new RealisticVelocityCalculator());%0A%09%09ILevel universe = new Level();%0A%09%09universe.addEntity(e);%0A%09%09p.applyImpulse(e, new Point2D(10, 20));%0A%09%09System.out.println(v.getVX() + %22 %22 + v.getVY());%0A%09%09assertEquals(Math.abs(v.getVX() - 11.0) %3C 0.0001, true);%0A%09%09assertEquals(Math.abs(v.getVY() - 21.0) %3C 0.0001, true);%0A%09%7D%0A=======
 %0A   
@@ -1689,57 +1689,8 @@
    %7D
-%0A%3E%3E%3E%3E%3E%3E%3E de3d6a453d1ef89127c3c55d5c38b2326bb361f7
 %0A%0A%7D%0A

Resolve merge conflict with VoogaTesting