Ξ-W2-T1: the resample bake chain — instrument renders, extension banks, one click re-points and resets
This commit is contained in:
@@ -449,7 +449,44 @@ static void testTiedUniverseIsStrictSubsetOfProtectedUniverse() {
|
||||
CHECK(tiedUsageExists(state, "bank/self.wav", "rsusage_ME") == Answer::No);
|
||||
}
|
||||
|
||||
// The resample's own branch off the three answers. Indeterminate must land where Yes does:
|
||||
// AddDistinct disturbs no existing holder, so it is the non-destructive side.
|
||||
static void testResampleLandingTakesReplaceOnlyOnADefiniteNo() {
|
||||
CHECK(resampleLanding(Answer::No) == Landing::Replace);
|
||||
CHECK(resampleLanding(Answer::Yes) == Landing::AddDistinct);
|
||||
CHECK(resampleLanding(Answer::Indeterminate) == Landing::AddDistinct);
|
||||
|
||||
// Composed with the query itself, over the three states a real bake meets.
|
||||
OriginLedger ledger;
|
||||
ledger.record(originOf("bank/src.wav", OriginKind::Capture, "S-src"));
|
||||
|
||||
// Sole holder, excluding itself -> nothing is tied -> replace.
|
||||
const UsageFoldResult sole = foldLive(
|
||||
{usage("rsusage_ME", "{T1}", {UsageHold{"S-src", "bank/src.wav"}})}, {"{T1}"});
|
||||
const TrackingState soleState{LedgerStatus::Loaded, ledger, sole};
|
||||
CHECK(resampleLanding(tiedUsageExists(soleState, "bank/src.wav", "rsusage_ME")) ==
|
||||
Landing::Replace);
|
||||
|
||||
// A second live instance holds it -> add distinct, so that holder is undisturbed.
|
||||
const UsageFoldResult shared = foldLive(
|
||||
{usage("rsusage_ME", "{T1}", {UsageHold{"S-src", "bank/src.wav"}}),
|
||||
usage("rsusage_OTHER", "{T2}", {UsageHold{"S-src", "bank/src.wav"}})},
|
||||
{"{T1}", "{T2}"});
|
||||
const TrackingState sharedState{LedgerStatus::Loaded, ledger, shared};
|
||||
CHECK(resampleLanding(tiedUsageExists(sharedState, "bank/src.wav", "rsusage_ME")) ==
|
||||
Landing::AddDistinct);
|
||||
|
||||
// A degraded ledger cannot answer -> add distinct rather than take over an entry
|
||||
// whose holders are unknown.
|
||||
const TrackingState degradedState{LedgerStatus::Unreadable, ledger, sole};
|
||||
CHECK(tiedUsageExists(degradedState, "bank/src.wav", "rsusage_ME") ==
|
||||
Answer::Indeterminate);
|
||||
CHECK(resampleLanding(tiedUsageExists(degradedState, "bank/src.wav", "rsusage_ME")) ==
|
||||
Landing::AddDistinct);
|
||||
}
|
||||
|
||||
int main() {
|
||||
testResampleLandingTakesReplaceOnlyOnADefiniteNo();
|
||||
testPruneProtectedSet();
|
||||
testLiveHoldProtectsDeReferencedCapture();
|
||||
testUnreadableUsageBlocksPruneAndNamesIt();
|
||||
|
||||
Reference in New Issue
Block a user