From c19f6f5a23905614eb4309f329b9b1f96b660d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 21 Jun 2026 22:37:57 +0200 Subject: [PATCH] Audio: the heck is this instanced test code. Seems like I wrote this even before I learned how to properly use my own APIs? --- src/Magnum/Audio/Test/ContextALTest.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Magnum/Audio/Test/ContextALTest.cpp b/src/Magnum/Audio/Test/ContextALTest.cpp index 63443fac1..c2845f2c7 100644 --- a/src/Magnum/Audio/Test/ContextALTest.cpp +++ b/src/Magnum/Audio/Test/ContextALTest.cpp @@ -54,6 +54,14 @@ struct ContextALTest: TestSuite::Tester { void isExtensionDisabled(); }; +const struct { + const char* log; + bool expected; +} QuietLogData[]{ + {"quiet", false}, + {"default", true} +}; + ContextALTest::ContextALTest(): TestSuite::Tester{TestSuite::Tester::TesterConfiguration{} .setSkippedArgumentPrefixes({"magnum"})} @@ -63,7 +71,8 @@ ContextALTest::ContextALTest(): &ContextALTest::constructDeviceNotFound, &ContextALTest::constructMove}); - addInstancedTests({&ContextALTest::quietLog}, 2); + addInstancedTests({&ContextALTest::quietLog}, + Containers::arraySize(QuietLogData)); addTests({&ContextALTest::ignoreUnrelatedOptions, &ContextALTest::extensionsString, @@ -190,15 +199,16 @@ void ContextALTest::constructMove() { } void ContextALTest::quietLog() { - setTestCaseDescription(testCaseInstanceId() ? "true" : "false"); + auto&& data = QuietLogData[testCaseInstanceId()]; + setTestCaseDescription(data.log); - const char* argv[] = { "", "--magnum-log", testCaseInstanceId() ? "quiet" : "default" }; + const char* argv[] = { "", "--magnum-log", data.log }; Containers::String out; Debug redirectOutput{&out}; /* MSVC 2015 and 2017 needs the int cast otherwise C2398 */ Context context{int(Containers::arraySize(argv)), argv}; - CORRADE_COMPARE(!out, bool(testCaseInstanceId())); + CORRADE_COMPARE(!!out, data.expected); } void ContextALTest::ignoreUnrelatedOptions() {