mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Removed ScopedJuceInitialiser_GUI from UnitTestRunner and added a --seed command-line option for specifying the random seed to be used for the tests
This commit is contained in:
parent
497a1b3fb7
commit
fc392ee3a5
1 changed files with 20 additions and 25 deletions
|
|
@ -52,39 +52,34 @@ class ConsoleUnitTestRunner : public UnitTestRunner
|
|||
//==============================================================================
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
// Needed for tests that require a message thread
|
||||
ScopedJuceInitialiser_GUI guiInitialiser;
|
||||
ArgumentList args (argc, argv);
|
||||
|
||||
if (args.containsOption ("--help|-h"))
|
||||
{
|
||||
std::cout << argv[0] << " [--help|-h] [--list-categories] [--category category] [--seed seed]" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.containsOption ("--list-categories"))
|
||||
{
|
||||
for (auto& category : UnitTest::getAllCategories())
|
||||
std::cout << category << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ConsoleLogger logger;
|
||||
Logger::setCurrentLogger (&logger);
|
||||
|
||||
ConsoleUnitTestRunner runner;
|
||||
|
||||
ArgumentList args (argc, argv);
|
||||
auto seed = (args.containsOption ("--seed") ? args.getValueForOption ("--seed").getLargeIntValue()
|
||||
: Random::getSystemRandom().nextInt64());
|
||||
|
||||
if (args.size() == 0)
|
||||
{
|
||||
runner.runAllTests();
|
||||
}
|
||||
if (args.containsOption ("--category"))
|
||||
runner.runTestsInCategory (args.getValueForOption ("--category"), seed);
|
||||
else
|
||||
{
|
||||
if (args.containsOption ("--help|-h"))
|
||||
{
|
||||
std::cout << argv[0] << " [--help|-h] [--category category] [--list-categories]" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.containsOption ("--list-categories"))
|
||||
{
|
||||
for (auto& category : UnitTest::getAllCategories())
|
||||
std::cout << category << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.containsOption ("--category"))
|
||||
runner.runTestsInCategory (args.getValueForOption ("--category"));
|
||||
}
|
||||
runner.runAllTests (seed);
|
||||
|
||||
Logger::setCurrentLogger (nullptr);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue