108 virtual void initialise();
113 virtual void shutdown();
154 template <
class ValueType>
164 template <
class ValueType>
174 template <
class ValueType>
184 template <
class ValueType>
194 template <
class ValueType>
204 template <
class ValueType>
215 template <
class ValueType>
226 #define expectDoesNotThrow(expr) \
234 expect (false, "Expected: does not throw an exception, Actual: throws."); \
238 #define expectThrows(expr) \
242 expect (false, "Expected: throws an exception, Actual: does not throw."); \
250 #define expectThrowsType(expr, type) \
254 expect (false, "Expected: throws an exception of type " #type ", Actual: does not throw."); \
262 expect (false, "Expected: throws an exception of type " #type ", Actual: throws another type."); \
269 void logMessage (
const String& message);
289 template <
class ValueType>
300 <<
", Actual value: " << value;
303 expect (result, failureMessage);
307 const String name, category;
308 UnitTestRunner* runner =
nullptr;
310 JUCE_DECLARE_NON_COPYABLE (UnitTest)
422 virtual bool shouldAbortTests();
429 String currentSubCategory;
431 bool assertOnFailure =
true, logPasses =
false;
Holds a resizable array of primitive or copy-by-value objects.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
An array designed for holding objects.
A random number generator.
A special array for holding a list of strings.
Runs a set of unit tests.
This is a base class for classes that perform a unit test.
const String & getName() const noexcept
Returns the name of the test.
const String & getCategory() const noexcept
Returns the category of the test.
void expectEquals(ValueType actual, ValueType expected, String failureMessage=String())
Compares a value to an expected value.
void expectGreaterThan(ValueType value, ValueType valueToCompareTo, String failureMessage=String())
Checks whether a value is greater than a comparison value.
void expectWithinAbsoluteError(ValueType actual, ValueType expected, ValueType maxAbsoluteError, String failureMessage=String())
Computes the difference between a value and a comparison value, and if it is larger than a specified ...
virtual void runTest()=0
Implement this method in your subclass to actually run your tests.
void expectLessThan(ValueType value, ValueType valueToCompareTo, String failureMessage=String())
Checks whether a value is less than a comparison value.
void expectLessOrEqual(ValueType value, ValueType valueToCompareTo, String failureMessage=String())
Checks whether a value is less or equal to a comparison value.
void expectNotEquals(ValueType value, ValueType valueToCompareTo, String failureMessage=String())
Checks whether a value is not equal to a comparison value.
void expectGreaterOrEqual(ValueType value, ValueType valueToCompareTo, String failureMessage=String())
Checks whether a value is greater or equal to a comparison value.
#define JUCE_API
This macro is added to all JUCE public class declarations.
int failures
The number of UnitTest::expect() calls that failed.
StringArray messages
A list of messages describing the failed tests.
String unitTestName
The main name of this test (i.e.
String subcategoryName
The name of the current subcategory (i.e.
int passes
The number of UnitTest::expect() calls that succeeded.
Contains the results of a test.