Question
Write test class with at least two unit tests that test different cases for the closer() function described below: Either write a 3rd distinct test
Write test class with at least two unit tests that test different cases for the closer() function described below:
Either write a 3rd distinct test case for closer() or explain why 2 cases is enough
class Loc { // (latitude, longitude) - coordinates for location on a map public Loc(float lat, float lon);
}
class Nav {
// Destination
public void setDest(Loc goal);
// return negative value if loc1 is closer to destination than loc2
// positive value if loc2 is closer
// zero if they are equally close to the destination
public int closer(Loc loc1, Loc loc2);
}
class TestNav { // Your test code goes here
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Here is a simple unit test class for the closer function in the Nav class import orgjunitTest import ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started