diff TestDefaults.cpp @ 6:ba3c8cc649d3

* Add lengthy constructor test
author cannam
date Tue, 17 Mar 2009 17:54:57 +0000
parents 6a279da6fdd7
children 43eb3a4b95c8
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;
+}
+