Distance Test Cases

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Distance between two points P(a, b) and Q(c, d) is given by: d(P, Q) = √(c − 𝑎)2 + (𝑑 − 𝑏)2

Example Coordinates (first 4 points in coordinates.json):


[
{"id":"a","value":"31,49"},
{"id":"b","value":"44,67"},
{"id":"c","value":"93,6"},
{"id":"d","value":"20,16"}
]

Test Case 1:
Input Value: x = 0, y = 0
Using the formula above we can calculate distance between:
 (0,0) and (31,49) approximately = 57.983
 (0,0) and (44,67) approximately = 80.156
 (0,0) and (93,6) approximately = 93.193
 (0,0) and (20,16) approximately = 25.612
Output:
1. (20,16)
2. (31,49)
3. (44,67)
4. (93,6)

Test Case 2:
Input Value: x = 93, y = 6
Using the formula above we can calculate distance between:
 (93,6) and (31,49) approximately = 75.452
 (93,6) and (44,67) approximately = 78.243
 (93,6) and (93,6) approximately = 0
 (93,6) and (20,16) approximately = 73.682
Output:
1. (93,6)
2. (20,16)
3. (31,49)
4. (44,67)

Test Case 3:
Input Value: x = 45, y = 55
Using the formula above we can calculate distance between:
 (45,55) and (31,49) approximately = 15.232
 (45,55) and (44,67) approximately = 12.042
 (45,55) and (93,6) approximately = 68.593
 (45,55) and (20,16) approximately = 46.325
Output:
1. (44,67)
2. (31,49)
3. (20,16)
4. (93,6)

You might also like