feat: validate local G2 candidate quality
This commit is contained in:
@@ -74,4 +74,43 @@ $gearBoundary = Invoke-Scenario 'GearBoundary'
|
||||
Assert-True $gearBoundary.GearBoundaryMarkerPreserved `
|
||||
'A window touching a gear-switch segment boundary must preserve its point-level gear marker.'
|
||||
|
||||
$evaluatorType = Get-RequiredType 'MultiWheelC.TrajectoryPlanning.PathSmoothing.LocalG2.LocalG2CandidateEvaluator'
|
||||
$evaluatorHooksType = $evaluatorType.GetNestedType('TestHooks', [Reflection.BindingFlags]'Public,NonPublic')
|
||||
Assert-True ($null -ne $evaluatorHooksType) 'LocalG2CandidateEvaluator must expose narrowly scoped deterministic TestHooks.'
|
||||
$evaluateMethod = $evaluatorHooksType.GetMethod('Execute', [Reflection.BindingFlags]'Public,Static')
|
||||
Assert-True ($null -ne $evaluateMethod) 'TestHooks must execute deterministic candidate quality-gate scenarios.'
|
||||
|
||||
function Invoke-EvaluationScenario([string]$Scenario) {
|
||||
return $evaluateMethod.Invoke($null, @($Scenario))
|
||||
}
|
||||
|
||||
$tooFar = Invoke-EvaluationScenario 'TooFar'
|
||||
Assert-Equal 'DeviationExceeded' $tooFar.FailureReason `
|
||||
'A collision-free candidate more than 0.10 m from the raw window must be rejected.'
|
||||
|
||||
$overshoot = Invoke-EvaluationScenario 'Overshoot'
|
||||
Assert-Equal 'CurvatureOvershoot' $overshoot.FailureReason `
|
||||
'A candidate outside the raw regional curvature range must be rejected.'
|
||||
|
||||
$noOp = Invoke-EvaluationScenario 'NoOp'
|
||||
Assert-Equal 'InsufficientImprovement' $noOp.FailureReason `
|
||||
'A safe no-op must not be accepted.'
|
||||
|
||||
$oscillating = Invoke-EvaluationScenario 'Oscillating'
|
||||
Assert-Equal 'VariationCostRegression' $oscillating.FailureReason `
|
||||
'Repeated curvature oscillation must fail the variation-cost gate.'
|
||||
|
||||
$lowClearance = Invoke-EvaluationScenario 'LowClearance'
|
||||
Assert-Equal 'InsufficientClearance' $lowClearance.FailureReason `
|
||||
'A path with less than 0.02 m checked clearance must be rejected.'
|
||||
|
||||
$improved = Invoke-EvaluationScenario 'Improved'
|
||||
Assert-Equal 'Accepted' $improved.Status `
|
||||
'A safe candidate with at least 20 percent peak improvement must be accepted.'
|
||||
|
||||
$smallestDeviation = Invoke-EvaluationScenario 'SmallestDeviation'
|
||||
$best = Invoke-EvaluationScenario 'Best'
|
||||
Assert-Equal $smallestDeviation.CandidateIndex $best.CandidateIndex `
|
||||
'Among sufficient candidates, minimum deviation must win before extra smoothness.'
|
||||
|
||||
Write-Output 'Path smoothing Local G2 candidate checks passed.'
|
||||
|
||||
Reference in New Issue
Block a user