-
-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v.hull: Added the test cases for v.hull module #5135
Open
codersmiti
wants to merge
5
commits into
OSGeo:main
Choose a base branch
from
codersmiti:feature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
petrasovaa
reviewed
Feb 18, 2025
Comment on lines
+98
to
+120
out_ascii = gs.read_command( | ||
"v.out.ascii", | ||
input=self.output_colinear_hull, | ||
layer="-1", | ||
format="standard", | ||
) | ||
lines = [ | ||
line | ||
for line in out_ascii.splitlines() | ||
if line.strip() and not line.startswith("ORGANIZATION:") | ||
] | ||
|
||
geometry_line = next((line for line in lines if line[0] in ("L", "B")), None) | ||
self.assertIsNotNone(geometry_line, "No valid geometry found in output") | ||
parts = geometry_line.split() | ||
|
||
self.assertEqual(parts[0], "B", "Output should be a boundary") | ||
self.assertEqual(int(parts[1]), 3, "Boundary should have 3 vertices") | ||
self.assertEqual( | ||
parts[2:4], | ||
parts[6:8], | ||
"Third vertex should be a copy of the first vertex in collinear case", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can replace this (and the other tests) with https://grass.osgeo.org/grass-devel/manuals/libpython/gunittest.html#gunittest.case.TestCase.assertVectorFitsTopoInfo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces test suite for the v.hull GRASS GIS module, covering a range of scenarios, including validating the module's functionality, geometric correctness, and edge-case handling for convex hull generation. The test cases cover a variety of scenarios, including collinear points, non-collinear points, duplicate points, concave shapes, and 3D inputs.
Key updates in this PR include:
Functionality: Validate convex hull creation for 2D and 3D point sets, ensuring correct output existence and dimensions.
Edge Cases: Test collinear points, duplicate points, and concave shapes to ensure robust handling of degenerate and non-standard inputs.
Geometric Correctness: Verify the number of vertices, polygon closure, and correct exclusion of interior concave points.
3D Inputs: Validate the formation of a tetrahedron from 3D input points.
Test Case Additions:
Basic Functionality:
Verify the creation and existence of the convex hull output.
Test input handling for 2D and 3D point sets.
Edge Cases:
Collinear Points: Ensure the convex hull forms a degenerate boundary with exactly 3 vertices.
Duplicate Points: Test that duplicate points do not affect the hull structure.
Concave Shapes: Validate that the convex hull ignores interior concave points.
Geometric Correctness:
Non-Collinear Points: Verify the convex hull correctly encloses a non-collinear set of points.
3D Inputs: Test the formation of a tetrahedron from 3D input points.