# HG changeset patch # User cannam # Date 1237312497 0 # Node ID ba3c8cc649d3fda61e400fd05c0378653d25c8f9 # Parent 6a279da6fdd7ac856f009d32bcff72d9f927fb4e * Add lengthy constructor test diff -r 6a279da6fdd7 -r ba3c8cc649d3 TestDefaults.cpp --- a/TestDefaults.cpp Tue Mar 17 17:46:25 2009 +0000 +++ b/TestDefaults.cpp Tue Mar 17 17:54:57 2009 +0000 @@ -46,6 +46,7 @@ using namespace std; #include +#include Tester::TestRegistrar TestDefaultProgram::m_registrar("E1 Inconsistent default program"); @@ -53,6 +54,9 @@ Tester::TestRegistrar TestDefaultParameters::m_registrar("E2 Inconsistent default parameters"); +Tester::TestRegistrar +TestLengthyConstructor::m_registrar("E3 Lengthy constructor"); + static const size_t _step = 1000; Test::Results @@ -140,3 +144,15 @@ return r; } + +Test::Results +TestLengthyConstructor::test(string key) +{ + time_t t0 = time(0); + auto_ptr p(load(key)); + time_t t1 = time(0); + Results r; + if (t1 - t0 > 1) r.push_back(warning("Constructor takes some time to run: work should be deferred to initialise?")); + return r; +} + diff -r 6a279da6fdd7 -r ba3c8cc649d3 TestDefaults.h --- a/TestDefaults.h Tue Mar 17 17:46:25 2009 +0000 +++ b/TestDefaults.h Tue Mar 17 17:54:57 2009 +0000 @@ -63,5 +63,14 @@ static Tester::TestRegistrar m_registrar; }; +class TestLengthyConstructor : public Test +{ +public: + TestLengthyConstructor() : Test() { } + Results test(std::string key); + +protected: + static Tester::TestRegistrar m_registrar; +}; #endif diff -r 6a279da6fdd7 -r ba3c8cc649d3 Tester.cpp --- a/Tester.cpp Tue Mar 17 17:46:25 2009 +0000 +++ b/Tester.cpp Tue Mar 17 17:54:57 2009 +0000 @@ -113,10 +113,10 @@ * Initial value of a parameter on plugin construction differs from its default value (i.e. plugin produces different results depending on whether parameter is set explicitly by - host to default value or not) + host to default value or not) - DONE * If a plugin reports any programs, selecting default program - explicitly changes results (as for default parameters) + explicitly changes results (as for default parameters) - DONE * Output feature does not hasTimestamp when output type is VariableSampleRate - DONE @@ -124,10 +124,6 @@ * Output feature hasTimestamp or hasDuration when output type is OneSamplePerStep (warning only, this is not an error) - DONE - * Plugin fails gracelessly when constructed with "weird" sample - rate or initialised with "wrong" step size, block size, or - number of channels - * Plugin returns features whose output numbers do not have a corresponding record in output descriptor list - DONE @@ -136,7 +132,11 @@ * Constructor takes a long time to run. A fuzzy concept, but suggests that some work should have been deferred to - initialise(). Warning only + initialise(). Warning only - DONE + + * Plugin fails gracelessly when constructed with "weird" sample + rate or initialised with "wrong" step size, block size, or + number of channels Well, that's quite a lot of tests already. What else?