Open the context
Choose the project folder and name the files or behavior involved.
Return twice the signed polygon area for 3–256 integer vertices with coordinate magnitudes at most 1000000. Test reversed order and collinear vertices, treating self-crossing paths algebraically and rejecting malformed coordinates.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def signed_double_area(points):
if type(points) not in (list, tuple) or not 3 <= len(points) <= 256:
raise ValueError("polygon.count")
for p in points:
if type(p) not in (list, tuple) or len(p) != 2 or any(type(v) is not int or abs(v) > 10**6 for v in p):
raise ValueError("polygon.coordinate")
return sum(a[0]*b[1]-a[1]*b[0] for a,b in zip(points, points[1:]+points[:1]))The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.