comparison TestDefaults.cpp @ 6:ba3c8cc649d3

* Add lengthy constructor test
author cannam
date Tue, 17 Mar 2009 17:54:57 +0000
parents 6a279da6fdd7
children 43eb3a4b95c8
comparison
equal deleted inserted replaced
5:6a279da6fdd7 6:ba3c8cc649d3
44 44
45 #include <memory> 45 #include <memory>
46 using namespace std; 46 using namespace std;
47 47
48 #include <cmath> 48 #include <cmath>
49 #include <time.h>
49 50
50 Tester::TestRegistrar<TestDefaultProgram> 51 Tester::TestRegistrar<TestDefaultProgram>
51 TestDefaultProgram::m_registrar("E1 Inconsistent default program"); 52 TestDefaultProgram::m_registrar("E1 Inconsistent default program");
52 53
53 Tester::TestRegistrar<TestDefaultParameters> 54 Tester::TestRegistrar<TestDefaultParameters>
54 TestDefaultParameters::m_registrar("E2 Inconsistent default parameters"); 55 TestDefaultParameters::m_registrar("E2 Inconsistent default parameters");
56
57 Tester::TestRegistrar<TestLengthyConstructor>
58 TestLengthyConstructor::m_registrar("E3 Lengthy constructor");
55 59
56 static const size_t _step = 1000; 60 static const size_t _step = 1000;
57 61
58 Test::Results 62 Test::Results
59 TestDefaultProgram::test(string key) 63 TestDefaultProgram::test(string key)
138 r.push_back(success()); 142 r.push_back(success());
139 } 143 }
140 144
141 return r; 145 return r;
142 } 146 }
147
148 Test::Results
149 TestLengthyConstructor::test(string key)
150 {
151 time_t t0 = time(0);
152 auto_ptr<Plugin> p(load(key));
153 time_t t1 = time(0);
154 Results r;
155 if (t1 - t0 > 1) r.push_back(warning("Constructor takes some time to run: work should be deferred to initialise?"));
156 return r;
157 }
158