Skip to content

Add test coverage for undertested core modules (BasisEvaluator, VolumeEvaluator, SurfaceOperator, PrimitiveFactory)#3

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/evaluate-completeness-nurbssharp
Draft

Add test coverage for undertested core modules (BasisEvaluator, VolumeEvaluator, SurfaceOperator, PrimitiveFactory)#3
Copilot wants to merge 2 commits into
masterfrom
copilot/evaluate-completeness-nurbssharp

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 9, 2026

Completeness evaluation of the repository identified several public APIs with minimal or no test coverage. This PR adds 16 targeted tests across 4 files to cover the gaps found.

New Tests

BasisEvaluationTest.cs (+7 tests)

Core NURBS math properties that were entirely untested:

  • Partition of unity: ∑ Nᵢ,ₚ(u) = 1 at any parameter
  • Non-negativity of all basis functions
  • Degree-1 hat function shape with intermediate values (linear ramp verified at u=0.25, u=0.75)
  • First derivative sum-to-zero (∑ N'ᵢ,ₚ(u) = 0)
  • DeBoor algorithm: degree-1 linear interpolation and degree-2 clamped end-point interpolation
  • FindSpan clamping behavior for out-of-range parameters

VolumeEvaluateTest.cs (+4 tests)

  • Axis-aligned linear volume correctly maps P(u,v,w) = (w,v,u)
  • All evaluated points lie within the control-point bounding box
  • null argument throws ArgumentNullException
  • Mismatched knot vector length throws InvalidOperationException in constructor

SurfaceOperatorTest.cs (+4 tests)

FindClosestPoint had zero test coverage:

  • Planar surface: target above center projects to z=0 with correct distance
  • With explicit initial guess
  • Sphere: explicit tolerance/gridDivisions vs. default parameters produce consistent results (validates optional args are exercised)
  • null surface throws

PrimitiveTest.cs (+1 test)

  • CreateLine: verifies degree-1, 2-control-point structure; start/end interpolation; parametric linearity at all sample points

…urfaceOperator, PrimitiveFactory

Agent-Logs-Url: https://github.com/nyarurato/NurbsSharp/sessions/58bd23ed-c3c5-49ca-9884-41b87c0fd788

Co-authored-by: nyarurato <8384007+nyarurato@users.noreply.github.com>
Copilot AI changed the title [WIP] Evaluate completeness of the nurbssharp repository Add test coverage for undertested core modules (BasisEvaluator, VolumeEvaluator, SurfaceOperator, PrimitiveFactory) Apr 9, 2026
Copilot AI requested a review from nyarurato April 9, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants