Revision 23:28097c1b3de4
| Test.cpp | ||
|---|---|---|
| 52 | 52 |
Plugin * |
| 53 | 53 |
Test::load(std::string key, float rate) |
| 54 | 54 |
{
|
| 55 |
return PluginLoader::getInstance()->loadPlugin
|
|
| 55 |
Plugin *p = PluginLoader::getInstance()->loadPlugin
|
|
| 56 | 56 |
(key, rate, PluginLoader::ADAPT_ALL); |
| 57 |
if (!p) throw FailedToLoadPlugin(); |
|
| 58 |
return p; |
|
| 57 | 59 |
} |
| 58 | 60 |
|
| 59 | 61 |
float ** |
| TestDefaults.cpp | ||
|---|---|---|
| 118 | 118 |
Plugin::ParameterList pl = p->getParameterDescriptors(); |
| 119 | 119 |
for (int i = 0; i < (int)pl.size(); ++i) {
|
| 120 | 120 |
if (p->getParameter(pl[i].identifier) != pl[i].defaultValue) {
|
| 121 |
if (options & Verbose) {
|
|
| 122 |
cout << "Parameter: " << pl[i].identifier << endl; |
|
| 123 |
cout << "Expected: " << pl[i].defaultValue << endl; |
|
| 124 |
cout << "Actual: " << p->getParameter(pl[i].identifier) << endl; |
|
| 125 |
} |
|
| 121 | 126 |
r.push_back(error("Not all parameters have their default values when queried directly after construction"));
|
| 122 | 127 |
} |
| 123 | 128 |
p->setParameter(pl[i].identifier, pl[i].defaultValue); |
| TestInitialise.cpp | ||
|---|---|---|
| 59 | 59 |
static const size_t _step = 1000; |
| 60 | 60 |
|
| 61 | 61 |
Test::Results |
| 62 |
TestSampleRates::test(string key, Options) |
|
| 62 |
TestSampleRates::test(string key, Options options)
|
|
| 63 | 63 |
{
|
| 64 | 64 |
int rates[] = |
| 65 | 65 |
{ 1, 800, 10099, 11024, 44100, 48000, 96000, 192000, 201011, 1094091 };
|
| 66 | 66 |
|
| 67 | 67 |
Results r; |
| 68 | 68 |
|
| 69 |
if (options & Verbose) {
|
|
| 70 |
cout << " "; |
|
| 71 |
} |
|
| 72 |
|
|
| 69 | 73 |
for (int i = 0; i < int(sizeof(rates)/sizeof(rates[0])); ++i) {
|
| 70 | 74 |
|
| 71 | 75 |
int rate = rates[i]; |
| 76 |
|
|
| 77 |
if (options & Verbose) {
|
|
| 78 |
cout << "[" << rate << "Hz] " << flush; |
|
| 79 |
} |
|
| 80 |
|
|
| 72 | 81 |
auto_ptr<Plugin> p(load(key, rate)); |
| 73 | 82 |
Plugin::FeatureSet f; |
| 74 | 83 |
float **data = 0; |
| 75 | 84 |
size_t channels = 0; |
| 76 | 85 |
size_t count = 100; |
| 77 | 86 |
|
| 78 |
if (!initAdapted(p.get(), channels, _step, _step, r)) continue; |
|
| 87 |
Results subr; |
|
| 88 |
if (!initAdapted(p.get(), channels, _step, _step, subr)) {
|
|
| 89 |
// This is not an error; the plugin can legitimately |
|
| 90 |
// refuse to initialise at weird settings and that's often |
|
| 91 |
// the most acceptable result |
|
| 92 |
if (!subr.empty()) {
|
|
| 93 |
r.push_back(note(subr.begin()->message())); |
|
| 94 |
} |
|
| 95 |
continue; |
|
| 96 |
} |
|
| 79 | 97 |
|
| 80 | 98 |
data = createTestAudio(channels, _step, count); |
| 81 | 99 |
for (size_t i = 0; i < count; ++i) {
|
| ... | ... | |
| 91 | 109 |
destroyTestAudio(data, channels); |
| 92 | 110 |
} |
| 93 | 111 |
|
| 112 |
if (options & Verbose) cout << endl; |
|
| 113 |
|
|
| 94 | 114 |
// We can't actually do anything meaningful with our results. |
| 95 | 115 |
// We're really just testing to see whether the plugin crashes. I |
| 96 | 116 |
// wonder whether it's possible to do any better? If not, we |
Also available in: Unified diff