It is possible to run your own tests when the validator checks your plug-in.
First you have to register a test factory in your plugin factory:
#define DEF_CLASS2(cid, cardinality, category, name, classFlags, subCategories, version, sdkVersion, createMethod)
Definition: pluginfactory.h:159
#define END_FACTORY
Definition: pluginfactory.h:171
#define BEGIN_FACTORY_DEF(vendor, url, email)
Controller
MPE per note controller enumeration.
Definition: mpeprocessor.h:57
const FUID & getTestFactoryUID()
get the test factory class ID
FUnknown * createTestFactoryInstance(void *)
create a Test Factory instance
Second: write your tests:
#include "public.sdk/source/main/moduleinit.h"
static ModuleInitializer InitMyTests ([] () {
auto result = 2 + 2;
if (result == 4)
return true;
testResult->
addErrorMessage (STR (
"Unexpected universe change where 2+2 != 4."));
return false;
});
});
virtual void addErrorMessage(const char *msg)=0
void registerTest(FIDString name, const char *desc, const TestFunc &func)
register a simple test function
If you need access to your audio effect or edit controller you can write your tests as done in the adelay example:
#include "public.sdk/source/main/moduleinit.h"
static ModuleInitializer InitMyTests ([] () {
testResult)
{
if (auto plugProvider = U::cast<ITestPlugProvider> (context))
{
auto controller = plugProvider->getController ();
auto testController = U::cast<IDelayTestController> (controller);
if (!controller)
{
return false;
}
bool result = testController->doTest ();
plugProvider->releasePlugIn (nullptr, controller);
return (result);
}
return false;
});
});
After that recompile and if the validator does not run automatically after every build, start the validator manually and let it check your plug-in.