Mercurial > hg > vamp-plugin-tester
changeset 53:86d8a699dfbe
Don't object if two consecutive runs produce the same output, if neither has timestamps anyway
author | Chris Cannam |
---|---|
date | Fri, 12 Sep 2014 21:58:45 +0100 |
parents | 4bd0cd3c60f3 |
children | 314eea778b80 |
files | Test.cpp Test.h TestMultipleRuns.cpp |
diffstat | 3 files changed, 31 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Test.cpp Fri Sep 12 18:05:52 2014 +0100 +++ b/Test.cpp Fri Sep 12 21:58:45 2014 +0100 @@ -175,6 +175,22 @@ return true; } +bool +Test::containsTimestamps(const Plugin::FeatureSet &b) +{ + for (Plugin::FeatureSet::const_iterator i = b.begin(); i != b.end(); ++i) { + for (int j = 0; j < (int)i->second.size(); ++j) { + if (i->second[j].values.empty()) continue; + for (int k = 0; k < (int)i->second[j].values.size(); ++k) { + if (i->second[j].hasTimestamp) { + return true; + } + } + } + } + return false; +} + void Test::dumpFeature(const Plugin::Feature &f, bool showValues) {
--- a/Test.h Fri Sep 12 18:05:52 2014 +0100 +++ b/Test.h Fri Sep 12 21:58:45 2014 +0100 @@ -110,6 +110,8 @@ bool allFeaturesValid(const Vamp::Plugin::FeatureSet &); // i.e. no NaN/inf + bool containsTimestamps(const Vamp::Plugin::FeatureSet &); + void dumpFeature(const Vamp::Plugin::Feature &, bool showValues); void dump(const Vamp::Plugin::FeatureSet &, bool showValues = true); void dumpTwo(const Result &r,
--- a/TestMultipleRuns.cpp Fri Sep 12 18:05:52 2014 +0100 +++ b/TestMultipleRuns.cpp Fri Sep 12 21:58:45 2014 +0100 @@ -246,13 +246,20 @@ if (data) destroyTestAudio(data, channels); if (f[0] == f[1]) { - string message = "Consecutive runs with different starting timestamps produce the same result"; Result res; - if (options & NonDeterministic) res = note(message); - else res = warning(message); - if (options & Verbose) { - cout << message << endl; - dump(f[0], false); + if (containsTimestamps(f[0])) { + string message = "Consecutive runs with different starting timestamps produce the same result"; + if (options & NonDeterministic) { + res = note(message); + } else { + res = warning(message); + } + if (options & Verbose) { + cout << res.message() << endl; + dump(f[0], false); + } + } else { + res = note("Consecutive runs with different starting timestamps produce the same result (but result features contain no timestamps, so this is probably all right)"); } r.push_back(res); } else {