Revision 2:c9a4bd247497 TestInputExtremes.cpp
| TestInputExtremes.cpp | ||
|---|---|---|
| 45 | 45 |
#include <memory> |
| 46 | 46 |
using namespace std; |
| 47 | 47 |
|
| 48 |
#include <cstdlib> |
|
| 48 | 49 |
#include <cmath> |
| 49 | 50 |
|
| 50 | 51 |
Tester::TestRegistrar<TestNormalInput> |
| ... | ... | |
| 68 | 69 |
Test::Results |
| 69 | 70 |
TestNormalInput::test(string key) |
| 70 | 71 |
{
|
| 72 |
Plugin::FeatureSet f; |
|
| 71 | 73 |
int rate = 44100; |
| 72 | 74 |
auto_ptr<Plugin> p(load(key, rate)); |
| 73 | 75 |
Results r; |
| ... | ... | |
| 83 | 85 |
++idx; |
| 84 | 86 |
} |
| 85 | 87 |
RealTime timestamp = RealTime::frame2RealTime(idx, rate); |
| 86 |
p->process(block, timestamp); |
|
| 88 |
Plugin::FeatureSet fs = p->process(block, timestamp); |
|
| 89 |
appendFeatures(f, fs); |
|
| 87 | 90 |
} |
| 88 | 91 |
destroyBlock(block, channels); |
| 89 | 92 |
Plugin::FeatureSet fs = p->getRemainingFeatures(); |
| 90 |
if (allFeaturesValid(fs)) {
|
|
| 93 |
appendFeatures(f, fs); |
|
| 94 |
if (allFeaturesValid(f)) {
|
|
| 91 | 95 |
r.push_back(success()); |
| 92 | 96 |
} else {
|
| 93 | 97 |
r.push_back(warning("plugin returned one or more NaN/inf values"));
|
| ... | ... | |
| 114 | 118 |
Test::Results |
| 115 | 119 |
TestShortInput::test(string key) |
| 116 | 120 |
{
|
| 121 |
Plugin::FeatureSet f; |
|
| 117 | 122 |
int rate = 44100; |
| 118 | 123 |
auto_ptr<Plugin> p(load(key, rate)); |
| 119 | 124 |
Results r; |
| ... | ... | |
| 127 | 132 |
} |
| 128 | 133 |
++idx; |
| 129 | 134 |
} |
| 130 |
p->process(block, RealTime::zeroTime); |
|
| 135 |
Plugin::FeatureSet fs = p->process(block, RealTime::zeroTime); |
|
| 136 |
appendFeatures(f, fs); |
|
| 131 | 137 |
destroyBlock(block, channels); |
| 132 |
Plugin::FeatureSet fs = p->getRemainingFeatures(); |
|
| 133 |
if (allFeaturesValid(fs)) {
|
|
| 138 |
fs = p->getRemainingFeatures(); |
|
| 139 |
appendFeatures(f, fs); |
|
| 140 |
if (allFeaturesValid(f)) {
|
|
| 134 | 141 |
r.push_back(success()); |
| 135 | 142 |
} else {
|
| 136 | 143 |
r.push_back(warning("plugin returned one or more NaN/inf values"));
|
| ... | ... | |
| 141 | 148 |
Test::Results |
| 142 | 149 |
TestSilentInput::test(string key) |
| 143 | 150 |
{
|
| 151 |
Plugin::FeatureSet f; |
|
| 144 | 152 |
int rate = 44100; |
| 145 | 153 |
auto_ptr<Plugin> p(load(key, rate)); |
| 146 | 154 |
Results r; |
| ... | ... | |
| 154 | 162 |
} |
| 155 | 163 |
for (int i = 0; i < 200; ++i) {
|
| 156 | 164 |
RealTime timestamp = RealTime::frame2RealTime(i * blocksize, rate); |
| 157 |
p->process(block, timestamp); |
|
| 165 |
Plugin::FeatureSet fs = p->process(block, timestamp); |
|
| 166 |
appendFeatures(f, fs); |
|
| 158 | 167 |
} |
| 159 | 168 |
destroyBlock(block, channels); |
| 160 | 169 |
Plugin::FeatureSet fs = p->getRemainingFeatures(); |
| 161 |
if (allFeaturesValid(fs)) {
|
|
| 170 |
appendFeatures(f, fs); |
|
| 171 |
if (allFeaturesValid(f)) {
|
|
| 162 | 172 |
r.push_back(success()); |
| 163 | 173 |
} else {
|
| 164 | 174 |
r.push_back(warning("plugin returned one or more NaN/inf values"));
|
| ... | ... | |
| 169 | 179 |
Test::Results |
| 170 | 180 |
TestTooLoudInput::test(string key) |
| 171 | 181 |
{
|
| 182 |
Plugin::FeatureSet f; |
|
| 172 | 183 |
int rate = 44100; |
| 173 | 184 |
auto_ptr<Plugin> p(load(key, rate)); |
| 174 | 185 |
Results r; |
| ... | ... | |
| 184 | 195 |
++idx; |
| 185 | 196 |
} |
| 186 | 197 |
RealTime timestamp = RealTime::frame2RealTime(idx, rate); |
| 187 |
p->process(block, timestamp); |
|
| 198 |
Plugin::FeatureSet fs = p->process(block, timestamp); |
|
| 199 |
appendFeatures(f, fs); |
|
| 188 | 200 |
} |
| 189 | 201 |
destroyBlock(block, channels); |
| 190 | 202 |
Plugin::FeatureSet fs = p->getRemainingFeatures(); |
| 191 |
if (allFeaturesValid(fs)) {
|
|
| 203 |
appendFeatures(f, fs); |
|
| 204 |
if (allFeaturesValid(f)) {
|
|
| 192 | 205 |
r.push_back(success()); |
| 193 | 206 |
} else {
|
| 194 | 207 |
r.push_back(warning("plugin returned one or more NaN/inf values"));
|
| ... | ... | |
| 199 | 212 |
Test::Results |
| 200 | 213 |
TestRandomInput::test(string key) |
| 201 | 214 |
{
|
| 215 |
Plugin::FeatureSet f; |
|
| 202 | 216 |
int rate = 44100; |
| 203 | 217 |
auto_ptr<Plugin> p(load(key, rate)); |
| 204 | 218 |
Results r; |
| ... | ... | |
| 214 | 228 |
++idx; |
| 215 | 229 |
} |
| 216 | 230 |
RealTime timestamp = RealTime::frame2RealTime(idx, rate); |
| 217 |
p->process(block, timestamp); |
|
| 231 |
Plugin::FeatureSet fs = p->process(block, timestamp); |
|
| 232 |
appendFeatures(f, fs); |
|
| 218 | 233 |
} |
| 219 | 234 |
destroyBlock(block, channels); |
| 220 | 235 |
Plugin::FeatureSet fs = p->getRemainingFeatures(); |
| 221 |
if (allFeaturesValid(fs)) {
|
|
| 236 |
appendFeatures(f, fs); |
|
| 237 |
if (allFeaturesValid(f)) {
|
|
| 222 | 238 |
r.push_back(success()); |
| 223 | 239 |
} else {
|
| 224 | 240 |
r.push_back(warning("plugin returned one or more NaN/inf values"));
|
Also available in: Unified diff