Render in place: a track's output to a new sibling, source to the bench
This commit is contained in:
@@ -241,6 +241,41 @@ static void testEveryAwkwardStemStaysFilesystemLegal() {
|
||||
}
|
||||
}
|
||||
|
||||
// --- captureTrackName -------------------------------------------------------
|
||||
|
||||
static void testCaptureTrackNamePrefixesAPlainSourceName() {
|
||||
CHECK(captureTrackName("MONEY") == "Capture MONEY");
|
||||
CHECK(captureTrackName("bass di") == "Capture bass di");
|
||||
}
|
||||
|
||||
static void testCaptureTrackNameIsIdempotent() {
|
||||
// The whole point: a second render over a result track must not stack the prefix.
|
||||
CHECK(captureTrackName("Capture MONEY") == "Capture MONEY");
|
||||
CHECK(captureTrackName(captureTrackName("MONEY")) == "Capture MONEY");
|
||||
// A fixed point on its own output for EVERY input, degenerate ones included.
|
||||
for (const char* src : {"MONEY", "", "Capture", "Capture ", "Captured drums"}) {
|
||||
const std::string once = captureTrackName(src);
|
||||
CHECK(captureTrackName(once) == once);
|
||||
}
|
||||
}
|
||||
|
||||
static void testCaptureTrackNameEmptySourceHasNoTrailingSpace() {
|
||||
// Unreachable from trackName (GetTrackName always answers "Track N"), so this is
|
||||
// the defensive case — a bare word rather than a name ending in a space.
|
||||
CHECK(captureTrackName("") == "Capture");
|
||||
}
|
||||
|
||||
static void testCaptureTrackNameUnnamedSourceReadsAsCaptureTrackN() {
|
||||
// trackName's GetTrackName fallback rides in as an ordinary name.
|
||||
CHECK(captureTrackName("Track 7") == "Capture Track 7");
|
||||
}
|
||||
|
||||
static void testCaptureTrackNameDoesNotMatchAMerePrefixOfTheWord() {
|
||||
// "Captured" begins with "Capture" but not with "Capture " — it is a different
|
||||
// name and must be prefixed like any other.
|
||||
CHECK(captureTrackName("Captured drums") == "Capture Captured drums");
|
||||
}
|
||||
|
||||
int main() {
|
||||
testStampIsZeroPaddedMonthDayHourMinute();
|
||||
testUnsetStampProducesNoDiscriminator();
|
||||
@@ -268,6 +303,12 @@ int main() {
|
||||
testOrdinalAndMultiSourceCompose();
|
||||
testEveryAwkwardStemStaysFilesystemLegal();
|
||||
|
||||
testCaptureTrackNamePrefixesAPlainSourceName();
|
||||
testCaptureTrackNameIsIdempotent();
|
||||
testCaptureTrackNameEmptySourceHasNoTrailingSpace();
|
||||
testCaptureTrackNameUnnamedSourceReadsAsCaptureTrackN();
|
||||
testCaptureTrackNameDoesNotMatchAMerePrefixOfTheWord();
|
||||
|
||||
if (g_fail == 0) std::printf("capture_name: all tests passed\n");
|
||||
else std::printf("capture_name: %d CHECK(s) FAILED\n", g_fail);
|
||||
return g_fail ? 1 : 0;
|
||||
|
||||
Reference in New Issue
Block a user