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:
DEF_CLASS2 (Your Plugin Processor)
"Test Factory", 0, "", "", "", createTestFactoryInstance)
END_FACTORY
Second: write your tests:
#include "public.sdk/source/main/moduleinit.h"
static ModuleInitializer InitMyTests ([] () {
registerTest ("MyTests", STR ("two plus two is four"), [] (ITestResult* testResult) {
auto result = 2 + 2;
if (result == 4)
return true;
testResult->addErrorMessage (STR ("Unexpected universe change where 2+2 != 4."));
return false;
});
});
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 ([] () {
registerTest ("MyTests", STR ("check one two three"), [] (FUnknown* context, ITestResult*
testResult)
{
FUnknownPtr<ITestPlugProvider> plugProvider (context);
if (plugProvider)
{
auto controller = plugProvider->getController ();
FUnknownPtr<IDelayTestController> testController (controller);
if (!controller)
{
testResult->addErrorMessage (String ("Unknown IEditController"));
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.