Fix render-bounds EXACT verdict: enumerate floored models instead of trusting grid membership

Grid-ness of an edge was a proxy for "no floor could explain this count," not
the test itself — equal remainders on both edges cancel under a full floor. Now
checks all three floored models directly and corrects the SHORT/LONG
floor-signature docs.
This commit is contained in:
2026-08-02 16:21:46 -04:00
parent 5f971e60cd
commit bcdf97d6c4
6 changed files with 188 additions and 51 deletions
+103 -16
View File
@@ -417,10 +417,79 @@ static void testAWindowAlreadyOnTheGridIsUnaffectedByTheChannelSwitch() {
CHECK(contains(s, "EXACT"));
CHECK(contains(s, "96000"));
CHECK(!contains(s, "floored to the millisecond"));
// The false positive this window is the shape of: an end-floored render would have
// printed this identical EXACT count, so the line must say this run cannot tell the
// two apart rather than reading EXACT as settled.
CHECK(contains(s, "END edge is UNTESTED"));
// The false positive this window is the shape of: a render that floored either edge
// alone, or both together, would have printed this identical EXACT count (every
// edge here is on the grid) -- the line has to say this run cannot rule any of them
// out rather than reading EXACT as settled.
CHECK(contains(s, "EXACT here is not proof"));
CHECK(contains(s, "floors the START edge alone"));
CHECK(contains(s, "floors the END edge alone"));
CHECK(contains(s, "floors START and END together"));
}
static void testEqualRemaindersCancelUnderAFullFloorEvenOffGrid() {
// C1: a dragged, fixed-length time selection reproduces this. Neither edge sits on
// the millisecond grid (isOnMillisecondGrid is false for both), but the START and
// END frame-rounding remainders are EQUAL (rs == re == 8 frames), so a render that
// floors both edges together lands on the identical count -- the grid predicate on
// either edge alone would have missed this collision entirely.
const double start = 1.0001724, end = 2.0001724;
CHECK(!isOnMillisecondGrid(start));
CHECK(!isOnMillisecondGrid(end));
const long long expected = frameCountFor(start, end, 48000);
CHECK(expected == 48000);
// The both-edges-floored render lands on the SAME count as the exact one.
CHECK(frameCountFor(1.000, 2.000, 48000) == expected);
// Neither edge floored ALONE reproduces it -- only the combined floor does.
CHECK(frameCountFor(1.000, end, 48000) != expected);
CHECK(frameCountFor(start, 2.000, 48000) != expected);
const std::string s =
describeBoundsExperiment("time selection", start, end, expected, 48000);
CHECK(contains(s, "EXACT"));
CHECK(contains(s, "EXACT here is not proof"));
CHECK(contains(s, "floors START and END together"));
CHECK(!contains(s, "floors the START edge alone"));
CHECK(!contains(s, "floors the END edge alone"));
}
static void testEndOffGridByUnderHalfAFrameStillCollidesWithAFlooredEnd() {
// C1's second live shape: isOnMillisecondGrid reads this END as off-grid, but the
// remainder is under half a frame at 48 kHz, so flooring it doesn't move its frame
// index -- a grid test on the edge alone would still miss this collision.
const double start = 0.0, end = 1.000005;
CHECK(!isOnMillisecondGrid(end));
const long long expected = frameCountFor(start, end, 48000);
CHECK(expected == 48000);
CHECK(frameCountFor(start, 1.000, 48000) == expected); // the floored-end model matches
const std::string s =
describeBoundsExperiment("time selection", start, end, expected, 48000);
CHECK(contains(s, "EXACT"));
CHECK(contains(s, "EXACT here is not proof"));
CHECK(contains(s, "floors the END edge alone"));
}
static void testALongVerdictNeverCarriesTheFloorSentence() {
// A floor only removes frames, so LONG can never be its signature -- the sentence
// must not appear even though the delta here is a "clean" one-frame LONG.
const std::string s =
describeBoundsExperiment("time selection", 5.0, 6.0, 48001, 48000);
CHECK(contains(s, "LONG"));
CHECK(!contains(s, "floored to the millisecond"));
}
static void testASubFrameWindowIsNotJudgedNotExact() {
// A window under one frame at this rate rounds to 0 expected frames. A 0-frame
// render against that is a 0-vs-0 coincidence of degenerate inputs, not a match --
// it must read NOT JUDGED, never EXACT.
const double oneTenthOfAFrame = 1.0 / (48000.0 * 10.0);
const long long expected = frameCountFor(0.0, oneTenthOfAFrame, 48000);
CHECK(expected == 0);
const std::string s =
describeBoundsExperiment("time selection", 0.0, oneTenthOfAFrame, 0, 48000);
CHECK(contains(s, "NOT JUDGED"));
CHECK(!contains(s, "EXACT"));
}
static void testAWithinToleranceDeltaIsTaggedNotFloorShaped() {
@@ -460,10 +529,18 @@ static void testABypassingSourceReadsNotJudgedAndNamesTheSourceNotTheChannel() {
}
static void testANullOrEmptyBypassLabelFallsBackToTheOrdinaryVerdict() {
CHECK(contains(describeBoundsExperiment("time selection", 0.0, 1.0, 48000, 48000,
nullptr),
"EXACT"));
CHECK(contains(describeBoundsExperiment("time selection", 0.0, 1.0, 48000, 48000, ""),
// Off-grid, non-cancelling edges (see testEqualRemaindersCancelUnderAFullFloorEvenOffGrid
// for the window shape that WOULD trip the collision caveat, whose own text also
// contains "EXACT") so this assertion is pinned to the verdict word itself, not to a
// caveat sentence that happens to contain the same substring.
const double start = 1.0001724, end = 2.0009724;
const long long expected = frameCountFor(start, end, 48000);
const std::string withNull =
describeBoundsExperiment("time selection", start, end, expected, 48000, nullptr);
CHECK(contains(withNull, "EXACT"));
CHECK(!contains(withNull, "EXACT here is not proof"));
CHECK(contains(describeBoundsExperiment("time selection", start, end, expected, 48000,
""),
"EXACT"));
}
@@ -476,18 +553,24 @@ static void testAnOnGridStartSaysTheStartEdgeIsUntested() {
}
static void testAnOffGridStartSaysTheStartEdgeIsTested() {
// The run that would settle the start question: a start carrying its own remainder.
// Whether REAPER floors the start or not, THIS run is the one that shows it.
// The run that would genuinely settle the start question: a start carrying its own
// remainder, paired with an end whose remainder does NOT cancel it (unlike
// testEqualRemaindersCancelUnderAFullFloorEvenOffGrid's window, where the same shape
// of start value pairs with an end that cancels it and the collision caveat fires
// instead). No floored model reproduces this count, so EXACT here is unqualified.
const double start = 1.0001724, end = 2.0009724;
const long long expected = frameCountFor(start, end, 48000);
const std::string s =
describeBoundsExperiment("time selection", 1.0001724, 2.0001724, 48000, 48000);
describeBoundsExperiment("time selection", start, end, expected, 48000);
CHECK(contains(s, "IS tested"));
CHECK(!contains(s, "UNTESTED"));
// A floored start would have printed 48008 frames, not 48000 — so the same line
// reads EXACT here and SHORT/LONG on the floored outcome.
CHECK(frameCountFor(1.000, 2.0001724, 48000) == 48008);
CHECK(contains(s, "EXACT"));
CHECK(contains(describeBoundsExperiment("time selection", 1.0001724, 2.0001724,
48008, 48000),
CHECK(!contains(s, "EXACT here is not proof"));
// A start-floored-alone render would have printed a DIFFERENT count here, so a
// mismatch against `expected` on a re-run is real evidence, not ambiguous.
CHECK(frameCountFor(1.000, end, 48000) != expected);
CHECK(contains(describeBoundsExperiment("time selection", start, end,
frameCountFor(1.000, end, 48000), 48000),
"LONG"));
}
@@ -611,6 +694,10 @@ int main() {
testAShortfallThatIsNotTheMillisecondShapeClaimsNothingAboutIt();
testARenderPastTheWindowReadsLong();
testAWindowAlreadyOnTheGridIsUnaffectedByTheChannelSwitch();
testEqualRemaindersCancelUnderAFullFloorEvenOffGrid();
testEndOffGridByUnderHalfAFrameStillCollidesWithAFlooredEnd();
testALongVerdictNeverCarriesTheFloorSentence();
testASubFrameWindowIsNotJudgedNotExact();
testAWithinToleranceDeltaIsTaggedNotFloorShaped();
testABypassingSourceReadsNotJudgedAndNamesTheSourceNotTheChannel();
testANullOrEmptyBypassLabelFallsBackToTheOrdinaryVerdict();