fix: preserve exact beam pattern work caps
This commit is contained in:
@@ -389,3 +389,27 @@ test("beam-pattern preflight rejects invalid input and excessive work", () => {
|
||||
assert(frequencyLimitError instanceof RangeError, "extreme analog frequency is bounded");
|
||||
assert(frequencyLimitError.message.includes("1000000"), "frequency cap is explicit");
|
||||
});
|
||||
|
||||
test("co-located pattern accepts an exact sample-only evaluation cap", () => {
|
||||
const pattern = computeReceiveBeamPattern({
|
||||
array: arrayFromPositions([[0, 0, 0]]),
|
||||
frequencyHz: 1_000,
|
||||
sampleCount: 360,
|
||||
maximumEvaluations: 360,
|
||||
});
|
||||
assertEqual(pattern.evaluationCount, 360, "exact one-microphone sample work");
|
||||
assertEqual(pattern.workload.maximumMetricEvaluationCount, 0, "constant cut reserves no HPBW work");
|
||||
|
||||
let error = null;
|
||||
try {
|
||||
computeReceiveBeamPattern({
|
||||
array: arrayFromPositions([[0, 0, 0]]),
|
||||
frequencyHz: 1_000,
|
||||
sampleCount: 360,
|
||||
maximumEvaluations: 359,
|
||||
});
|
||||
} catch (caught) {
|
||||
error = caught;
|
||||
}
|
||||
assert(error instanceof RangeError, "strict cap rejects one fewer evaluation");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user