The ./test folder contains a unit test program and test-support classes.
In general most of this software is fairly unremarkable code that supports unit testing of the various parts of our plugins.
We find that reasonably thorough unit testing is even more valuable for plugins than for “normal” code. Some of the reasons are:
This last point is very important, as one of the basic rules of code optimization is that a programmers intuition (guess) as to where the bottlenecks are is remarkably unreliable – you must drive your optimizations from real data. For example, we discovered that over half the CPU time in our vocal filter was in evaluating assertions!
As stated above, much of the test code is unremarkable, other than its existence. There are a couple of modules however that might be useful to others.
MeasureTime is used to measure the CPU usage of any arbitrary code. It takes a simple lambda and profiles it.
Composite pattern allows us to run our plugin code inside a test application as well as inside a VCV Track plugin module.
Assert Library is a very basic collection of assertion macros loosely based on the Chai Assert framework.
We have enhanced Makefile in several useful ways with the addition of test.mk:
make
will generate a plugin with assertions disabled.make test
will generate test.exe, our unit test application, with asserts enabled.make perf
will generate perf.exe, our unit test application, with asserts disabled.make cleantest
is like make clean
, but for out test code.