Close three critical review findings on the render-bounds-channel verdict
Verdict can no longer print a false EXACT on an on-grid end, no longer names a bounds channel a content-derived render never consulted, and the grid-align doc premise is corrected without implementing it.
This commit is contained in:
@@ -315,6 +315,214 @@ static void testASubMillisecondStartWouldNotHideItself() {
|
||||
frameCountFor(1.000, end, 48000)));
|
||||
}
|
||||
|
||||
static void testTheTwoLiveShortRendersPinnedAtFullPrecision() {
|
||||
// 1.6551724137931001 is the console's own %.17g read-back. 4.0677966101694913 is
|
||||
// the double nearest the six-decimal value (4.067797) the earlier refusal actually
|
||||
// printed -- that refusal predates the %.17g printer (git history has no commit
|
||||
// introducing this literal as a console value), so it is a reconstruction, not a
|
||||
// captured one. 240/145 and 240/59 (testTheSixDecimalDisplayDidNotCreateTheEffect)
|
||||
// produce the SAME counts as the literals here, so this test cannot distinguish the
|
||||
// real value from the reconstruction either -- it pins the count regression (full
|
||||
// precision or six-decimal input, the frame counts agree), not which double REAPER
|
||||
// was really handed.
|
||||
CHECK(frameCountFor(0.0, 1.6551724137931001, 48000) == 79448);
|
||||
CHECK(msFlooredEndFrameCount(0.0, 1.6551724137931001, 48000) == 79440);
|
||||
|
||||
CHECK(frameCountFor(0.0, 4.0677966101694913, 48000) == 195254);
|
||||
CHECK(msFlooredEndFrameCount(0.0, 4.0677966101694913, 48000) == 195216);
|
||||
|
||||
// And the counts REAPER produced are outside the gate's tolerance in both cases —
|
||||
// the refusals were correct, not an artifact of the one-frame slack.
|
||||
CHECK(!renderHonoredBounds(79448, 79440));
|
||||
CHECK(!renderHonoredBounds(195254, 195216));
|
||||
}
|
||||
|
||||
// --- isOnMillisecondGrid: whether an observation can speak to an edge ----------
|
||||
|
||||
static void testOnGridRecognizesWholeMillisecondsIncludingTheBinaryTrap() {
|
||||
CHECK(isOnMillisecondGrid(0.0));
|
||||
CHECK(isOnMillisecondGrid(2.0));
|
||||
CHECK(isOnMillisecondGrid(0.001));
|
||||
// 1.007 s does not multiply to exactly 1007.0 in double (pinned as the premise in
|
||||
// testWindowAlreadyOnTheMillisecondGridLosesNothing) and must still read as on-grid.
|
||||
CHECK(isOnMillisecondGrid(1.007));
|
||||
// A whole millisecond at 44.1 kHz is 44.1 frames — off the frame grid, on this one.
|
||||
CHECK(isOnMillisecondGrid(0.010));
|
||||
}
|
||||
|
||||
static void testOffGridRecognizesASubMillisecondRemainder() {
|
||||
CHECK(!isOnMillisecondGrid(1.6551724137931001));
|
||||
CHECK(!isOnMillisecondGrid(1.0001724));
|
||||
// One frame short of a whole second at 48 kHz is ~0.0208 ms off the grid — the
|
||||
// tightest remainder this predicate has to keep seeing.
|
||||
CHECK(!isOnMillisecondGrid(1.0 - 1.0 / 48000.0));
|
||||
}
|
||||
|
||||
// --- describeBoundsExperiment: the console verdict on a bounds channel --------
|
||||
|
||||
static void testAnExactRenderReadsExactAndNamesItsChannel() {
|
||||
const std::string s =
|
||||
describeBoundsExperiment("time selection (RENDER_BOUNDSFLAG=2)",
|
||||
0.0, 1.6551724137931001, 79448, 48000);
|
||||
CHECK(contains(s, "EXACT"));
|
||||
CHECK(!contains(s, "SHORT"));
|
||||
CHECK(contains(s, "time selection (RENDER_BOUNDSFLAG=2)"));
|
||||
CHECK(contains(s, "79448"));
|
||||
CHECK(contains(s, "48000 Hz"));
|
||||
// The END here carries a sub-millisecond remainder, so this run DID test it --
|
||||
// the END-untested caveat must not fire on a window it didn't apply to.
|
||||
CHECK(!contains(s, "END edge is UNTESTED"));
|
||||
}
|
||||
|
||||
static void testTheLiveShortfallReadsShortAndNamesTheMillisecondShape() {
|
||||
// The observation, replayed through the verdict: 79440 produced against 79448.
|
||||
const std::string s =
|
||||
describeBoundsExperiment("custom time bounds (RENDER_BOUNDSFLAG=0)",
|
||||
0.0, 1.6551724137931001, 79440, 48000);
|
||||
CHECK(contains(s, "SHORT"));
|
||||
CHECK(!contains(s, "EXACT"));
|
||||
CHECK(contains(s, "79440"));
|
||||
CHECK(contains(s, "79448"));
|
||||
// 79440 IS the ms-floored count, so the verdict has to say the floor did not move.
|
||||
CHECK(contains(s, "floored to the millisecond"));
|
||||
}
|
||||
|
||||
static void testAShortfallThatIsNotTheMillisecondShapeClaimsNothingAboutIt() {
|
||||
// A render 3 frames short is short, but 79445 is not the floored count — the
|
||||
// millisecond sentence must not appear, or it would assert a shape that is absent.
|
||||
CHECK(msFlooredEndFrameCount(0.0, 1.6551724137931001, 48000) != 79445);
|
||||
const std::string s =
|
||||
describeBoundsExperiment("custom time bounds", 0.0, 1.6551724137931001,
|
||||
79445, 48000);
|
||||
CHECK(contains(s, "SHORT"));
|
||||
CHECK(!contains(s, "floored to the millisecond"));
|
||||
}
|
||||
|
||||
static void testARenderPastTheWindowReadsLong() {
|
||||
// The whole-item widening, through the verdict: 30 s printed for a 1 s window.
|
||||
const std::string s =
|
||||
describeBoundsExperiment("custom time bounds", 5.0, 6.0, 30 * 48000, 48000);
|
||||
CHECK(contains(s, "LONG"));
|
||||
CHECK(contains(s, "1440000 frames"));
|
||||
CHECK(contains(s, "the 48000 the window asks for"));
|
||||
}
|
||||
|
||||
static void testAWindowAlreadyOnTheGridIsUnaffectedByTheChannelSwitch() {
|
||||
// A window whose end is a whole millisecond has nothing for a floor to take: the
|
||||
// exact count and the floored count are the same number, so an exact render reads
|
||||
// EXACT and the millisecond sentence never fires.
|
||||
CHECK(frameCountFor(0.0, 2.0, 48000) == msFlooredEndFrameCount(0.0, 2.0, 48000));
|
||||
const std::string s =
|
||||
describeBoundsExperiment("time selection", 0.0, 2.0, 96000, 48000);
|
||||
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"));
|
||||
}
|
||||
|
||||
static void testAWithinToleranceDeltaIsTaggedNotFloorShaped() {
|
||||
// One frame off frameCountFor is the gate's own edge-convention slack
|
||||
// (render_window.h), not the millisecond floor -- the verdict must say so rather
|
||||
// than reading like a genuine miss or like the floor was escaped.
|
||||
const std::string shortByOne =
|
||||
describeBoundsExperiment("time selection", 0.0, 4.067797, 195253, 48000);
|
||||
CHECK(contains(shortByOne, "SHORT"));
|
||||
CHECK(contains(shortByOne, "WITHIN TOLERANCE"));
|
||||
CHECK(!contains(shortByOne, "floored to the millisecond"));
|
||||
|
||||
const std::string longByOne =
|
||||
describeBoundsExperiment("time selection", 0.0, 4.067797, 195255, 48000);
|
||||
CHECK(contains(longByOne, "LONG"));
|
||||
CHECK(contains(longByOne, "WITHIN TOLERANCE"));
|
||||
|
||||
// A genuine miss (outside the tolerance) carries no such tag.
|
||||
const std::string shortByThree =
|
||||
describeBoundsExperiment("time selection", 0.0, 4.067797, 195251, 48000);
|
||||
CHECK(contains(shortByThree, "SHORT"));
|
||||
CHECK(!contains(shortByThree, "WITHIN TOLERANCE"));
|
||||
}
|
||||
|
||||
static void testABypassingSourceReadsNotJudgedAndNamesTheSourceNotTheChannel() {
|
||||
// SelectedItems/RazorArea derive their own bounds from content -- the channel
|
||||
// named by channelLabel was never consulted, so a matching frame count here would
|
||||
// be a coincidence, not evidence the channel escaped the floor.
|
||||
const std::string s =
|
||||
describeBoundsExperiment("time selection", 0.0, 1.6551724137931001,
|
||||
79448, 48000, "selected media items");
|
||||
CHECK(contains(s, "NOT JUDGED"));
|
||||
CHECK(contains(s, "selected media items"));
|
||||
CHECK(!contains(s, "EXACT"));
|
||||
// The channel is still named at the top of the line -- only the verdict changes.
|
||||
CHECK(contains(s, "time selection"));
|
||||
}
|
||||
|
||||
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, ""),
|
||||
"EXACT"));
|
||||
}
|
||||
|
||||
static void testAnOnGridStartSaysTheStartEdgeIsUntested() {
|
||||
// Both live observations started at 0 s — the value that hides a start-side floor.
|
||||
const std::string s =
|
||||
describeBoundsExperiment("time selection", 0.0, 1.6551724137931001, 79448, 48000);
|
||||
CHECK(contains(s, "UNTESTED"));
|
||||
CHECK(contains(s, "millisecond grid"));
|
||||
}
|
||||
|
||||
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.
|
||||
const std::string s =
|
||||
describeBoundsExperiment("time selection", 1.0001724, 2.0001724, 48000, 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),
|
||||
"LONG"));
|
||||
}
|
||||
|
||||
static void testAt44100WhereAMillisecondIsNotAWholeNumberOfFrames() {
|
||||
// 44.1 kHz: the window is 463 frames, the ms-floored one 441 (both pinned in
|
||||
// testMillisecondFloorAt44100WhereAMillisecondIsNotWholeFrames). The verdict has to
|
||||
// reach the same two numbers at a rate where a millisecond is 44.1 frames.
|
||||
const std::string exact =
|
||||
describeBoundsExperiment("time selection", 0.0, 0.0105, 463, 44100);
|
||||
CHECK(contains(exact, "EXACT"));
|
||||
CHECK(contains(exact, "44100 Hz"));
|
||||
|
||||
const std::string floored =
|
||||
describeBoundsExperiment("custom time bounds", 0.0, 0.0105, 441, 44100);
|
||||
CHECK(contains(floored, "SHORT"));
|
||||
CHECK(contains(floored, "floored to the millisecond"));
|
||||
}
|
||||
|
||||
static void testAnUnmeasuredRenderAnswersNothingRatherThanPassing() {
|
||||
// Auto/Manual are not judged against a frame count, and an empty render has none.
|
||||
// The line must still print and must not read as a pass — its silence would.
|
||||
const std::string s =
|
||||
describeBoundsExperiment("time selection", 0.0, 1.6551724137931001, 0, 0);
|
||||
CHECK(!s.empty());
|
||||
CHECK(contains(s, "NOT JUDGED"));
|
||||
CHECK(!contains(s, "EXACT"));
|
||||
CHECK(contains(s, "time selection"));
|
||||
}
|
||||
|
||||
static void testAnUnnamedChannelStillProducesAReadableLine() {
|
||||
CHECK(contains(describeBoundsExperiment(nullptr, 0.0, 1.0, 48000, 48000),
|
||||
"unnamed"));
|
||||
CHECK(contains(describeBoundsExperiment("", 0.0, 1.0, 48000, 48000), "unnamed"));
|
||||
}
|
||||
|
||||
// --- describeBoundsDrift: the read-back's verdict ------------------------------
|
||||
|
||||
static void testBoundsThatReadBackUnchangedDescribeNothing() {
|
||||
@@ -395,6 +603,22 @@ int main() {
|
||||
testOneFrameOfRemainderStillFloors();
|
||||
testMillisecondFloorAt44100WhereAMillisecondIsNotWholeFrames();
|
||||
testASubMillisecondStartWouldNotHideItself();
|
||||
testTheTwoLiveShortRendersPinnedAtFullPrecision();
|
||||
testOnGridRecognizesWholeMillisecondsIncludingTheBinaryTrap();
|
||||
testOffGridRecognizesASubMillisecondRemainder();
|
||||
testAnExactRenderReadsExactAndNamesItsChannel();
|
||||
testTheLiveShortfallReadsShortAndNamesTheMillisecondShape();
|
||||
testAShortfallThatIsNotTheMillisecondShapeClaimsNothingAboutIt();
|
||||
testARenderPastTheWindowReadsLong();
|
||||
testAWindowAlreadyOnTheGridIsUnaffectedByTheChannelSwitch();
|
||||
testAWithinToleranceDeltaIsTaggedNotFloorShaped();
|
||||
testABypassingSourceReadsNotJudgedAndNamesTheSourceNotTheChannel();
|
||||
testANullOrEmptyBypassLabelFallsBackToTheOrdinaryVerdict();
|
||||
testAnOnGridStartSaysTheStartEdgeIsUntested();
|
||||
testAnOffGridStartSaysTheStartEdgeIsTested();
|
||||
testAt44100WhereAMillisecondIsNotAWholeNumberOfFrames();
|
||||
testAnUnmeasuredRenderAnswersNothingRatherThanPassing();
|
||||
testAnUnnamedChannelStillProducesAReadableLine();
|
||||
testBoundsThatReadBackUnchangedDescribeNothing();
|
||||
testADriftedEndNamesBothWindowsAndBothCounts();
|
||||
testTheReportPrintsEnoughDigitsToShowTheDrift();
|
||||
|
||||
Reference in New Issue
Block a user