Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created test cases for normalize and removeZ methods #100

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/main/java/src/land/LandingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected boolean impact(Vector3d landerPosition, double radius)
* Normalise the vectors so that a is given relative to b where b = (0,0,0)
* @return a vector a relative to b
*/
protected Vector3d normalise(Vector3d a, Vector3d b)
public Vector3d normalise(Vector3d a, Vector3d b)
{
double x = a.getX() - b.getX();
double y = a.getY() - b.getY();
Expand All @@ -80,7 +80,7 @@ protected Vector3d normalise(Vector3d a, Vector3d b)
/**
* @return a new Vector3d object with x and y copied and a 0 value for z
*/
protected Vector3d removeZDimension(Vector3d v)
public Vector3d removeZDimension(Vector3d v)
{
double x = v.getX();
double y = v.getY();
Expand Down
19 changes: 18 additions & 1 deletion app/src/test/java/src/test/TestLandingController.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,31 @@ void testOnlyLanderFall()
// TODO (Sam) 2hrs
}

@Test void testNormalise()
@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));

}

@Test void testNormaliseTwoNegative()
{
LandingController control = new LandingController();
assertEquals(control.normalise(new Vector3d(-40,-91,-43),new Vector3d(-100,-40,-33)),new Vector3d(60,-51,-10));
}

@Test void testNormaliseTwoPositive()
{
LandingController control = new LandingController();
assertEquals(control.normalise(new Vector3d(100,94,45),new Vector3d(213,432,113)),new Vector3d(-113,-338,-68));
}

}