def test_xyOrder_withNotEqualXCoordinatePoints_shouldCompareByXAndReturnCorrectComparatorResult(self): for i in range(500): xa = random.uniform(0, 1000) xb = random.uniform(-1000, -1) a = Point2D(xa, 1) b = Point2D(xb, -1) self.assertEqual( 1, Point2D.xy_order(a, b)) self.assertEqual(-1, Point2D.xy_order(b, a))
def test_xyOrder_withEqualXAndNotEqualYCoordinatePoints_shouldCompareByYAndReturnCorrectComparatorResult(self): for i in range(500): ya = random.uniform(0, 1000) yb = random.uniform(-1000, -1) a = Point2D(1, ya) b = Point2D(1, yb) self.assertEqual( 1, Point2D.xy_order(a, b)) self.assertEqual(-1, Point2D.xy_order(b, a))
def test_xyOrder_withEqualsXYCoordinatePoints_shouldReturnZero(self): for i in range(500): x = random.uniform(0, 1000) y = random.uniform(0, 1000) a = Point2D(x, y) b = Point2D(x, y) self.assertEqual(0, Point2D.xy_order(a, b)) self.assertEqual(0, Point2D.xy_order(b, a))