note: close out the model — correct an inert mutation claim, retag four non-discriminating assertions, assert Tempo's closure, fix three doc/test accuracy gaps
No behavior change; verification-record corrections and one static_assert.
This commit is contained in:
@@ -356,14 +356,27 @@ static void testEveryDenominationBranchingFunctionAgreesWithThePin() {
|
||||
CHECK(corrupt == asMs); // offsetMs / offsetBeats / offsetSeconds covered above
|
||||
CHECK(!(corrupt != asMs));
|
||||
CHECK(redenominate(corrupt, Denomination::Milliseconds, t) == corrupt);
|
||||
// Measured (mutate offsetOf to a pass-through): still passes. offsetFromBeats always
|
||||
// tags its result Beats, so this holds regardless of whether corrupt was pinned — it
|
||||
// does not discriminate the pin.
|
||||
CHECK(redenominate(corrupt, Denomination::Beats, t).denomination() == Denomination::Beats);
|
||||
// Reported measured (withMsView reverted to its pre-domain-closure form): still passes.
|
||||
// corrupt already equals asMs by this point, and withMsView is a pure function of its
|
||||
// argument, so this line cannot discriminate anything withMsView-specific — it is a
|
||||
// restatement of the equality above.
|
||||
CHECK(withMsView(corrupt, 40.0, t) == withMsView(asMs, 40.0, t));
|
||||
CHECK(withMsView(corrupt, 40.0, t).denomination() == Denomination::Milliseconds);
|
||||
// Measured (mutate offsetOf to a pass-through): still passes. withBeatsView only branches
|
||||
// on `== Beats`; any non-Beats value — pinned or raw corrupt — takes the same ms-based
|
||||
// else branch, so this does not discriminate the pin either.
|
||||
CHECK(withBeatsView(corrupt, 1.0, t) == withBeatsView(asMs, 1.0, t));
|
||||
CHECK(withBeatsView(corrupt, 1.0, t).denomination() == Denomination::Milliseconds);
|
||||
CHECK(almostEqual(withBeatsView(corrupt, 1.0, t).magnitude(), 500.0, 1e-6));
|
||||
|
||||
// An unnamed TARGET denomination pins the same way an unnamed stored one does.
|
||||
// Reported measured (offsetOf(0.0, to) replaced with `= to;`): still passes, for the
|
||||
// same reason as above — `target == Beats` is false whether target is pinned or raw, so
|
||||
// this always takes the ms branch and cannot discriminate the door (see the comment on
|
||||
// that line in note_program.cpp).
|
||||
CHECK(redenominate(offsetFromBeats(1.0), static_cast<Denomination>(7), t)
|
||||
== offsetFromMs(500.0));
|
||||
}
|
||||
@@ -445,7 +458,10 @@ static void testResolveNoteIsFiniteForEveryConstructibleInput() {
|
||||
const double magnitudes[] = {-inf, -kMaxConvertibleMagnitude, -1e300, 0.0, 1e300,
|
||||
kMaxConvertibleMagnitude, inf, nan};
|
||||
int accepted = 0, rejected = 0;
|
||||
for (double bpm : {1e-320, 1e-306, 1e-200, 1e-6, 0.5, 120.0, 1e6, 1e100, 1e308}) {
|
||||
// 1e-294/1e-295 bracket the accept/reject edge (measured ~3.34e-295) so the sweep
|
||||
// actually approaches it rather than jumping past it by ~95 orders of magnitude.
|
||||
for (double bpm :
|
||||
{1e-320, 1e-306, 1e-295, 1e-294, 1e-200, 1e-6, 0.5, 120.0, 1e6, 1e100, 1e308}) {
|
||||
const std::optional<Tempo> tempo = Tempo::fromBpm(bpm);
|
||||
if (!tempo) { ++rejected; continue; }
|
||||
++accepted;
|
||||
|
||||
Reference in New Issue
Block a user