OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_UnitTest.h>
Inherited by juce::HashMapTest, juce::dsp::AudioBlockUnitTests< SampleType >, juce::dsp::FFTUnitTest, juce::dsp::FIRFilterTest, juce::dsp::LinearAlgebraUnitTest, juce::dsp::LogRampedValueTests, and juce::dsp::SIMDRegisterUnitTests.
Static Public Member Functions | |
static Array< UnitTest * > & | getAllTests () |
static Array< UnitTest * > | getTestsInCategory (const String &category) |
static StringArray | getAllCategories () |
This is a base class for classes that perform a unit test.
To write a test using this class, your code should look something like this:
To run a test, use the UnitTestRunner class.
Definition at line 69 of file juce_UnitTest.h.
Creates a test with the given name and optionally places it in a category.
Definition at line 26 of file juce_UnitTest.cpp.
|
virtual |
Destructor.
Definition at line 32 of file juce_UnitTest.cpp.
Tells the system that a new subsection of tests is beginning. This should be called from your runTest() method, and may be called as many times as you like, to demarcate different sets of tests.
Definition at line 89 of file juce_UnitTest.cpp.
Checks that the result of a test is true, and logs this result.
In your runTest() method, you should call this method for each condition that you want to check, e.g.
If testResult is true, a pass is logged; if it's false, a failure is logged. If the failure message is specified, it will be written to the log if the test fails.
Definition at line 97 of file juce_UnitTest.cpp.
|
inline |
Compares a value to an expected value. If they are not equal, prints out a message containing the expected and actual values.
Definition at line 151 of file juce_UnitTest.h.
|
inline |
Checks whether a value is greater or equal to a comparison value. If this check fails, prints out a message containing the actual and comparison values.
Definition at line 191 of file juce_UnitTest.h.
|
inline |
Checks whether a value is greater than a comparison value. If this check fails, prints out a message containing the actual and comparison values.
Definition at line 171 of file juce_UnitTest.h.
|
inline |
Checks whether a value is less or equal to a comparison value. If this check fails, prints out a message containing the actual and comparison values.
Definition at line 201 of file juce_UnitTest.h.
|
inline |
Checks whether a value is less than a comparison value. If this check fails, prints out a message containing the actual and comparison values.
Definition at line 181 of file juce_UnitTest.h.
|
inline |
Checks whether a value is not equal to a comparison value. If this check fails, prints out a message containing the actual and comparison values.
Definition at line 161 of file juce_UnitTest.h.
|
inline |
Computes the difference between a value and a comparison value, and if it is larger than a specified maximum value, prints out a message containing the actual and comparison values and the maximum allowed error.
Definition at line 212 of file juce_UnitTest.h.
|
static |
Returns a StringArray containing all of the categories of UnitTests that have been registered.
Definition at line 57 of file juce_UnitTest.cpp.
Returns the set of all UnitTest objects that currently exist.
Definition at line 37 of file juce_UnitTest.cpp.
Referenced by getAllCategories(), getTestsInCategory(), juce::UnitTestRunner::runAllTests(), UnitTest(), and ~UnitTest().
Returns the category of the test.
Definition at line 83 of file juce_UnitTest.h.
Returns the name of the test.
Definition at line 80 of file juce_UnitTest.h.
Random juce::UnitTest::getRandom | ( | ) | const |
Returns a shared RNG that all unit tests should use. If a test needs random numbers, it's important that when an error is found, the exact circumstances can be re-created in order to re-test the problem, by repeating the test with the same random seed value. To make this possible, the UnitTestRunner class creates a master seed value for the run, writes this number to the log, and then this method returns a Random object based on that seed. All tests should only use this method to create any Random objects that they need.
Note that this method will return an identical object each time it's called for a given run, so if you need several different Random objects, the best way to do that is to call Random::combineSeed() on the result to permute it with a constant value.
Definition at line 108 of file juce_UnitTest.cpp.
Returns the set of UnitTests in a specified category.
Definition at line 43 of file juce_UnitTest.cpp.
Referenced by juce::UnitTestRunner::runTestsInCategory().
|
virtual |
You can optionally implement this method to set up your test. This method will be called before runTest().
Definition at line 68 of file juce_UnitTest.cpp.
Referenced by performTest().
Writes a message to the test log. This can only be called from within your runTest() method.
Definition at line 81 of file juce_UnitTest.cpp.
void juce::UnitTest::performTest | ( | UnitTestRunner * | runner | ) |
Runs the test, using the specified UnitTestRunner. You shouldn't need to call this method directly - use UnitTestRunner::runTests() instead.
Definition at line 71 of file juce_UnitTest.cpp.
Implement this method in your subclass to actually run your tests.
The content of your implementation should call beginTest() and expect() to perform the tests.
Referenced by performTest().
|
virtual |
You can optionally implement this method to clear up after your test has been run. This method will be called after runTest() has returned.
Definition at line 69 of file juce_UnitTest.cpp.
Referenced by performTest().