Skip to content

Commit

Permalink
Merge pull request #101 from group22DKE/drag__test_physics3d_impl
Browse files Browse the repository at this point in the history
drag tests completed
  • Loading branch information
S010MON authored Jun 18, 2021
2 parents 8a14904 + 3b5b99c commit 0b05db5
Showing 1 changed file with 55 additions and 4 deletions.
59 changes: 55 additions & 4 deletions app/src/test/java/src/test/TestLandingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,72 @@ void testOnlyLanderFall()
// TODO (Jerome) 4hrs
}

@Test void testDrag()
/**
* Tests drag for positive velocity
* Expected to return a positive drag
* Values used for calculations:
* - area = 1.91
* - drag coefficient = 2.1
* - density = 5.428
*/
@Test void testDragPositiveV()
{
// TODO (Sam) 2hrs
LandingController controller = new LandingController();
Vector3d velocity = new Vector3d(5,10,0);
Vector3d drag = controller.calculateDrag(velocity);
Vector3d expectedDrag = new Vector3d(272.15,1088.5854,0);
assertEquals(expectedDrag.getX(),drag.getX());
assertEquals(expectedDrag.getY(),drag.getY());
assertEquals(expectedDrag.getZ(),drag.getZ());
}

/**
* Tests drag for negative velocity
* Expected to return a positive drag
* Values used for calculations:
* - area = 1.91
* - drag coefficient = 2.1
* - density = 5.428
*/
@Test void testDragNegativeV()
{
LandingController controller = new LandingController();
Vector3d velocity = new Vector3d(-5,-10,0);
Vector3d drag = controller.calculateDrag(velocity);
Vector3d expectedDrag = new Vector3d(272.15,1088.5854,0);
assertEquals(expectedDrag.getX(),drag.getX());
assertEquals(expectedDrag.getY(),drag.getY());
assertEquals(expectedDrag.getZ(),drag.getZ());
}

/**
* Tests drag for zero velocity
* Expected to return a positive drag
* Values used for calculations:
* - area = 1.91
* - drag coefficient = 2.1
* - density = 5.428
*/
@Test void testDragZeroV()
{
LandingController controller = new LandingController();
Vector3d velocity = new Vector3d(0,0,0);
Vector3d drag = controller.calculateDrag(velocity);
Vector3d expectedDrag = new Vector3d(0,0,0);
assertEquals(expectedDrag.getX(),drag.getX());
assertEquals(expectedDrag.getY(),drag.getY());
assertEquals(expectedDrag.getZ(),drag.getZ());
}


@Test void testNormaliseOneNegativeOnePosiive()
{
// TODO (Alp) 1hr
LandingController control = new LandingController();
assertEquals(control.normalise(new Vector3d(4,4,4),new Vector3d(-1,-2,-3)),new Vector3d(5,6,7));
}

@Test void testRemoveZDimension()
{
// TODO (Alp) 30
LandingController control = new LandingController();
assertEquals(control.removeZDimension(new Vector3d(4,4,4)), new Vector3d(4,4,0));

Expand Down

0 comments on commit 0b05db5

Please sign in to comment.