Skip to content

Commit 96f6d60

Browse files
author
Aaron
committed
style: formatted with clang-format and renamed variables
1 parent d920cc8 commit 96f6d60

File tree

1 file changed

+49
-50
lines changed

1 file changed

+49
-50
lines changed
Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
package com.thealgorithms.geometry;
22

3-
import org.junit.jupiter.api.Test;
4-
53
import static org.junit.jupiter.api.Assertions.*;
64

5+
import org.junit.jupiter.api.Test;
6+
77
public class PointTest {
88

99
@Test
1010
void testCompareTo() {
11-
Point p1 = new Point (1, 2);
11+
Point p1 = new Point(1, 2);
1212
Point p2 = new Point(5, -1);
1313
Point p3 = new Point(3, 9);
1414
Point p4 = new Point(3, 9);
15-
assertEquals(1,p1.compareTo(p2));
16-
assertEquals(-1,p2.compareTo(p3));
17-
assertEquals(0,p3.compareTo(p4));
15+
assertEquals(1, p1.compareTo(p2));
16+
assertEquals(-1, p2.compareTo(p3));
17+
assertEquals(0, p3.compareTo(p4));
1818
}
1919

2020
@Test
2121
void testToString() {
22-
Point p1 = new Point (-3, 5);
23-
assertEquals("(-3, 5)",p1.toString());
22+
Point p = new Point(-3, 5);
23+
assertEquals("(-3, 5)", p.toString());
2424
}
2525

26-
2726
@Test
2827
void testPolarOrder() {
29-
Point p = new Point(0,0);
28+
Point p = new Point(0, 0);
3029
assertNotNull(p.polarOrder());
3130
}
3231

@@ -49,8 +48,8 @@ void testOrientation() {
4948
assertEquals(1, Point.orientation(pA, pB, pC));
5049

5150
// test for right curve
52-
pB = new Point(1,0);
53-
pC = new Point(1,-1);
51+
pB = new Point(1, 0);
52+
pC = new Point(1, -1);
5453
assertEquals(-1, Point.orientation(pA, pB, pC));
5554

5655
// test for collinearity
@@ -61,56 +60,56 @@ void testOrientation() {
6160

6261
@Test
6362
void testPolarOrderCompare() {
64-
Point ref = new Point(0,0);
63+
Point ref = new Point(0, 0);
6564

66-
Point p1 = new Point(1,1);
67-
Point p2 = new Point(1,-1);
68-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
65+
Point pA = new Point(1, 1);
66+
Point pB = new Point(1, -1);
67+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
6968

70-
p1 = new Point(3,0);
71-
p2 = new Point(2,0);
72-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
69+
pA = new Point(3, 0);
70+
pB = new Point(2, 0);
71+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
7372

74-
p1 = new Point(0,1);
75-
p2 = new Point(-1,1);
76-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
73+
pA = new Point(0, 1);
74+
pB = new Point(-1, 1);
75+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
7776

78-
p1 = new Point(1,1);
79-
p2 = new Point(2,2);
80-
assertEquals(0, ref.polarOrder().compare(p1, p2));
77+
pA = new Point(1, 1);
78+
pB = new Point(2, 2);
79+
assertEquals(0, ref.polarOrder().compare(pA, pB));
8180

82-
p1 = new Point(1,2);
83-
p2 = new Point(2,1);
84-
assertTrue(ref.polarOrder().compare(p1, p2) > 0);
81+
pA = new Point(1, 2);
82+
pB = new Point(2, 1);
83+
assertTrue(ref.polarOrder().compare(pA, pB) > 0);
8584

86-
p1 = new Point(2,1);
87-
p2 = new Point(1,2);
88-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
85+
pA = new Point(2, 1);
86+
pB = new Point(1, 2);
87+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
8988

90-
p1 = new Point(-1,0);
91-
p2 = new Point(-2,0);
92-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
89+
pA = new Point(-1, 0);
90+
pB = new Point(-2, 0);
91+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
9392

94-
p1 = new Point(2,3);
95-
p2 = new Point(2,3);
96-
assertEquals(0, ref.polarOrder().compare(p1, p2));
93+
pA = new Point(2, 3);
94+
pB = new Point(2, 3);
95+
assertEquals(0, ref.polarOrder().compare(pA, pB));
9796

98-
p1 = new Point(0,1);
99-
p2 = new Point(0,-1);
100-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
97+
pA = new Point(0, 1);
98+
pB = new Point(0, -1);
99+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
101100

102-
ref = new Point(1,1);
101+
ref = new Point(1, 1);
103102

104-
p1 = new Point(1,2);
105-
p2 = new Point(2,2);
106-
assertTrue(ref.polarOrder().compare(p1, p2) > 0);
103+
pA = new Point(1, 2);
104+
pB = new Point(2, 2);
105+
assertTrue(ref.polarOrder().compare(pA, pB) > 0);
107106

108-
p1 = new Point(2,1);
109-
p2 = new Point(2,0);
110-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
107+
pA = new Point(2, 1);
108+
pB = new Point(2, 0);
109+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
111110

112-
p1 = new Point(0,1);
113-
p2 = new Point(1,0);
114-
assertTrue(ref.polarOrder().compare(p1, p2) < 0);
111+
pA = new Point(0, 1);
112+
pB = new Point(1, 0);
113+
assertTrue(ref.polarOrder().compare(pA, pB) < 0);
115114
}
116115
}

0 commit comments

Comments
 (0)