Mercurial > hg > vamp-plugin-tester
changeset 4:d8724c5a6d83
* numbering and clearer output
author | cannam |
---|---|
date | Tue, 17 Mar 2009 17:11:35 +0000 |
parents | 0f65bb22172b |
children | 6a279da6fdd7 |
files | Test.h TestInputExtremes.cpp TestMultipleRuns.cpp TestOutputs.cpp TestStaticData.cpp Tester.cpp Tester.h vamp-plugin-tester.cpp |
diffstat | 8 files changed, 62 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/Test.h Tue Mar 17 16:38:47 2009 +0000 +++ b/Test.h Tue Mar 17 17:11:35 2009 +0000 @@ -88,9 +88,11 @@ float **createTestAudio(size_t channels, size_t blocksize, size_t blocks); void destroyTestAudio(float **audio, size_t channels); + // use plugin's preferred step/block size, return them: bool initDefaults(Vamp::Plugin *, size_t &channels, size_t &step, size_t &block, Results &r); + // use the given step/block size and an adapter: bool initAdapted(Vamp::Plugin *, size_t &channels, size_t step, size_t block, Results &r);
--- a/TestInputExtremes.cpp Tue Mar 17 16:38:47 2009 +0000 +++ b/TestInputExtremes.cpp Tue Mar 17 17:11:35 2009 +0000 @@ -49,22 +49,22 @@ #include <cmath> Tester::TestRegistrar<TestNormalInput> -TestNormalInput::m_registrar("Normal input"); +TestNormalInput::m_registrar("C1 Normal input"); Tester::TestRegistrar<TestNoInput> -TestNoInput::m_registrar("Empty input"); +TestNoInput::m_registrar("C2 Empty input"); Tester::TestRegistrar<TestShortInput> -TestShortInput::m_registrar("Short input"); +TestShortInput::m_registrar("C3 Short input"); Tester::TestRegistrar<TestSilentInput> -TestSilentInput::m_registrar("Absolutely silent input"); +TestSilentInput::m_registrar("C4 Absolutely silent input"); Tester::TestRegistrar<TestTooLoudInput> -TestTooLoudInput::m_registrar("Input beyond expected +/-1 range"); +TestTooLoudInput::m_registrar("C5 Input beyond expected +/-1 range"); Tester::TestRegistrar<TestRandomInput> -TestRandomInput::m_registrar("Random input"); +TestRandomInput::m_registrar("C6 Random input"); Test::Results TestNormalInput::test(string key)
--- a/TestMultipleRuns.cpp Tue Mar 17 16:38:47 2009 +0000 +++ b/TestMultipleRuns.cpp Tue Mar 17 17:11:35 2009 +0000 @@ -48,13 +48,13 @@ #include <cmath> Tester::TestRegistrar<TestDistinctRuns> -TestDistinctRuns::m_registrar("Consecutive runs with separate instances"); +TestDistinctRuns::m_registrar("D1 Consecutive runs with separate instances"); Tester::TestRegistrar<TestReset> -TestReset::m_registrar("Consecutive runs with a single instance using reset"); +TestReset::m_registrar("D2 Consecutive runs with a single instance using reset"); Tester::TestRegistrar<TestInterleavedRuns> -TestInterleavedRuns::m_registrar("Simultaneous interleaved runs in a single thread"); +TestInterleavedRuns::m_registrar("D3 Simultaneous interleaved runs in a single thread"); static const size_t _step = 1000;
--- a/TestOutputs.cpp Tue Mar 17 16:38:47 2009 +0000 +++ b/TestOutputs.cpp Tue Mar 17 17:11:35 2009 +0000 @@ -40,7 +40,9 @@ #include "TestOutputs.h" #include <vamp-hostsdk/Plugin.h> +#include <vamp-hostsdk/PluginLoader.h> using namespace Vamp; +using namespace Vamp::HostExt; #include <set> #include <memory> @@ -49,10 +51,10 @@ #include <cmath> Tester::TestRegistrar<TestOutputNumbers> -TestOutputNumbers::m_registrar("Output number mismatching"); +TestOutputNumbers::m_registrar("B1 Output number mismatching"); Tester::TestRegistrar<TestTimestamps> -TestTimestamps::m_registrar("Invalid or dubious timestamp usage"); +TestTimestamps::m_registrar("B2 Invalid or dubious timestamp usage"); static const size_t _step = 1000; @@ -87,13 +89,14 @@ i != fs.end(); ++i) { int o = i->first; used.insert(o); - if (o < 0 || o >= outputs.size()) { + if (o < 0 || o >= (int)outputs.size()) { r.push_back(error("Data returned on nonexistent output")); } } - for (int o = 0; o < outputs.size(); ++o) { + for (int o = 0; o < (int)outputs.size(); ++o) { if (used.find(o) == used.end()) { - r.push_back(note("No results returned for one or more outputs")); } + r.push_back(note("No results returned for one or more outputs")); + } } return r; @@ -103,7 +106,11 @@ TestTimestamps::test(string key) { int rate = 44100; - auto_ptr<Plugin> p(load(key, rate)); + + // we want to be sure that a buffer size adapter is not used: + auto_ptr<Plugin> p(PluginLoader::getInstance()->loadPlugin + (key, rate, PluginLoader::ADAPT_ALL_SAFE)); + Plugin::FeatureSet f; Results r; float **data = 0; @@ -111,7 +118,6 @@ size_t step = 0, block = 0; size_t count = 100; - //!!! want to ensure buffer size adapter is not used: if (!initDefaults(p.get(), channels, step, block, r)) return r; if (!data) data = createTestAudio(channels, block, count); for (size_t i = 0; i < count; ++i) {
--- a/TestStaticData.cpp Tue Mar 17 16:38:47 2009 +0000 +++ b/TestStaticData.cpp Tue Mar 17 17:11:35 2009 +0000 @@ -48,13 +48,13 @@ #include <cmath> Tester::TestRegistrar<TestIdentifiers> -TestIdentifiers::m_registrar("Invalid identifiers"); +TestIdentifiers::m_registrar("A1 Invalid identifiers"); Tester::TestRegistrar<TestEmptyFields> -TestEmptyFields::m_registrar("Empty metadata fields"); +TestEmptyFields::m_registrar("A2 Empty metadata fields"); Tester::TestRegistrar<TestValueRanges> -TestValueRanges::m_registrar("Inappropriate value extents"); +TestValueRanges::m_registrar("A3 Inappropriate value extents"); Test::Results TestIdentifiers::test(string key)
--- a/Tester.cpp Tue Mar 17 16:38:47 2009 +0000 +++ b/Tester.cpp Tue Mar 17 17:11:35 2009 +0000 @@ -46,6 +46,7 @@ #include <cstring> #include <cstdlib> #include <cmath> +#include <set> #include "Tester.h" @@ -75,7 +76,7 @@ } bool -Tester::test() +Tester::test(int ¬es, int &warnings, int &errors) { /* @@ -152,19 +153,27 @@ Test *test = i->second->makeTest(); Test::Results results = test->test(m_key); delete test; + + set<string> printed; for (int j = 0; j < (int)results.size(); ++j) { + string message = results[j].message(); + if (printed.find(message) != printed.end()) continue; + printed.insert(message); switch (results[j].code()) { case Test::Result::Success: break; case Test::Result::Note: std::cout << " ** NOTE: " << results[j].message() << std::endl; + ++notes; break; case Test::Result::Warning: std::cout << " ** WARNING: " << results[j].message() << std::endl; + ++warnings; break; case Test::Result::Error: std::cout << " ** ERROR: " << results[j].message() << std::endl; + ++errors; good = false; break; }
--- a/Tester.h Tue Mar 17 16:38:47 2009 +0000 +++ b/Tester.h Tue Mar 17 17:11:35 2009 +0000 @@ -50,7 +50,7 @@ Tester(std::string pluginKey); ~Tester(); - bool test(); + bool test(int ¬es, int &warnings, int &errors); class Registrar { public:
--- a/vamp-plugin-tester.cpp Tue Mar 17 16:38:47 2009 +0000 +++ b/vamp-plugin-tester.cpp Tue Mar 17 17:11:35 2009 +0000 @@ -86,10 +86,11 @@ bool good = true; Vamp::HostExt::PluginLoader::PluginKeyList keys = Vamp::HostExt::PluginLoader::getInstance()->listPlugins(); + int notes = 0, warnings = 0, errors = 0; for (int i = 0; i < (int)keys.size(); ++i) { cout << "Testing plugin: " << keys[i] << endl; Tester tester(keys[i]); - if (tester.test()) { + if (tester.test(notes, warnings, errors)) { cout << name << ": All tests succeeded for this plugin" << endl; } else { cout << name << ": Some tests failed for this plugin" << endl; @@ -98,7 +99,16 @@ cout << endl; } if (good) { - cout << name << ": All tests succeeded" << endl; + cout << name << ": All tests succeeded"; + if (warnings > 0) { + cout << ", with " << warnings << " warning(s)"; + if (notes > 0) { + cout << " and " << notes << " other note(s)"; + } + } else if (notes > 0) { + cout << ", with " << notes << " note(s)"; + } + cout << endl; return 0; } else { cout << name << ": Some tests failed" << endl; @@ -107,8 +117,18 @@ } else { string key = argv[1]; Tester tester(key); - if (tester.test()) { - cout << name << ": All tests succeeded" << endl; + int notes = 0, warnings = 0, errors = 0; + if (tester.test(notes, warnings, errors)) { + cout << name << ": All tests succeeded"; + if (warnings > 0) { + cout << ", with " << warnings << " warning(s)"; + if (notes > 0) { + cout << " and " << notes << " other note(s)"; + } + } else if (notes > 0) { + cout << ", with " << notes << " note(s)"; + } + cout << endl; return 0; } else { cout << name << ": Some tests failed" << endl;