VST 3 SDK VST 3.7 SDK for developing VST plug-in

to use the validator to run your own tests?

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:

#include "public.sdk/source/vst/utility/testing.h"
BEGIN_FACTORY_DEF(...
DEF_CLASS2 (Your Plugin Processor)
DEF_CLASS2 (Your Plugin Controller)
DEF_CLASS2 (INLINE_UID_FROM_FUID (getTestFactoryUID ()), PClassInfo::kManyInstances, kTestClass,
"Test Factory", 0, "", "", "", createTestFactoryInstance)
END_FACTORY
DEF_CLASS2
#define DEF_CLASS2(cid, cardinality, category, name, classFlags, subCategories, version, sdkVersion, createMethod)
Definition: pluginfactory.h:159
END_FACTORY
#define END_FACTORY
Definition: pluginfactory.h:171
BEGIN_FACTORY_DEF
#define BEGIN_FACTORY_DEF(vendor, url, email)
Steinberg::Vst::MPE::Controller
Controller
MPE per note controller enumeration.
Definition: mpeprocessor.h:57
Steinberg::Vst::getTestFactoryUID
const FUID & getTestFactoryUID()
get the test factory class ID
Steinberg::Vst::createTestFactoryInstance
FUnknown * createTestFactoryInstance(void *)
create a Test Factory instance
Steinberg::PClassInfo::kManyInstances
kManyInstances
testing.h

Second: write your tests:

#include "public.sdk/source/main/moduleinit.h"
#include "public.sdk/source/vst/utility/testing.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;
});
});
Steinberg::ITestResult
Steinberg::ITestResult::addErrorMessage
virtual void addErrorMessage(const char *msg)=0
Steinberg::Vst::registerTest
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"
#include "public.sdk/source/vst/testsuite/vsttestsuite.h"
#include "public.sdk/source/vst/utility/testing.h"
static ModuleInitializer InitMyTests ([] () {
registerTest ("MyTests", STR ("check one two three"), [] (FUnknown* context, ITestResult*
testResult)
{
if (auto plugProvider = U::cast<ITestPlugProvider> (context))
{
auto controller = plugProvider->getController ();
auto testController = U::cast<IDelayTestController> (controller);
if (!controller)
{
testResult->addErrorMessage (String ("Unknown IEditController"));
return false;
}
bool result = testController->doTest ();
plugProvider->releasePlugIn (nullptr, controller);
return (result);
}
return false;
});
});
Steinberg::FUnknown
vsttestsuite.h

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.

Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.