Guest User

Untitled

a guest
May 9th, 2021
35
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package sim.ps;
  2.  
  3. import org.junit.*;
  4. import static org.junit.Assert.*;
  5.  
  6. import sim.util.Double2D;
  7.  
  8. import java.awt.*;
  9.  
  10. class AgentBottomLayerTest {
  11.  
  12. AgentBottomLayer agent1;
  13.  
  14. @Before
  15. public void setup() {
  16. System.out.println("in setup");
  17. // agent1 is moving
  18. Double2D vel1 = new Double2D(1,1);
  19. agent1 = new AgentBottomLayer(new Double2D(0,0),
  20. vel1,
  21. 5,
  22. Color.red);
  23. }
  24.  
  25. @Test
  26. public void testProjection1() {
  27. // when the vectors coincide
  28. double proj = agent1.calculateProjection(0);
  29. assertEquals(proj, Math.sqrt(2), 0.01);
  30. }
  31.  
  32. @Test
  33. public void testProjection2() {
  34. assertEquals(0, 0);
  35. }
  36.  
  37. }
RAW Paste Data