Commit bbb85b52 authored by Russell Taylor's avatar Russell Taylor
Browse files

Re #7551. Add code to prevent test constructors being called too much.

parent 9d789937
......@@ -64,6 +64,10 @@ private:
class ExperimentInfoTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static ExperimentInfoTest *createSuite() { return new ExperimentInfoTest(); }
static void destroySuite( ExperimentInfoTest *suite ) { delete suite; }
ExperimentInfoTest()
{
......
......@@ -13,7 +13,11 @@ using namespace Mantid::API;
class FunctionValuesTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static FunctionValuesTest *createSuite() { return new FunctionValuesTest(); }
static void destroySuite( FunctionValuesTest *suite ) { delete suite; }
FunctionValuesTest()
{
x.resize(10);
......
......@@ -61,9 +61,6 @@ namespace
class LogManagerTest : public CxxTest::TestSuite
{
public:
LogManagerTest()
{}
void testAddGetData()
{
LogManager runInfo;
......@@ -324,8 +321,6 @@ public:
}
private:
};
//---------------------------------------------------------------------------------------
......
......@@ -54,6 +54,11 @@ DECLARE_FUNCTION(MultiDomainFunctionTest_Function);
class MultiDomainFunctionTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static MultiDomainFunctionTest *createSuite() { return new MultiDomainFunctionTest(); }
static void destroySuite( MultiDomainFunctionTest *suite ) { delete suite; }
MultiDomainFunctionTest()
{
multi.addFunction(boost::make_shared<MultiDomainFunctionTest_Function>());
......
......@@ -54,6 +54,11 @@ namespace
class RunTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static RunTest *createSuite() { return new RunTest(); }
static void destroySuite( RunTest *suite ) { delete suite; }
RunTest() : m_test_energy_bins(5)
{
m_test_energy_bins[0] = -1.1;
......
......@@ -17,6 +17,11 @@ using namespace Mantid::API;
class AlignDetectorsTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static AlignDetectorsTest *createSuite() { return new AlignDetectorsTest(); }
static void destroySuite( AlignDetectorsTest *suite ) { delete suite; }
/** Setup for loading Nexus data */
void setUp_HRP38692()
{
......
......@@ -18,8 +18,12 @@ using namespace Mantid::DataObjects;
class AppendSpectraTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static AppendSpectraTest *createSuite() { return new AppendSpectraTest(); }
static void destroySuite( AppendSpectraTest *suite ) { delete suite; }
AppendSpectraTest() :
ws1Name("ConjoinWorkspacesTest_grp1"), ws2Name("ConjoinWorkspacesTest_grp2")
{
......
......@@ -18,6 +18,10 @@ using Mantid::DataObjects::OffsetsWorkspace_sptr;
class GetDetOffsetsMultiPeaksTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static GetDetOffsetsMultiPeaksTest *createSuite() { return new GetDetOffsetsMultiPeaksTest(); }
static void destroySuite( GetDetOffsetsMultiPeaksTest *suite ) { delete suite; }
GetDetOffsetsMultiPeaksTest()
{
......@@ -131,10 +135,13 @@ private:
class GetDetOffsetsMultiPeaksTestPerformance : public CxxTest::TestSuite
{
public:
MatrixWorkspace_sptr WS;
int numpixels;
public:
static GetDetOffsetsMultiPeaksTestPerformance *createSuite() { return new GetDetOffsetsMultiPeaksTestPerformance(); }
static void destroySuite( GetDetOffsetsMultiPeaksTestPerformance *suite ) { delete suite; }
void setUp()
{
numpixels = 10000;
......
......@@ -18,6 +18,10 @@ using Mantid::DataObjects::OffsetsWorkspace_sptr;
class GetDetectorOffsetsTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static GetDetectorOffsetsTest *createSuite() { return new GetDetectorOffsetsTest(); }
static void destroySuite( GetDetectorOffsetsTest *suite ) { delete suite; }
GetDetectorOffsetsTest()
{
......@@ -126,18 +130,19 @@ public:
}
private:
GetDetectorOffsets offsets;
};
class GetDetectorOffsetsTestPerformance : public CxxTest::TestSuite
{
public:
MatrixWorkspace_sptr WS;
int numpixels;
public:
static GetDetectorOffsetsTestPerformance *createSuite() { return new GetDetectorOffsetsTestPerformance(); }
static void destroySuite( GetDetectorOffsetsTestPerformance *suite ) { delete suite; }
void setUp()
{
numpixels = 10000;
......
......@@ -50,10 +50,16 @@ using namespace std;
class IntegratePeakTimeSlicesTest: public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static IntegratePeakTimeSlicesTest *createSuite() { return new IntegratePeakTimeSlicesTest(); }
static void destroySuite( IntegratePeakTimeSlicesTest *suite ) { delete suite; }
IntegratePeakTimeSlicesTest()
{
Mantid::API::FrameworkManager::Instance();
}
void test_abc()
{
int NRC =60;// 30;
......
......@@ -55,8 +55,6 @@ public:
public:
PeakHKLErrorsTest(){}
void test_data()
{
LoadIsawPeaks alg;
......
......@@ -32,9 +32,6 @@ class PredictFractionalPeaksTest: public CxxTest::TestSuite
{
public:
PredictFractionalPeaksTest()
{
}
void test_Init()
{
PredictFractionalPeaks alg;
......
......@@ -44,8 +44,6 @@ class SCDCalibratePanelsTest : public CxxTest::TestSuite
public:
SCDCalibratePanelsTest(){}
void test_data()
{
FrameworkManager::Instance();
......
......@@ -24,6 +24,11 @@ using namespace Mantid::CurveFitting;
class MultiDomainCreatorTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static MultiDomainCreatorTest *createSuite() { return new MultiDomainCreatorTest(); }
static void destroySuite( MultiDomainCreatorTest *suite ) { delete suite; }
MultiDomainCreatorTest()
{
//FrameworkManager::Instance();
......
......@@ -59,6 +59,11 @@ protected:
class MultiDomainFunctionTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static MultiDomainFunctionTest *createSuite() { return new MultiDomainFunctionTest(); }
static void destroySuite( MultiDomainFunctionTest *suite ) { delete suite; }
MultiDomainFunctionTest()
{
FrameworkManager::Instance();
......
......@@ -8,8 +8,13 @@
using namespace Mantid::API;
using Mantid::DataHandling::LoadILL;
class LoadILLTest: public CxxTest::TestSuite {
class LoadILLTest: public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static LoadILLTest *createSuite() { return new LoadILLTest(); }
static void destroySuite( LoadILLTest *suite ) { delete suite; }
LoadILLTest() :
m_testFile("ILLIN5_104007.nxs")
......
......@@ -30,6 +30,10 @@ using namespace Mantid::Kernel;
class PeaksWorkspaceTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static PeaksWorkspaceTest *createSuite() { return new PeaksWorkspaceTest(); }
static void destroySuite( PeaksWorkspaceTest *suite ) { delete suite; }
PeaksWorkspaceTest()
{
......
......@@ -20,6 +20,11 @@ public:
return ICatTestHelper::skipTests();
}
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static CatalogSearchTest *createSuite() { return new CatalogSearchTest(); }
static void destroySuite( CatalogSearchTest *suite ) { delete suite; }
CatalogSearchTest()
{
Mantid::API::FrameworkManager::Instance();
......
......@@ -9,6 +9,11 @@ using Mantid::Kernel::DeltaEMode;
class DeltaEModeTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static DeltaEModeTest *createSuite() { return new DeltaEModeTest(); }
static void destroySuite( DeltaEModeTest *suite ) { delete suite; }
DeltaEModeTest() :
m_elasticString("Elastic"),
m_directString("Direct"),
......
......@@ -15,6 +15,11 @@ class GlobTest : public CxxTest::TestSuite
{
Poco::Path base;
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static GlobTest *createSuite() { return new GlobTest(); }
static void destroySuite( GlobTest *suite ) { delete suite; }
GlobTest()
{
base.assign( ConfigService::Instance().getInstrumentDirectory());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment