mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Merge develop into midi2
This commit is contained in:
commit
10b1cfaa31
181 changed files with 3005 additions and 2154 deletions
|
|
@ -50,6 +50,7 @@ target_compile_definitions(UnitTestRunner PRIVATE
|
|||
target_link_libraries(UnitTestRunner PRIVATE
|
||||
juce::juce_analytics
|
||||
juce::juce_audio_utils
|
||||
juce::juce_build_tools
|
||||
juce::juce_dsp
|
||||
juce::juce_midi_ci
|
||||
juce::juce_opengl
|
||||
|
|
|
|||
|
|
@ -60,15 +60,27 @@ class ConsoleUnitTestRunner final : public UnitTestRunner
|
|||
//==============================================================================
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
constexpr auto helpOption = "--help|-h";
|
||||
constexpr auto listOption = "--list-categories|-l";
|
||||
constexpr auto categoryOption = "--category|-c";
|
||||
constexpr auto seedOption = "--seed|-s";
|
||||
constexpr auto nameOption = "--name|-n";
|
||||
|
||||
ArgumentList args (argc, argv);
|
||||
|
||||
if (args.containsOption ("--help|-h"))
|
||||
if (args.containsOption (helpOption))
|
||||
{
|
||||
std::cout << argv[0] << " [--help|-h] [--list-categories] [--category=category] [--seed=seed]" << std::endl;
|
||||
std::cout << argv[0]
|
||||
<< " [" << helpOption << "]"
|
||||
<< " [" << listOption << "]"
|
||||
<< " [" << categoryOption << "=category]"
|
||||
<< " [" << seedOption << "=seed]"
|
||||
<< " [" << nameOption << "=name]"
|
||||
<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.containsOption ("--list-categories"))
|
||||
if (args.containsOption (listOption))
|
||||
{
|
||||
for (auto& category : UnitTest::getAllCategories())
|
||||
std::cout << category << std::endl;
|
||||
|
|
@ -79,13 +91,19 @@ int main (int argc, char **argv)
|
|||
ConsoleLogger logger;
|
||||
Logger::setCurrentLogger (&logger);
|
||||
|
||||
const ScopeGuard onExit { [&]
|
||||
{
|
||||
Logger::setCurrentLogger (nullptr);
|
||||
DeletedAtShutdown::deleteAll();
|
||||
}};
|
||||
|
||||
ConsoleUnitTestRunner runner;
|
||||
|
||||
auto seed = [&args]
|
||||
const auto seed = std::invoke ([&]
|
||||
{
|
||||
if (args.containsOption ("--seed"))
|
||||
if (args.containsOption (seedOption))
|
||||
{
|
||||
auto seedValueString = args.getValueForOption ("--seed");
|
||||
auto seedValueString = args.getValueForOption (seedOption);
|
||||
|
||||
if (seedValueString.startsWith ("0x"))
|
||||
return seedValueString.getHexValue64();
|
||||
|
|
@ -94,10 +112,12 @@ int main (int argc, char **argv)
|
|||
}
|
||||
|
||||
return Random::getSystemRandom().nextInt64();
|
||||
}();
|
||||
});
|
||||
|
||||
if (args.containsOption ("--category"))
|
||||
runner.runTestsInCategory (args.getValueForOption ("--category"), seed);
|
||||
if (args.containsOption (categoryOption))
|
||||
runner.runTestsInCategory (args.getValueForOption (categoryOption), seed);
|
||||
else if (args.containsOption (nameOption))
|
||||
runner.runTestsWithName (args.getValueForOption (nameOption), seed);
|
||||
else
|
||||
runner.runAllTests (seed);
|
||||
|
||||
|
|
@ -108,24 +128,28 @@ int main (int argc, char **argv)
|
|||
auto* result = runner.getResult (i);
|
||||
|
||||
if (result->failures > 0)
|
||||
failures.push_back (result->unitTestName + " / " + result->subcategoryName + ": " + String (result->failures) + " test failure" + (result->failures > 1 ? "s" : ""));
|
||||
{
|
||||
const auto testName = result->unitTestName + " / " + result->subcategoryName;
|
||||
const auto testSummary = String (result->failures) + " test failure" + (result->failures > 1 ? "s" : "");
|
||||
const auto newLineAndTab = newLine + "\t";
|
||||
|
||||
failures.push_back (testName + ": " + testSummary + newLineAndTab
|
||||
+ result->messages.joinIntoString (newLineAndTab));
|
||||
}
|
||||
}
|
||||
|
||||
logger.writeToLog (newLine + String::repeatedString ("-", 65));
|
||||
|
||||
if (! failures.empty())
|
||||
{
|
||||
logger.writeToLog (newLine + "Test failure summary:" + newLine);
|
||||
logger.writeToLog ("Test failure summary:");
|
||||
|
||||
for (const auto& failure : failures)
|
||||
logger.writeToLog (failure);
|
||||
logger.writeToLog (newLine + failure);
|
||||
|
||||
Logger::setCurrentLogger (nullptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
logger.writeToLog (newLine + "All tests completed successfully");
|
||||
Logger::setCurrentLogger (nullptr);
|
||||
|
||||
DeletedAtShutdown::deleteAll();
|
||||
|
||||
logger.writeToLog ("All tests completed successfully");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue