Array<UnitTest*> UnitTest::getTestsInCategory (const String& category) { if (category.isEmpty()) return getAllTests(); Array<UnitTest*> unitTests; for (auto* test : getAllTests()) if (test->getCategory() == category) unitTests.add (test); return unitTests; }
UnitTest::UnitTest (String const& className, String const& packageName, When when) : m_className (className.removeCharacters (" ")) , m_packageName (packageName.removeCharacters (" ")) , m_when (when) , m_runner (nullptr) { getAllTests().add (this); }
StringArray UnitTest::getAllCategories() { StringArray categories; for (auto* test : getAllTests()) if (test->getCategory().isNotEmpty()) categories.addIfNotAlreadyThere (test->getCategory()); return categories; }
BEGIN_JUCE_NAMESPACE #include "juce_UnitTest.h" #include "../threads/juce_ScopedLock.h" //============================================================================== UnitTest::UnitTest (const String& name_) : name (name_), runner (0) { getAllTests().add (this); }
UnitTest::~UnitTest() { getAllTests().removeFirstMatchingValue (this); }
UnitTest::UnitTest (const String& nm) : name (nm), runner (nullptr) { getAllTests().add (this); }
UnitTest::~UnitTest() { getAllTests().removeValue (this); }
UnitTest::UnitTest (const String& nm, const String& ctg) : name (nm), category (ctg) { getAllTests().add (this); }