changeset 6:ba3c8cc649d3

* Add lengthy constructor test
author cannam
date Tue, 17 Mar 2009 17:54:57 +0000
parents 6a279da6fdd7
children 43eb3a4b95c8
files TestDefaults.cpp TestDefaults.h Tester.cpp
diffstat 3 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 <cmath>
+#include <time.h>
 
 Tester::TestRegistrar<TestDefaultProgram>
 TestDefaultProgram::m_registrar("E1 Inconsistent default program");
@@ -53,6 +54,9 @@
 Tester::TestRegistrar<TestDefaultParameters>
 TestDefaultParameters::m_registrar("E2 Inconsistent default parameters");
 
+Tester::TestRegistrar<TestLengthyConstructor>
+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<Plugin> 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;
+}
+
--- 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<TestDefaultParameters> m_registrar;
 };
 
+class TestLengthyConstructor : public Test
+{
+public:
+    TestLengthyConstructor() : Test() { }
+    Results test(std::string key);
+    
+protected:
+    static Tester::TestRegistrar<TestLengthyConstructor> m_registrar;
+};
 
 #endif
--- 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?