From 963e0bd052dd6eb2f190197e7d5352b74a1d9e65 Mon Sep 17 00:00:00 2001 From: Martyn Gigg <martyn.gigg@stfc.ac.uk> Date: Thu, 6 Jan 2011 16:49:49 +0000 Subject: [PATCH] Tell scons to build the new TestHelpers package so that ISIS buildservers are still happy with moving the test helpers while the CMake transition is still in progress. Refs #2196 and #1881 --- .../API/test/SampleEnvironmentTest.h | 2 +- Code/Mantid/Framework/API/test/SampleTest.h | 2 +- .../Algorithms/test/AlignDetectorsTest.h | 3 - .../test/ApplyTransmissionCorrectionTest.h | 7 +- .../Algorithms/test/BinaryOperationTest.h | 16 +- .../Algorithms/test/CalculateEfficiencyTest.h | 16 +- .../CalculateTransmissionBeamSpreaderTest.h | 11 +- .../test/CalculateTransmissionTest.h | 6 +- .../Algorithms/test/ChainedOperatorTest.h | 2 +- .../test/CheckWorkspacesMatchTest.h | 2 +- .../Algorithms/test/CloneWorkspaceTest.h | 2 +- .../test/CommutativeBinaryOperationTest.h | 2 +- .../test/ConvertFromDistributionTest.h | 2 +- .../Algorithms/test/ConvertSpectrumAxisTest.h | 2 +- .../test/ConvertToDistributionTest.h | 2 +- .../Algorithms/test/ConvertToHistogramTest.h | 2 +- .../Algorithms/test/ConvertToPointDataTest.h | 2 +- .../Algorithms/test/ConvertUnitsTest.h | 2 +- .../Algorithms/test/CorrectToFileTest.h | 2 +- .../Algorithms/test/CropWorkspaceTest.h | 2 +- .../test/CuboidGaugeVolumeAbsorptionTest.h | 2 +- .../Algorithms/test/CylinderAbsorptionTest.h | 2 +- .../test/DetectorEfficiencyCorTest.h | 2 +- .../test/DetectorEfficiencyVariationTest.h | 2 +- .../Framework/Algorithms/test/DivideTest.h | 2 +- .../test/ExponentialCorrectionTest.h | 2 +- .../Algorithms/test/ExponentialTest.h | 2 +- .../Algorithms/test/ExtractFFTSpectrumTest.h | 2 +- .../Algorithms/test/ExtractMaskingTest.h | 2 +- .../test/ExtractSingleSpectrumTest.h | 2 +- .../Algorithms/test/FFTSmooth2Test.h | 2 +- .../Algorithms/test/FilterByLogValueTest.h | 2 +- .../test/FindCenterOfMassPositionTest.h | 2 +- .../Algorithms/test/FindDeadDetectorsTest.h | 2 +- .../test/FindDetectorsOutsideLimitsTest.h | 2 +- .../Framework/Algorithms/test/FindPeaksTest.h | 2 +- .../Algorithms/test/FlatPlateAbsorptionTest.h | 2 +- .../Algorithms/test/GetDetectorOffsetsTest.h | 2 +- .../Framework/Algorithms/test/GetEiTest.h | 2 +- .../Algorithms/test/GhostCorrectionTest.h | 4 +- .../test/HRPDSlabCanAbsorptionTest.h | 2 +- .../Algorithms/test/IntegrationTest.h | 2 +- .../Framework/Algorithms/test/LogarithmTest.h | 2 +- .../Framework/Algorithms/test/MaskBinsTest.h | 2 +- .../Algorithms/test/MedianDetectorTestTest.h | 2 +- .../Algorithms/test/MemoryLeakTest.h | 2 +- .../Framework/Algorithms/test/MergeRunsTest.h | 2 +- .../Framework/Algorithms/test/MinusTest.h | 2 +- .../test/MonteCarloAbsorptionTest.h | 4 +- .../test/MultipleScatteringAbsorption.h | 6 +- .../Framework/Algorithms/test/MultiplyTest.h | 2 +- .../Algorithms/test/NormaliseByCurrentTest.h | 2 +- .../Algorithms/test/NormaliseToMonitorTest.h | 2 +- .../test/OneMinusExponentialCorTest.h | 2 +- .../Framework/Algorithms/test/PlusTest.h | 2 +- .../test/PointByPointVCorrectionTest.h | 2 +- .../Algorithms/test/PoissonErrorsTest.h | 2 +- .../test/PolynomialCorrectionTest.h | 2 +- .../Algorithms/test/PowerLawCorrectionTest.h | 2 +- .../Framework/Algorithms/test/PowerTest.h | 2 +- .../Algorithms/test/RebinToWorkspaceTest.h | 2 +- .../Algorithms/test/RenameWorkspaceTest.h | 2 +- .../test/ReplaceSpecialValuesTest.h | 2 +- .../test/SANSInstrumentCreationHelper.h | 143 ------ .../Framework/Algorithms/test/ScaleTest.h | 2 +- .../Algorithms/test/SolidAngleTest.h | 2 +- .../Algorithms/test/StripPeaksTest.h | 2 +- .../Algorithms/test/StripVanadiumPeaksTest.h | 2 +- .../Algorithms/test/SumSpectraTest.h | 2 +- .../Algorithms/test/TofCorrectionTest.h | 2 +- .../Framework/Algorithms/test/TransposeTest.h | 2 +- .../Algorithms/test/UnaryOperationTest.h | 2 +- .../test/WorkspaceCreationHelper.hh | 471 ------------------ .../Algorithms/test/WorkspaceGroupTest.h | 2 +- Code/Mantid/Framework/Build/Tests/SConscript | 3 +- .../DataHandling/test/CreateSampleShapeTest.h | 2 +- .../DataHandling/test/SaveFocussedXYETest.h | 2 +- .../Framework/DataHandling/test/SaveRKHTest.h | 2 +- .../Framework/DataHandling/test/SaveSPETest.h | 2 +- .../DataHandling/test/SetScalingPSDTest.h | 2 +- .../DataObjects/test/EventWorkspaceTest.h | 2 +- .../Geometry/test/CompAssemblyTest.h | 2 +- .../Geometry/test/ComponentCreationHelpers.hh | 351 ------------- .../Geometry/test/DetectorGroupTest.h | 2 +- .../Geometry/test/InstrumentRayTracerTest.h | 2 +- .../Geometry/test/NearestNeighboursTest.h | 2 +- .../Geometry/test/RectangularDetectorTest.h | 2 +- Code/Mantid/Framework/Kernel/CMakeLists.txt | 4 +- .../Framework/Kernel/test/ConfigServiceTest.h | 3 +- .../Framework/Kernel/test/FilterChannelTest.h | 3 +- .../Framework/Kernel/test/TestChannel.hh | 74 --- .../Framework/Nexus/test/SaveNXSPETest.h | 2 +- .../PythonAPI/test/PythonFrameworkTests.h | 2 +- Code/Mantid/Framework/SConstruct | 4 + Code/Mantid/Framework/TestHelpers/SConscript | 22 + 95 files changed, 148 insertions(+), 1155 deletions(-) delete mode 100644 Code/Mantid/Framework/Algorithms/test/SANSInstrumentCreationHelper.h delete mode 100644 Code/Mantid/Framework/Algorithms/test/WorkspaceCreationHelper.hh delete mode 100644 Code/Mantid/Framework/Geometry/test/ComponentCreationHelpers.hh delete mode 100644 Code/Mantid/Framework/Kernel/test/TestChannel.hh create mode 100644 Code/Mantid/Framework/TestHelpers/SConscript diff --git a/Code/Mantid/Framework/API/test/SampleEnvironmentTest.h b/Code/Mantid/Framework/API/test/SampleEnvironmentTest.h index b44da513832..e5b158a4679 100644 --- a/Code/Mantid/Framework/API/test/SampleEnvironmentTest.h +++ b/Code/Mantid/Framework/API/test/SampleEnvironmentTest.h @@ -5,7 +5,7 @@ #include "MantidAPI/SampleEnvironment.h" #include "MantidGeometry/Instrument/Component.h" #include "MantidKernel/NeutronAtom.h" -#include "../../Geometry/test/ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" using Mantid::API::SampleEnvironment; using namespace Mantid::PhysicalConstants; diff --git a/Code/Mantid/Framework/API/test/SampleTest.h b/Code/Mantid/Framework/API/test/SampleTest.h index ab9a341bc7d..a2b969d0926 100644 --- a/Code/Mantid/Framework/API/test/SampleTest.h +++ b/Code/Mantid/Framework/API/test/SampleTest.h @@ -7,7 +7,7 @@ #include "MantidKernel/Exception.h" #include "MantidAPI/SampleEnvironment.h" -#include "../../Geometry/test/ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::Kernel; using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/Algorithms/test/AlignDetectorsTest.h b/Code/Mantid/Framework/Algorithms/test/AlignDetectorsTest.h index 090ededae7e..685a0667e20 100644 --- a/Code/Mantid/Framework/Algorithms/test/AlignDetectorsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/AlignDetectorsTest.h @@ -145,9 +145,6 @@ public: //Retrieve Workspace WS = boost::dynamic_pointer_cast<EventWorkspace>(AnalysisDataService::Instance().retrieve(inputWS)); TS_ASSERT( WS ); //workspace is loaded - size_t start_blocksize = WS->blocksize(); - size_t num_events = WS->getNumberEvents(); - double a_tof = WS->getEventList(0).getEvents()[0].tof(); //Start by init'ing the algorithm TS_ASSERT_THROWS_NOTHING( align.initialize() ); diff --git a/Code/Mantid/Framework/Algorithms/test/ApplyTransmissionCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/ApplyTransmissionCorrectionTest.h index f75ce0fec49..542912e4b93 100644 --- a/Code/Mantid/Framework/Algorithms/test/ApplyTransmissionCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ApplyTransmissionCorrectionTest.h @@ -5,12 +5,13 @@ #include "MantidAlgorithms/ApplyTransmissionCorrection.h" #include "MantidDataHandling/LoadSpice2D.h" #include "MantidDataHandling/MoveInstrumentComponent.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/SolidAngleCorrection.h" #include "MantidKernel/UnitFactory.h" using namespace Mantid::API; using namespace Mantid::Kernel; +using namespace Mantid::DataObjects; class ApplyTransmissionCorrectionTest : public CxxTest::TestSuite { @@ -71,8 +72,8 @@ public: { Mantid::Algorithms::ApplyTransmissionCorrection correction; const std::string transWS("trans"); - DataObjects::Workspace2D_sptr trans_ws = WorkspaceCreationHelper::Create2DWorkspace154(1,1,1); - trans_ws->getAxis(0)->unit() = Kernel::UnitFactory::Instance().create("Wavelength"); + Workspace2D_sptr trans_ws = WorkspaceCreationHelper::Create2DWorkspace154(1,1,1); + trans_ws->getAxis(0)->unit() = UnitFactory::Instance().create("Wavelength"); trans_ws->dataY(0)[0] = 0.6; trans_ws->dataE(0)[0] = 0.02; Mantid::API::AnalysisDataService::Instance().addOrReplace(transWS, trans_ws); diff --git a/Code/Mantid/Framework/Algorithms/test/BinaryOperationTest.h b/Code/Mantid/Framework/Algorithms/test/BinaryOperationTest.h index 6b44cc5b775..754c57d3eb2 100644 --- a/Code/Mantid/Framework/Algorithms/test/BinaryOperationTest.h +++ b/Code/Mantid/Framework/Algorithms/test/BinaryOperationTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/BinaryOperation.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" @@ -12,8 +12,9 @@ #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/Workspace1D.h" -using namespace Mantid; using namespace Mantid::API; +using namespace Mantid::Geometry; +using namespace Mantid::DataObjects; class BinaryOpHelper : public Mantid::Algorithms::BinaryOperation { @@ -40,11 +41,11 @@ public: private: // Overridden BinaryOperation methods - void performBinaryOperation(const MantidVec& lhsX, const MantidVec& lhsY, const MantidVec& lhsE, - const MantidVec& rhsY, const MantidVec& rhsE, MantidVec& YOut, MantidVec& EOut) + void performBinaryOperation(const Mantid::MantidVec&, const Mantid::MantidVec& , const Mantid::MantidVec& , + const Mantid::MantidVec&, const Mantid::MantidVec& , Mantid::MantidVec&, Mantid::MantidVec&) {} - void performBinaryOperation(const MantidVec& lhsX, const MantidVec& lhsY, const MantidVec& lhsE, - const double& rhsY, const double& rhsE, MantidVec& YOut, MantidVec& EOut) + void performBinaryOperation(const Mantid::MantidVec& , const Mantid::MantidVec&, const Mantid::MantidVec&, + const double& , const double&, Mantid::MantidVec& , Mantid::MantidVec& ) {} }; @@ -94,6 +95,7 @@ public: void testcheckSizeCompatibility2D2D() { + // Register the workspace in the data service Workspace2D_sptr work_in1 = WorkspaceCreationHelper::Create2DWorkspace(10,10); Workspace2D_sptr work_in2 = WorkspaceCreationHelper::Create2DWorkspace(20,10); @@ -146,7 +148,7 @@ public: { det = output->getDetector(i); } - catch(Kernel::Exception::NotFoundError&) + catch(Mantid::Kernel::Exception::NotFoundError&) { } diff --git a/Code/Mantid/Framework/Algorithms/test/CalculateEfficiencyTest.h b/Code/Mantid/Framework/Algorithms/test/CalculateEfficiencyTest.h index 49635985f2d..1c2903a0585 100644 --- a/Code/Mantid/Framework/Algorithms/test/CalculateEfficiencyTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CalculateEfficiencyTest.h @@ -6,7 +6,7 @@ #include "MantidAlgorithms/SolidAngleCorrection.h" #include "MantidDataHandling/LoadSpice2D.h" #include "MantidDataHandling/MoveInstrumentComponent.h" -#include "SANSInstrumentCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::API; using namespace Mantid::Kernel; @@ -27,9 +27,9 @@ public: // Set up the X bin for the monitor channels for ( int i=0; i<SANSInstrumentCreationHelper::nMonitors; i++ ) { - MantidVec& X = ws->dataX(i); - MantidVec& Y = ws->dataY(i); - MantidVec& E = ws->dataE(i); + Mantid::MantidVec& X = ws->dataX(i); + Mantid::MantidVec& Y = ws->dataY(i); + Mantid::MantidVec& E = ws->dataE(i); X[0] = 1; X[1] = 2; } @@ -39,9 +39,9 @@ public: for ( int iy=0; iy<SANSInstrumentCreationHelper::nBins; iy++) { int i = ix*SANSInstrumentCreationHelper::nBins+iy+SANSInstrumentCreationHelper::nMonitors; - MantidVec& X = ws->dataX(i); - MantidVec& Y = ws->dataY(i); - MantidVec& E = ws->dataE(i); + Mantid::MantidVec& X = ws->dataX(i); + Mantid::MantidVec& Y = ws->dataY(i); + Mantid::MantidVec& E = ws->dataE(i); X[0] = 1; X[1] = 2; Y[0] = 2.0; @@ -50,7 +50,7 @@ public: } } // Change one of the bins so that it will be excluded for having a high signal - MantidVec& Y = ws->dataY(SANSInstrumentCreationHelper::nMonitors+5); + Mantid::MantidVec& Y = ws->dataY(SANSInstrumentCreationHelper::nMonitors+5); Y[0] = 202.0; } diff --git a/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionBeamSpreaderTest.h b/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionBeamSpreaderTest.h index 5ec26157772..61764501dae 100644 --- a/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionBeamSpreaderTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionBeamSpreaderTest.h @@ -9,9 +9,10 @@ #include "MantidAlgorithms/ConvertUnits.h" #include "MantidAlgorithms/CropWorkspace.h" #include "MantidCurveFitting/Linear.h" -#include "SANSInstrumentCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::API; +using namespace Mantid::DataObjects; class CalculateTransmissionBeamSpreaderTest : public CxxTest::TestSuite { @@ -44,28 +45,28 @@ public: // By default UDET=2 for the monitor, which is spectrum 1 // Sample spreader fake. Created with Y=2, scale it to Y=10 const std::string sample_spreader("sample_spreader_ws"); - DataObjects::Workspace2D_sptr sample_spreaderWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(sample_spreader); + Workspace2D_sptr sample_spreaderWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(sample_spreader); sample_spreaderWS *= 5.0; sample_spreaderWS->dataY(1)[0] = 1.0; Mantid::API::AnalysisDataService::Instance().addOrReplace(sample_spreader, sample_spreaderWS); // Sample scattering fake. Scale it to Y=8 const std::string sample_scatt("sample_scatt_ws"); - DataObjects::Workspace2D_sptr sample_scattWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(sample_scatt); + Workspace2D_sptr sample_scattWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(sample_scatt); sample_scattWS *= 4.0; sample_scattWS->dataY(1)[0] = 1.0; Mantid::API::AnalysisDataService::Instance().addOrReplace(sample_scatt, sample_scattWS); // Empty spreader fake. Scale it to Y=6 const std::string empty_spreader("empty_spreader_ws"); - DataObjects::Workspace2D_sptr empty_spreaderWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(empty_spreader); + Workspace2D_sptr empty_spreaderWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(empty_spreader); empty_spreaderWS *= 3.0; empty_spreaderWS->dataY(1)[0] = 1.0; Mantid::API::AnalysisDataService::Instance().addOrReplace(empty_spreader, empty_spreaderWS); // Empty scattering fake. const std::string empty_scatt("empty_scatt_ws"); - DataObjects::Workspace2D_sptr empty_scattWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(empty_scatt); + Workspace2D_sptr empty_scattWS = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(empty_scatt); Mantid::API::AnalysisDataService::Instance().addOrReplace(empty_scatt, empty_scattWS); empty_scattWS->dataY(1)[0] = 1.0; diff --git a/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionTest.h b/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionTest.h index 3a0600c23b1..3c8eda70d82 100644 --- a/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CalculateTransmissionTest.h @@ -9,7 +9,7 @@ #include "MantidAlgorithms/ConvertUnits.h" #include "MantidAlgorithms/CropWorkspace.h" #include "MantidCurveFitting/Linear.h" -#include "SANSInstrumentCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::API; @@ -91,11 +91,11 @@ public: inputWS = "sampletransdata"; - DataObjects::Workspace2D_sptr ws = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(inputWS); + Mantid::DataObjects::Workspace2D_sptr ws = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(inputWS); Mantid::API::AnalysisDataService::Instance().addOrReplace(inputWS, ws); const std::string emptyWS("directbeam_ws"); - DataObjects::Workspace2D_sptr empty_ws = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(emptyWS); + Mantid::DataObjects::Workspace2D_sptr empty_ws = SANSInstrumentCreationHelper::createSANSInstrumentWorkspace(emptyWS); // According to this detector geometry, Monitor #1 is spectrum 0, and Monitor #2 is spectrum 1. empty_ws->dataY(0)[0] = 10.0; diff --git a/Code/Mantid/Framework/Algorithms/test/ChainedOperatorTest.h b/Code/Mantid/Framework/Algorithms/test/ChainedOperatorTest.h index 19d8c4b3bdf..4a787d98e57 100644 --- a/Code/Mantid/Framework/Algorithms/test/ChainedOperatorTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ChainedOperatorTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Plus.h" #include "MantidAlgorithms/Minus.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h b/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h index 8a75c975cb5..36b0641d64c 100644 --- a/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CheckWorkspacesMatchTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/CheckWorkspacesMatch.h" #include "MantidDataHandling/LoadRaw3.h" diff --git a/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h b/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h index 13c4eb5520b..ea4c5cba997 100644 --- a/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CloneWorkspaceTest.h @@ -7,7 +7,7 @@ #include "MantidDataHandling/LoadRaw3.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidAlgorithms/CheckWorkspacesMatch.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/AnalysisDataService.h" using namespace Mantid; diff --git a/Code/Mantid/Framework/Algorithms/test/CommutativeBinaryOperationTest.h b/Code/Mantid/Framework/Algorithms/test/CommutativeBinaryOperationTest.h index 7146496f3c5..a0dc94a6773 100644 --- a/Code/Mantid/Framework/Algorithms/test/CommutativeBinaryOperationTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CommutativeBinaryOperationTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/CommutativeBinaryOperation.h" using namespace Mantid; diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertFromDistributionTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertFromDistributionTest.h index 10532d490d3..da926976f45 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertFromDistributionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertFromDistributionTest.h @@ -2,7 +2,7 @@ #define CONVERTFROMDISTRIBUTIONTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/ConvertFromDistribution.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertSpectrumAxisTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertSpectrumAxisTest.h index 391675223f0..6413c53f55a 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertSpectrumAxisTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertSpectrumAxisTest.h @@ -2,7 +2,7 @@ #define CONVERTSPECTRUMAXISTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/ConvertSpectrumAxis.h" #include "MantidDataHandling/LoadRaw3.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertToDistributionTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertToDistributionTest.h index 034d8b26132..e524f3a1b18 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertToDistributionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertToDistributionTest.h @@ -2,7 +2,7 @@ #define CONVERTTODISTRIBUTIONTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/ConvertToDistribution.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertToHistogramTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertToHistogramTest.h index 519cb1f651b..32868af39ba 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertToHistogramTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertToHistogramTest.h @@ -4,7 +4,7 @@ #include "MantidAlgorithms/ConvertToHistogram.h" #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using Mantid::API::IAlgorithm_sptr; using Mantid::Algorithms::ConvertToHistogram; diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertToPointDataTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertToPointDataTest.h index 6d69f025497..92910a345e1 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertToPointDataTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertToPointDataTest.h @@ -4,7 +4,7 @@ #include "MantidAlgorithms/ConvertToPointData.h" #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using Mantid::API::IAlgorithm_sptr; using Mantid::Algorithms::ConvertToPointData; diff --git a/Code/Mantid/Framework/Algorithms/test/ConvertUnitsTest.h b/Code/Mantid/Framework/Algorithms/test/ConvertUnitsTest.h index 9f53caa69c3..79a66589742 100644 --- a/Code/Mantid/Framework/Algorithms/test/ConvertUnitsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ConvertUnitsTest.h @@ -2,7 +2,7 @@ #define CONVERTUNITSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/ConvertUnits.h" #include "MantidKernel/PhysicalConstants.h" diff --git a/Code/Mantid/Framework/Algorithms/test/CorrectToFileTest.h b/Code/Mantid/Framework/Algorithms/test/CorrectToFileTest.h index 31344aca236..59ee3564a3e 100644 --- a/Code/Mantid/Framework/Algorithms/test/CorrectToFileTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CorrectToFileTest.h @@ -8,7 +8,7 @@ #include "MantidAlgorithms/CorrectToFile.h" #include "MantidDataHandling/LoadRKH.h" #include "MantidKernel/UnitFactory.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "Poco/Path.h" class CorrectToFileTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/Algorithms/test/CropWorkspaceTest.h b/Code/Mantid/Framework/Algorithms/test/CropWorkspaceTest.h index ba50382b7e5..6826e4d615c 100644 --- a/Code/Mantid/Framework/Algorithms/test/CropWorkspaceTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CropWorkspaceTest.h @@ -2,7 +2,7 @@ #define CROPWORKSPACETEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/CropWorkspace.h" #include "MantidDataObjects/Workspace2D.h" diff --git a/Code/Mantid/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h b/Code/Mantid/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h index 1ffec5524c0..686a4501f83 100644 --- a/Code/Mantid/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h @@ -5,7 +5,7 @@ #include "MantidAlgorithms/CuboidGaugeVolumeAbsorption.h" #include "MantidKernel/UnitFactory.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class CuboidGaugeVolumeAbsorptionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/CylinderAbsorptionTest.h b/Code/Mantid/Framework/Algorithms/test/CylinderAbsorptionTest.h index 883b010cde4..e5837442508 100644 --- a/Code/Mantid/Framework/Algorithms/test/CylinderAbsorptionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/CylinderAbsorptionTest.h @@ -5,7 +5,7 @@ #include "MantidAlgorithms/CylinderAbsorption.h" #include "MantidKernel/UnitFactory.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class CylinderAbsorptionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyCorTest.h b/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyCorTest.h index 9c992b926dc..462a6cc490f 100644 --- a/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyCorTest.h +++ b/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyCorTest.h @@ -15,7 +15,7 @@ #include "MantidGeometry/Objects/ShapeFactory.h" #include "MantidAPI/SpectraDetectorMap.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "Poco/DOM/DOMParser.h" #include "Poco/DOM/Document.h" diff --git a/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h b/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h index 5d47ff86ebe..87fa7cca828 100644 --- a/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h +++ b/Code/Mantid/Framework/Algorithms/test/DetectorEfficiencyVariationTest.h @@ -2,7 +2,7 @@ #define DETECTOREFFICIENCYVARIATION_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/DetectorEfficiencyVariation.h" #include "MantidKernel/UnitFactory.h" diff --git a/Code/Mantid/Framework/Algorithms/test/DivideTest.h b/Code/Mantid/Framework/Algorithms/test/DivideTest.h index 2d61d78ee0a..e634843c0e8 100644 --- a/Code/Mantid/Framework/Algorithms/test/DivideTest.h +++ b/Code/Mantid/Framework/Algorithms/test/DivideTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Divide.h" #include "MantidAlgorithms/Multiply.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ExponentialCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/ExponentialCorrectionTest.h index 167bfa12f38..2c756549298 100644 --- a/Code/Mantid/Framework/Algorithms/test/ExponentialCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ExponentialCorrectionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/ExponentialCorrection.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/ArrayProperty.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ExponentialTest.h b/Code/Mantid/Framework/Algorithms/test/ExponentialTest.h index 5bdbcab05ce..e26455cd53d 100644 --- a/Code/Mantid/Framework/Algorithms/test/ExponentialTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ExponentialTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Exponential.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ExtractFFTSpectrumTest.h b/Code/Mantid/Framework/Algorithms/test/ExtractFFTSpectrumTest.h index 9f7e4e45fcc..fff76d818dd 100644 --- a/Code/Mantid/Framework/Algorithms/test/ExtractFFTSpectrumTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ExtractFFTSpectrumTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/ExtractFFTSpectrum.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidNexus/LoadNeXus.h" #include "MantidAlgorithms/Rebin.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ExtractMaskingTest.h b/Code/Mantid/Framework/Algorithms/test/ExtractMaskingTest.h index b5015d1be30..6bf6508af9a 100644 --- a/Code/Mantid/Framework/Algorithms/test/ExtractMaskingTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ExtractMaskingTest.h @@ -6,7 +6,7 @@ //------------------------------------------------------------------------------ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/ExtractMasking.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using Mantid::Algorithms::ExtractMasking; using Mantid::API::AnalysisDataService; diff --git a/Code/Mantid/Framework/Algorithms/test/ExtractSingleSpectrumTest.h b/Code/Mantid/Framework/Algorithms/test/ExtractSingleSpectrumTest.h index 4cc30a72691..d2e92a33c00 100644 --- a/Code/Mantid/Framework/Algorithms/test/ExtractSingleSpectrumTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ExtractSingleSpectrumTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/ExtractSingleSpectrum.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class ExtractSingleSpectrumTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/FFTSmooth2Test.h b/Code/Mantid/Framework/Algorithms/test/FFTSmooth2Test.h index bab6dbbcb37..a02eaaa3954 100644 --- a/Code/Mantid/Framework/Algorithms/test/FFTSmooth2Test.h +++ b/Code/Mantid/Framework/Algorithms/test/FFTSmooth2Test.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/FFTSmooth2.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/ArrayProperty.h" diff --git a/Code/Mantid/Framework/Algorithms/test/FilterByLogValueTest.h b/Code/Mantid/Framework/Algorithms/test/FilterByLogValueTest.h index 0ed40f89d88..f378a0cf2d1 100644 --- a/Code/Mantid/Framework/Algorithms/test/FilterByLogValueTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FilterByLogValueTest.h @@ -16,7 +16,7 @@ #include "MantidKernel/TimeSeriesProperty.h" #include "MantidDataObjects/EventWorkspace.h" #include "MantidAPI/AlgorithmManager.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace Mantid::Algorithms; using namespace Mantid::DataHandling; diff --git a/Code/Mantid/Framework/Algorithms/test/FindCenterOfMassPositionTest.h b/Code/Mantid/Framework/Algorithms/test/FindCenterOfMassPositionTest.h index ead279df7b8..1d72c25a975 100644 --- a/Code/Mantid/Framework/Algorithms/test/FindCenterOfMassPositionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FindCenterOfMassPositionTest.h @@ -10,7 +10,7 @@ #include "MantidAPI/TableRow.h" #include "MantidDataObjects/TableWorkspace.h" -#include "SANSInstrumentCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Code/Mantid/Framework/Algorithms/test/FindDeadDetectorsTest.h b/Code/Mantid/Framework/Algorithms/test/FindDeadDetectorsTest.h index 2b12311c6cc..9a55d695883 100644 --- a/Code/Mantid/Framework/Algorithms/test/FindDeadDetectorsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FindDeadDetectorsTest.h @@ -8,7 +8,7 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/SpectraDetectorMap.h" #include "MantidDataObjects/Workspace2D.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <fstream> #include <Poco/File.h> diff --git a/Code/Mantid/Framework/Algorithms/test/FindDetectorsOutsideLimitsTest.h b/Code/Mantid/Framework/Algorithms/test/FindDetectorsOutsideLimitsTest.h index 6f7afc5e09e..16b27b8f5b0 100644 --- a/Code/Mantid/Framework/Algorithms/test/FindDetectorsOutsideLimitsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FindDetectorsOutsideLimitsTest.h @@ -9,7 +9,7 @@ #include "MantidAPI/SpectraDetectorMap.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/EventWorkspace.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "Poco/File.h" #include <fstream> diff --git a/Code/Mantid/Framework/Algorithms/test/FindPeaksTest.h b/Code/Mantid/Framework/Algorithms/test/FindPeaksTest.h index 84b5f8b8ad9..c2bcd5fd51b 100644 --- a/Code/Mantid/Framework/Algorithms/test/FindPeaksTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FindPeaksTest.h @@ -2,7 +2,7 @@ #define FINDPEAKSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/FindPeaks.h" #include "MantidNexus/LoadNexusProcessed.h" diff --git a/Code/Mantid/Framework/Algorithms/test/FlatPlateAbsorptionTest.h b/Code/Mantid/Framework/Algorithms/test/FlatPlateAbsorptionTest.h index 1488c7e8c9c..2a5e858e680 100644 --- a/Code/Mantid/Framework/Algorithms/test/FlatPlateAbsorptionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/FlatPlateAbsorptionTest.h @@ -5,7 +5,7 @@ #include "MantidAlgorithms/FlatPlateAbsorption.h" #include "MantidKernel/UnitFactory.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class FlatPlateAbsorptionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/GetDetectorOffsetsTest.h b/Code/Mantid/Framework/Algorithms/test/GetDetectorOffsetsTest.h index ee668c179f6..684a70096af 100644 --- a/Code/Mantid/Framework/Algorithms/test/GetDetectorOffsetsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/GetDetectorOffsetsTest.h @@ -2,7 +2,7 @@ #define GETDETECTOROFFSETSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/GetDetectorOffsets.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/GetEiTest.h b/Code/Mantid/Framework/Algorithms/test/GetEiTest.h index eff822521b2..579721b62ad 100644 --- a/Code/Mantid/Framework/Algorithms/test/GetEiTest.h +++ b/Code/Mantid/Framework/Algorithms/test/GetEiTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/GetEi2.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidKernel/UnitFactory.h" #include <cmath> diff --git a/Code/Mantid/Framework/Algorithms/test/GhostCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/GhostCorrectionTest.h index 4651dc96947..246a4dc3e37 100644 --- a/Code/Mantid/Framework/Algorithms/test/GhostCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/GhostCorrectionTest.h @@ -10,8 +10,8 @@ #include "MantidDataObjects/Workspace2D.h" #include "MantidDataHandling/LoadEventPreNeXus.h" #include "MantidAlgorithms/AlignDetectors.h" -#include "WorkspaceCreationHelper.hh" -#include "../../Geometry/test/ComponentCreationHelpers.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" #include <Poco/File.h> using namespace Mantid; diff --git a/Code/Mantid/Framework/Algorithms/test/HRPDSlabCanAbsorptionTest.h b/Code/Mantid/Framework/Algorithms/test/HRPDSlabCanAbsorptionTest.h index 1c8803146cc..ef9e28fea99 100644 --- a/Code/Mantid/Framework/Algorithms/test/HRPDSlabCanAbsorptionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/HRPDSlabCanAbsorptionTest.h @@ -5,7 +5,7 @@ #include "MantidAlgorithms/HRPDSlabCanAbsorption.h" #include "MantidKernel/UnitFactory.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class HRPDSlabCanAbsorptionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/IntegrationTest.h b/Code/Mantid/Framework/Algorithms/test/IntegrationTest.h index 1bbefef1fb3..5ebe48faa73 100644 --- a/Code/Mantid/Framework/Algorithms/test/IntegrationTest.h +++ b/Code/Mantid/Framework/Algorithms/test/IntegrationTest.h @@ -8,7 +8,7 @@ #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/EventWorkspace.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Code/Mantid/Framework/Algorithms/test/LogarithmTest.h b/Code/Mantid/Framework/Algorithms/test/LogarithmTest.h index 5fc189c77e8..bb82517a2f1 100644 --- a/Code/Mantid/Framework/Algorithms/test/LogarithmTest.h +++ b/Code/Mantid/Framework/Algorithms/test/LogarithmTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" #include "MantidDataObjects/Workspace2D.h" diff --git a/Code/Mantid/Framework/Algorithms/test/MaskBinsTest.h b/Code/Mantid/Framework/Algorithms/test/MaskBinsTest.h index d56fff45d5f..37c97930572 100644 --- a/Code/Mantid/Framework/Algorithms/test/MaskBinsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MaskBinsTest.h @@ -2,7 +2,7 @@ #define MASKBINSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/MaskBins.h" #include "MantidDataHandling/LoadEventPreNeXus.h" diff --git a/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h b/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h index c2448638e4d..5f7b2db4c3e 100644 --- a/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MedianDetectorTestTest.h @@ -2,7 +2,7 @@ #define WBVMEDIANTESTTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/MedianDetectorTest.h" #include "MantidKernel/UnitFactory.h" diff --git a/Code/Mantid/Framework/Algorithms/test/MemoryLeakTest.h b/Code/Mantid/Framework/Algorithms/test/MemoryLeakTest.h index 98318101135..db14b4eb571 100644 --- a/Code/Mantid/Framework/Algorithms/test/MemoryLeakTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MemoryLeakTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAPI/WorkspaceGroup.h" #include <iostream> -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidNexus/LoadSNSEventNexus.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/AlgorithmManager.h" diff --git a/Code/Mantid/Framework/Algorithms/test/MergeRunsTest.h b/Code/Mantid/Framework/Algorithms/test/MergeRunsTest.h index d2f67d286ea..a2e4a75bf34 100644 --- a/Code/Mantid/Framework/Algorithms/test/MergeRunsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MergeRunsTest.h @@ -2,7 +2,7 @@ #define MERGERUNSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <stdarg.h> #include "MantidAlgorithms/MergeRuns.h" diff --git a/Code/Mantid/Framework/Algorithms/test/MinusTest.h b/Code/Mantid/Framework/Algorithms/test/MinusTest.h index 6c8783e6d4b..bdb4b973d4c 100644 --- a/Code/Mantid/Framework/Algorithms/test/MinusTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MinusTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Minus.h" #include "MantidAlgorithms/Rebin.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/MonteCarloAbsorptionTest.h b/Code/Mantid/Framework/Algorithms/test/MonteCarloAbsorptionTest.h index ca9d2054dab..d7cc1d1aa50 100644 --- a/Code/Mantid/Framework/Algorithms/test/MonteCarloAbsorptionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MonteCarloAbsorptionTest.h @@ -6,8 +6,8 @@ #include "MantidAPI/SampleEnvironment.h" #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" -#include "../../Geometry/test/ComponentCreationHelpers.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" using Mantid::Algorithms::MonteCarloAbsorption; using Mantid::API::SampleEnvironment; diff --git a/Code/Mantid/Framework/Algorithms/test/MultipleScatteringAbsorption.h b/Code/Mantid/Framework/Algorithms/test/MultipleScatteringAbsorption.h index 0acabd27bd4..c512153122f 100644 --- a/Code/Mantid/Framework/Algorithms/test/MultipleScatteringAbsorption.h +++ b/Code/Mantid/Framework/Algorithms/test/MultipleScatteringAbsorption.h @@ -4,11 +4,13 @@ #include <cxxtest/TestSuite.h> #include <vector> -#include "WorkspaceCreationHelper.hh" -#include "../../Geometry/test/ComponentCreationHelpers.hh" #include "MantidAlgorithms/MultipleScatteringAbsorption.h" #include "MantidAPI/AnalysisDataService.h" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" +#include "MantidTestHelpers/ComponentCreationHelper.h" + + using namespace Mantid::API; using namespace Mantid::Kernel; diff --git a/Code/Mantid/Framework/Algorithms/test/MultiplyTest.h b/Code/Mantid/Framework/Algorithms/test/MultiplyTest.h index 149b0be076b..38743934856 100644 --- a/Code/Mantid/Framework/Algorithms/test/MultiplyTest.h +++ b/Code/Mantid/Framework/Algorithms/test/MultiplyTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Divide.h" #include "MantidAlgorithms/Multiply.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/NormaliseByCurrentTest.h b/Code/Mantid/Framework/Algorithms/test/NormaliseByCurrentTest.h index 186036ef622..ce26b882dd6 100644 --- a/Code/Mantid/Framework/Algorithms/test/NormaliseByCurrentTest.h +++ b/Code/Mantid/Framework/Algorithms/test/NormaliseByCurrentTest.h @@ -2,7 +2,7 @@ #define NORMALISEBYCURRENTTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/NormaliseByCurrent.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/NormaliseToMonitorTest.h b/Code/Mantid/Framework/Algorithms/test/NormaliseToMonitorTest.h index 04197b3af0a..c8e3ee2406e 100644 --- a/Code/Mantid/Framework/Algorithms/test/NormaliseToMonitorTest.h +++ b/Code/Mantid/Framework/Algorithms/test/NormaliseToMonitorTest.h @@ -2,7 +2,7 @@ #define NORMALISETOMONITORTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/NormaliseToMonitor.h" #include "MantidAPI/SpectraDetectorMap.h" diff --git a/Code/Mantid/Framework/Algorithms/test/OneMinusExponentialCorTest.h b/Code/Mantid/Framework/Algorithms/test/OneMinusExponentialCorTest.h index 9df673a999f..e39f6fdf73d 100644 --- a/Code/Mantid/Framework/Algorithms/test/OneMinusExponentialCorTest.h +++ b/Code/Mantid/Framework/Algorithms/test/OneMinusExponentialCorTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/OneMinusExponentialCor.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/ArrayProperty.h" diff --git a/Code/Mantid/Framework/Algorithms/test/PlusTest.h b/Code/Mantid/Framework/Algorithms/test/PlusTest.h index f37936520e0..f87492e4f87 100644 --- a/Code/Mantid/Framework/Algorithms/test/PlusTest.h +++ b/Code/Mantid/Framework/Algorithms/test/PlusTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Plus.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Code/Mantid/Framework/Algorithms/test/PointByPointVCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/PointByPointVCorrectionTest.h index 854aea4a12a..5221b10a22b 100644 --- a/Code/Mantid/Framework/Algorithms/test/PointByPointVCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/PointByPointVCorrectionTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/PointByPointVCorrection.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class PointByPointVCorrectionTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/PoissonErrorsTest.h b/Code/Mantid/Framework/Algorithms/test/PoissonErrorsTest.h index 630986c4115..f259047ecf3 100644 --- a/Code/Mantid/Framework/Algorithms/test/PoissonErrorsTest.h +++ b/Code/Mantid/Framework/Algorithms/test/PoissonErrorsTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/PoissonErrors.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Code/Mantid/Framework/Algorithms/test/PolynomialCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/PolynomialCorrectionTest.h index d4926001c6e..b9f6c7cb4b6 100644 --- a/Code/Mantid/Framework/Algorithms/test/PolynomialCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/PolynomialCorrectionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/PolynomialCorrection.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/ArrayProperty.h" diff --git a/Code/Mantid/Framework/Algorithms/test/PowerLawCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/PowerLawCorrectionTest.h index d1bd585858a..fd176bc755e 100644 --- a/Code/Mantid/Framework/Algorithms/test/PowerLawCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/PowerLawCorrectionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/PowerLawCorrection.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/ArrayProperty.h" diff --git a/Code/Mantid/Framework/Algorithms/test/PowerTest.h b/Code/Mantid/Framework/Algorithms/test/PowerTest.h index d9c71655c61..62a9ec1542a 100644 --- a/Code/Mantid/Framework/Algorithms/test/PowerTest.h +++ b/Code/Mantid/Framework/Algorithms/test/PowerTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Power.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceFactory.h" diff --git a/Code/Mantid/Framework/Algorithms/test/RebinToWorkspaceTest.h b/Code/Mantid/Framework/Algorithms/test/RebinToWorkspaceTest.h index a5d8ae78533..845037caeed 100644 --- a/Code/Mantid/Framework/Algorithms/test/RebinToWorkspaceTest.h +++ b/Code/Mantid/Framework/Algorithms/test/RebinToWorkspaceTest.h @@ -6,7 +6,7 @@ //-------------------- #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/RebinToWorkspace.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class RebinToWorkspaceTest : public CxxTest::TestSuite diff --git a/Code/Mantid/Framework/Algorithms/test/RenameWorkspaceTest.h b/Code/Mantid/Framework/Algorithms/test/RenameWorkspaceTest.h index a6e66db53f8..b91e860937f 100644 --- a/Code/Mantid/Framework/Algorithms/test/RenameWorkspaceTest.h +++ b/Code/Mantid/Framework/Algorithms/test/RenameWorkspaceTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/RenameWorkspace.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/ReplaceSpecialValuesTest.h b/Code/Mantid/Framework/Algorithms/test/ReplaceSpecialValuesTest.h index 1714b5cf3e2..19803982763 100644 --- a/Code/Mantid/Framework/Algorithms/test/ReplaceSpecialValuesTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ReplaceSpecialValuesTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/ReplaceSpecialValues.h" #include "MantidAPI/AnalysisDataService.h" #include <limits> diff --git a/Code/Mantid/Framework/Algorithms/test/SANSInstrumentCreationHelper.h b/Code/Mantid/Framework/Algorithms/test/SANSInstrumentCreationHelper.h deleted file mode 100644 index ddddd4863b9..00000000000 --- a/Code/Mantid/Framework/Algorithms/test/SANSInstrumentCreationHelper.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef SANSINSTRUMENTCREATIONHELPER_H_ -#define SANSINSTRUMENTCREATIONHELPER_H_ - -#include <cxxtest/TestSuite.h> -#include "MantidDataHandling/LoadInstrument.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidKernel/UnitFactory.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" -#include "MantidKernel/ConfigService.h" -#include "Poco/Path.h" -#include <boost/shared_array.hpp> - -using namespace Mantid::API; -using namespace Mantid::Kernel; -using namespace Mantid; - -class SANSInstrumentCreationHelper -{ -public: - - // Number of detector pixels in each dimension - static const int nBins = 30; - // The test instrument has 2 monitors - static const int nMonitors = 2; - - /* - * Generate a SANS test workspace, with instrument geometry. - * The geometry is the SANSTEST geometry, with a 30x30 pixel 2D detector. - * - * @param workspace: name of the workspace to be created. - */ - static DataObjects::Workspace2D_sptr createSANSInstrumentWorkspace(std::string workspace) - { - // Create a test workspace with test data with a well defined peak - // The test instrument has two monitor channels - DataObjects::Workspace2D_sptr ws = WorkspaceCreationHelper::Create2DWorkspace123(1,nBins*nBins+nMonitors,1); - Mantid::API::AnalysisDataService::Instance().addOrReplace(workspace, ws); - ws->getAxis(0)->unit() = Kernel::UnitFactory::Instance().create("Wavelength"); - ws->setYUnit(""); - for (int i = 0; i < ws->getNumberHistograms(); ++i) - { - ws->getAxis(1)->spectraNo(i) = i; - } - - // Load instrument geometry - runLoadInstrument("SANSTEST", ws); - runLoadMappingTable(ws, nBins, nBins); - - return ws; - } - - /** Run the sub-algorithm LoadInstrument (as for LoadRaw) - * @param inst_name The name written in the Nexus file - * @param workspace The workspace to insert the instrument into - */ - static void runLoadInstrument(const std::string & inst_name, - DataObjects::Workspace2D_sptr workspace) - { - // Determine the search directory for XML instrument definition files (IDFs) - std::string directoryName = Kernel::ConfigService::Instance().getString( - "instrumentDefinition.directory"); - if (directoryName.empty()) - { - // This is the assumed deployment directory for IDFs, where we need to be relative to the - // directory of the executable, not the current working directory. - directoryName = Poco::Path(Mantid::Kernel::ConfigService::Instance().getBaseDir()).resolve( - "../Instrument").toString(); - } - - // For Nexus Mantid processed, Instrument XML file name is read from nexus - std::string instrumentID = inst_name; - // force ID to upper case - std::transform(instrumentID.begin(), instrumentID.end(), instrumentID.begin(), toupper); - std::string fullPathIDF = directoryName + "/" + instrumentID + "_Definition.xml"; - - Mantid::DataHandling::LoadInstrument loadInst; - loadInst.initialize(); - // Now execute the sub-algorithm. Catch and log any error, but don't stop. - loadInst.setPropertyValue("Filename", fullPathIDF); - loadInst.setProperty<API::MatrixWorkspace_sptr> ("Workspace", workspace); - loadInst.execute(); - - } - - /** - * Populate spectra mapping to detector IDs - * - * @param workspace: Workspace2D object - * @param nxbins: number of bins in X - * @param nybins: number of bins in Y - */ - static void runLoadMappingTable(DataObjects::Workspace2D_sptr workspace, int nxbins, int nybins) - { - // Get the number of monitor channels - int nMonitors = 0; - boost::shared_ptr<Geometry::Instrument> instrument = workspace->getBaseInstrument(); - std::vector<int> monitors = instrument->getMonitors(); - nMonitors = monitors.size(); - - // Number of monitors should be consistent with data file format - if( nMonitors != 2 ) { - std::stringstream error; - error << "Geometry error for " << instrument->getName() << - ": Spice data format defines 2 monitors, " << nMonitors << " were/was found"; - throw std::runtime_error(error.str()); - } - - int ndet = nxbins*nybins + nMonitors; - boost::shared_array<int> udet(new int[ndet]); - boost::shared_array<int> spec(new int[ndet]); - - // Generate mapping of detector/channel IDs to spectrum ID - - // Detector/channel counter - int icount = 0; - - // Monitor: IDs start at 1 and increment by 1 - for(int i=0; i<nMonitors; i++) - { - spec[icount] = icount; - udet[icount] = icount+1; - icount++; - } - - // Detector pixels - for(int ix=0; ix<nxbins; ix++) - { - for(int iy=0; iy<nybins; iy++) - { - spec[icount] = icount; - udet[icount] = 1000000 + iy*1000 + ix; - icount++; - } - } - - // Populate the Spectra Map with parameters - workspace->mutableSpectraMap().populate(spec.get(), udet.get(), ndet); - } - - -}; - -#endif /*SANSINSTRUMENTCREATIONHELPER_H_*/ diff --git a/Code/Mantid/Framework/Algorithms/test/ScaleTest.h b/Code/Mantid/Framework/Algorithms/test/ScaleTest.h index f90d20f88d9..7c685ea109b 100644 --- a/Code/Mantid/Framework/Algorithms/test/ScaleTest.h +++ b/Code/Mantid/Framework/Algorithms/test/ScaleTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> #include "MantidAlgorithms/Scale.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" class ScaleTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Algorithms/test/SolidAngleTest.h b/Code/Mantid/Framework/Algorithms/test/SolidAngleTest.h index b382a18a4f7..401a368234d 100644 --- a/Code/Mantid/Framework/Algorithms/test/SolidAngleTest.h +++ b/Code/Mantid/Framework/Algorithms/test/SolidAngleTest.h @@ -2,7 +2,7 @@ #define SOLIDANGLETEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/SolidAngle.h" #include "MantidKernel/PhysicalConstants.h" diff --git a/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h b/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h index 7a39fc1f7c4..ee52b3c136e 100644 --- a/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h +++ b/Code/Mantid/Framework/Algorithms/test/StripPeaksTest.h @@ -2,7 +2,7 @@ #define STRIPPEAKSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/StripPeaks.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/StripVanadiumPeaksTest.h b/Code/Mantid/Framework/Algorithms/test/StripVanadiumPeaksTest.h index 26be7e79813..2c1b080b10b 100644 --- a/Code/Mantid/Framework/Algorithms/test/StripVanadiumPeaksTest.h +++ b/Code/Mantid/Framework/Algorithms/test/StripVanadiumPeaksTest.h @@ -2,7 +2,7 @@ #define STRIPVANADIUMPEAKSTEST_H_ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/StripVanadiumPeaks.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/UnitFactory.h" diff --git a/Code/Mantid/Framework/Algorithms/test/SumSpectraTest.h b/Code/Mantid/Framework/Algorithms/test/SumSpectraTest.h index c081023ebf4..57a0816286e 100644 --- a/Code/Mantid/Framework/Algorithms/test/SumSpectraTest.h +++ b/Code/Mantid/Framework/Algorithms/test/SumSpectraTest.h @@ -10,7 +10,7 @@ #include "MantidDataObjects/Workspace2D.h" #include "MantidDataHandling/LoadRaw3.h" #include "MantidDataHandling/MaskDetectors.h" -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace Mantid::API; using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/Algorithms/test/TofCorrectionTest.h b/Code/Mantid/Framework/Algorithms/test/TofCorrectionTest.h index 79450aeec9e..eb85555562f 100644 --- a/Code/Mantid/Framework/Algorithms/test/TofCorrectionTest.h +++ b/Code/Mantid/Framework/Algorithms/test/TofCorrectionTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/TofCorrection.h" diff --git a/Code/Mantid/Framework/Algorithms/test/TransposeTest.h b/Code/Mantid/Framework/Algorithms/test/TransposeTest.h index 771370b9917..59dd644e7a9 100644 --- a/Code/Mantid/Framework/Algorithms/test/TransposeTest.h +++ b/Code/Mantid/Framework/Algorithms/test/TransposeTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Transpose.h" diff --git a/Code/Mantid/Framework/Algorithms/test/UnaryOperationTest.h b/Code/Mantid/Framework/Algorithms/test/UnaryOperationTest.h index a853544f3ca..3c575a04d01 100644 --- a/Code/Mantid/Framework/Algorithms/test/UnaryOperationTest.h +++ b/Code/Mantid/Framework/Algorithms/test/UnaryOperationTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/UnaryOperation.h" #include "MantidAPI/AnalysisDataService.h" diff --git a/Code/Mantid/Framework/Algorithms/test/WorkspaceCreationHelper.hh b/Code/Mantid/Framework/Algorithms/test/WorkspaceCreationHelper.hh deleted file mode 100644 index d2bd34fc189..00000000000 --- a/Code/Mantid/Framework/Algorithms/test/WorkspaceCreationHelper.hh +++ /dev/null @@ -1,471 +0,0 @@ -// The odd line ending on this file is to prevent cxxtest attempting to parse this collection of helper functions as if -// it were a test suite. - -#ifndef WORKSPACECREATIONHELPER_H_ -#define WORKSPACECREATIONHELPER_H_ - -#include <cmath> - -#include "MantidAPI/AnalysisDataService.h" -#include "MantidAPI/WorkspaceFactory.h" -#include "MantidGeometry/Instrument/Detector.h" -#include "MantidGeometry/Instrument/ParameterMap.h" -#include "MantidGeometry/Objects/ShapeFactory.h" -#include "MantidDataObjects/EventWorkspace.h" -#include "MantidDataObjects/Workspace2D.h" -#include "MantidDataObjects/Workspace1D.h" -#include "MantidDataObjects/WorkspaceSingleValue.h" - -#include "../../Geometry/test/ComponentCreationHelpers.hh" - -using namespace Mantid; -using namespace Mantid::DataObjects; -using namespace Mantid::Kernel; -using namespace Mantid::API; -using namespace Mantid::Geometry; - -class WorkspaceCreationHelper -{ -public: - - template<typename T> - class FibSeries - { - private: - T x1; /// Initial value 1; - T x2; /// Initial value 2; - - public: - - FibSeries() : x1(1),x2(1) {} - T operator()() { const T out(x1+x2); x1=x2; x2=out; return out; } - }; - - static Workspace1D_sptr Create1DWorkspaceRand(int size) - { - MantidVecPtr x1,y1,e1; - x1.access().resize(size,1); - y1.access().resize(size); - std::generate(y1.access().begin(),y1.access().end(),rand); - e1.access().resize(size); - std::generate(e1.access().begin(),e1.access().end(),rand); - Workspace1D_sptr retVal(new Workspace1D); - retVal->initialize(1,size,size); - retVal->setX(x1); - retVal->setData(y1,e1); - return retVal; - } - - static Workspace1D_sptr Create1DWorkspaceConstant(int size, double value, double error) - { - MantidVecPtr x1,y1,e1; - x1.access().resize(size,1); - y1.access().resize(size); - std::fill(y1.access().begin(), y1.access().end(), value); - e1.access().resize(size); - std::fill(y1.access().begin(), y1.access().end(), error); - Workspace1D_sptr retVal(new Workspace1D); - retVal->initialize(1,size,size); - retVal->setX(x1); - retVal->setData(y1,e1); - return retVal; - } - - static Workspace1D_sptr Create1DWorkspaceFib(int size) - { - MantidVecPtr x1,y1,e1; - x1.access().resize(size,1); - y1.access().resize(size); - std::generate(y1.access().begin(),y1.access().end(),FibSeries<double>()); - e1.access().resize(size); - Workspace1D_sptr retVal(new Workspace1D); - retVal->initialize(1,size,size); - retVal->setX(x1); - retVal->setData(y1,e1); - return retVal; - } - static Workspace2D_sptr Create2DWorkspace(int xlen, int ylen) - { - return Create2DWorkspaceBinned(xlen, ylen); - } - - static Workspace2D_sptr Create2DWorkspace123(int xlen, int ylen,bool isHist=0, const std::set<int> & maskedWorkspaceIndices = std::set<int>()) - { - MantidVecPtr x1,y1,e1; - x1.access().resize(isHist?xlen+1:xlen,1); - y1.access().resize(xlen,2); - e1.access().resize(xlen,3); - Workspace2D_sptr retVal(new Workspace2D); - retVal->initialize(ylen,isHist?xlen+1:xlen,xlen); - for (int i=0; i< ylen; i++) - { - retVal->setX(i,x1); - retVal->setData(i,y1,e1); - } - - retVal = maskSpectra(retVal, maskedWorkspaceIndices); - - return retVal; - } - - static Workspace2D_sptr Create2DWorkspace154(int xlen, int ylen,bool isHist=0, const std::set<int> & maskedWorkspaceIndices = std::set<int>()) - { - MantidVecPtr x1,y1,e1; - x1.access().resize(isHist?xlen+1:xlen,1); - y1.access().resize(xlen,5); - e1.access().resize(xlen,4); - Workspace2D_sptr retVal(new Workspace2D); - retVal->initialize(ylen,isHist?xlen+1:xlen,xlen); - for (int i=0; i< ylen; i++) - { - retVal->setX(i,x1); - retVal->setData(i,y1,e1); - } - - retVal = maskSpectra(retVal, maskedWorkspaceIndices); - - return retVal; - } - - static Workspace2D_sptr maskSpectra(Workspace2D_sptr workspace, const std::set<int> & maskedWorkspaceIndices) - { - // We need detectors to be able to mask them. - workspace->setInstrument(boost::shared_ptr<Instrument>(new Instrument)); - boost::shared_ptr<Instrument> instrument = workspace->getBaseInstrument(); - - std::string xmlShape = "<sphere id=\"shape\"> "; - xmlShape += "<centre x=\"0.0\" y=\"0.0\" z=\"0.0\" /> " ; - xmlShape += "<radius val=\"0.05\" /> " ; - xmlShape += "</sphere>"; - xmlShape += "<algebra val=\"shape\" /> "; - - ShapeFactory sFactory; - boost::shared_ptr<Object> shape = sFactory.createShape(xmlShape); - - const int nhist(workspace->getNumberHistograms()); - - ParameterMap& pmap = workspace->instrumentParameters(); - for( int i = 0; i < nhist; ++i ) - { - workspace->getAxis(1)->spectraNo(i) = i; - } - workspace->mutableSpectraMap().populateSimple(0, nhist); - - for( int i = 0; i < nhist; ++i ) - { - Detector *det = new Detector("det",shape, NULL); - det->setPos(i,i+1,1); - det->setID(i); - instrument->add(det); - instrument->markAsDetector(det); - if ( maskedWorkspaceIndices.find(i) != maskedWorkspaceIndices.end() ) - { - pmap.addBool(det,"masked",true); - } - } - return workspace; - } - - /** Create a 2D workspace with this many histograms and bins. - * Filled with Y = 2.0 and E = sqrt(2.0)w - */ - static Workspace2D_sptr Create2DWorkspaceBinned(int nhist, int nbins, double x0=0.0, double deltax = 1.0) - { - MantidVecPtr x,y,e; - x.access().resize(nbins+1); - y.access().resize(nbins,2); - e.access().resize(nbins,sqrt(2.0)); - for (int i =0; i < nbins+1; ++i) - { - x.access()[i] = x0+i*deltax; - } - Workspace2D_sptr retVal(new Workspace2D); - retVal->initialize(nhist,nbins+1,nbins); - for (int i=0; i< nhist; i++) - { - retVal->setX(i,x); - retVal->setData(i,y,e); - retVal->getAxis(1)->setValue(i,i); - } - - return retVal; - } - - /** Create a 2D workspace with this many histograms and bins. The bins are assumed to be non-uniform and given by the input array - * Filled with Y = 2.0 and E = sqrt(2.0)w - */ - static Workspace2D_sptr Create2DWorkspaceBinned(int nhist, const int numBoundaries, const double xBoundaries[]) - { - MantidVecPtr x,y,e; - const int numBins = numBoundaries - 1; - x.access().resize(numBoundaries); - y.access().resize(numBins,2); - e.access().resize(numBins,sqrt(2.0)); - for (int i = 0; i < numBoundaries; ++i) - { - x.access()[i] = xBoundaries[i]; - } - Workspace2D_sptr retVal(new Workspace2D); - retVal->initialize(nhist,numBins+1,numBins); - for (int i=0; i< nhist; i++) - { - retVal->setX(i,x); - retVal->setData(i,y,e); - } - - return retVal; - } - - - /** - * Create a test workspace with a fully defined instrument - * Each spectra will have a cylindrical detector defined 2*cylinder_radius away from the centre of the - * pervious. - * Data filled with: Y: 2.0, E: sqrt(2.0), X: nbins of width 1 starting at 0 - */ - static Workspace2D_sptr create2DWorkspaceWithFullInstrument(int nhist, int nbins, bool includeMonitors = false) - { - Workspace2D_sptr space = Create2DWorkspaceBinned(nhist, nbins); - boost::shared_ptr<Instrument> testInst(new Instrument("testInst")); - space->setInstrument(testInst); - - // Create detectors for each spectra and set a simple mapping between pixel ID = spectrum number = index - const double pixelRadius(0.05); - Object_sptr pixelShape = - ComponentCreationHelper::createCappedCylinder(pixelRadius, 0.02, V3D(0.0,0.0,0.0), V3D(0.,1.0,0.), "tube"); - - const double detXPos(5.0); - int ndets = nhist; - if( includeMonitors ) ndets -= 2; - for( int i = 0; i < ndets; ++i ) - { - std::ostringstream lexer; - lexer << "pixel-" << i << ")"; - Detector * physicalPixel = new Detector(lexer.str(), pixelShape, testInst.get()); - const double ypos = i*2.0*pixelRadius; - physicalPixel->setPos(detXPos, ypos,0.0); - physicalPixel->setID(i); - testInst->add(physicalPixel); - testInst->markAsDetector(physicalPixel); - } - - if( includeMonitors ) - { - Detector *monitor1 = new Detector("mon1", Object_sptr(), testInst.get()); - monitor1->setPos(-9.0,0.0,0.0); - monitor1->setID(ndets); - testInst->add(monitor1); - testInst->markAsMonitor(monitor1); - - Detector *monitor2 = new Detector("mon2", Object_sptr(), testInst.get()); - monitor2->setPos(-2.0,0.0,0.0); - monitor2->setID(ndets+1); - testInst->add(monitor2); - testInst->markAsMonitor(monitor2); - - space->mutableSpectraMap().populateSimple(0, ndets+2); - } - else - { - space->mutableSpectraMap().populateSimple(0, ndets); - } - - // Define a source and sample position - //Define a source component - ObjComponent *source = new ObjComponent("moderator", Object_sptr(), testInst.get()); - source->setPos(V3D(-20, 0.0, 0.0)); - testInst->add(source); - testInst->markAsSource(source); - - // Define a sample as a simple sphere - ObjComponent *sample = new ObjComponent("samplePos", Object_sptr(), testInst.get()); - testInst->setPos(0.0, 0.0, 0.0); - testInst->add(sample); - testInst->markAsSamplePos(sample); - - - return space; - } - - static WorkspaceSingleValue_sptr CreateWorkspaceSingleValue(double value) - { - WorkspaceSingleValue_sptr retVal(new WorkspaceSingleValue(value,sqrt(value))); - return retVal; - } - - static WorkspaceSingleValue_sptr CreateWorkspaceSingleValueWithError(double value, double error) - { - WorkspaceSingleValue_sptr retVal(new WorkspaceSingleValue(value, error)); - return retVal; - } - - /** Perform some finalization on event workspace stuff */ - static void EventWorkspace_Finalize(EventWorkspace_sptr ew) - { - // get a proton charge - ew->mutableRun().integrateProtonCharge(); - } - - - /** Create event workspace with: - * 500 pixels - * 1000 histogrammed bins. - */ - static EventWorkspace_sptr CreateEventWorkspace() - { - return CreateEventWorkspace(500,1001,100,1000); - } - - /** Create event workspace with: - * 50 pixels - * 100 histogrammed bins from 0.0 in steps of 1.0 - * 200 events; two in each bin, at time 0.5, 1.5, etc. - * PulseTime = 1 second, 2 seconds, etc. - */ - static EventWorkspace_sptr CreateEventWorkspace2() - { - return CreateEventWorkspace(50, 100, 100, 0.0, 1.0, 2); - } - - /** Create event workspace - */ - static EventWorkspace_sptr CreateEventWorkspace(int numPixels, - int numBins, int numEvents = 100, double x0=0.0, double binDelta=1.0, - int eventPattern = 1, int start_at_pixelID = 0) - { - //add one to the number of bins as this is histogram - numBins++; - - EventWorkspace_sptr retVal(new EventWorkspace); - retVal->initialize(numPixels,1,1); - - //Make fake events - if (eventPattern) // 0 == no events - { - for (int pix= start_at_pixelID+0; pix < start_at_pixelID+numPixels; pix++) - { - for (int i=0; i<numEvents; i++) - { - if (eventPattern == 1) // 0, 1 diagonal pattern - retVal->getEventListAtPixelID(pix) += TofEvent((pix+i+0.5)*binDelta, Kernel::DateAndTime(i,0)); - else if (eventPattern == 2) // solid 2 - { - retVal->getEventListAtPixelID(pix) += TofEvent((i+0.5)*binDelta, Kernel::DateAndTime(i,0)); - retVal->getEventListAtPixelID(pix) += TofEvent((i+0.5)*binDelta, Kernel::DateAndTime(i,0)); - } - else if (eventPattern == 3) // solid 1 - { - retVal->getEventListAtPixelID(pix) += TofEvent((i+0.5)*binDelta, Kernel::DateAndTime(i,0)); - } - } - } - } - retVal->doneLoadingData(); - - //Create the x-axis for histogramming. - MantidVecPtr x1; - MantidVec& xRef = x1.access(); - xRef.resize(numBins); - for (int i = 0; i < numBins; ++i) - { - xRef[i] = x0+i*binDelta; - } - - //Set all the histograms at once. - retVal->setAllX(x1); - - return retVal; - } - - - /** Create event workspace - */ - static EventWorkspace_sptr CreateGroupedEventWorkspace(std::vector< std::vector<int> > groups, - int numBins, double binDelta=1.0) - { - - EventWorkspace_sptr retVal(new EventWorkspace); - retVal->initialize(1,2,1); - - for (int g=0; g < groups.size(); g++) - { - std::vector<int> dets = groups[g]; - for (std::vector<int>::iterator it = dets.begin(); it != dets.end(); it++) - { - for (int i=0; i < numBins; i++) - retVal->getOrAddEventList(g) += TofEvent((i+0.5)*binDelta, 1); - retVal->getOrAddEventList(g).addDetectorID( *it ); - } - } - - retVal->doneAddingEventLists(); - - //Create the x-axis for histogramming. - MantidVecPtr x1; - MantidVec& xRef = x1.access(); - double x0=0; - xRef.resize(numBins); - for (int i = 0; i < numBins; ++i) - { - xRef[i] = x0+i*binDelta; - } - - //Set all the histograms at once. - retVal->setAllX(x1); - - return retVal; - } - - - - - //not strictly creating a workspace, but really helpfull to see what one contains - static void DisplayDataY(const MatrixWorkspace_sptr ws) - { - const int numHists = ws->getNumberHistograms(); - for (int i = 0; i < numHists; ++i) - { - std::cout << "Histogram " << i << " = "; - for (int j = 0; j < ws->blocksize(); ++j) - { - std::cout <<ws->readY(i)[j]<<" "; - } - std::cout<<std::endl; - } - } - static void DisplayData(const MatrixWorkspace_sptr ws) - { - DisplayDataX(ws); - } - //not strictly creating a workspace, but really helpfull to see what one contains - static void DisplayDataX(const MatrixWorkspace_sptr ws) - { - const int numHists = ws->getNumberHistograms(); - for (int i = 0; i < numHists; ++i) - { - std::cout << "Histogram " << i << " = "; - for (int j = 0; j < ws->blocksize(); ++j) - { - std::cout <<ws->readX(i)[j]<<" "; - } - std::cout<<std::endl; - } - } - //not strictly creating a workspace, but really helpfull to see what one contains - static void DisplayDataE(const MatrixWorkspace_sptr ws) - { - const int numHists = ws->getNumberHistograms(); - for (int i = 0; i < numHists; ++i) - { - std::cout << "Histogram " << i << " = "; - for (int j = 0; j < ws->blocksize(); ++j) - { - std::cout <<ws->readE(i)[j]<<" "; - } - std::cout<<std::endl; - } - } - -}; - -#endif /*WORKSPACECREATIONHELPER_H_*/ diff --git a/Code/Mantid/Framework/Algorithms/test/WorkspaceGroupTest.h b/Code/Mantid/Framework/Algorithms/test/WorkspaceGroupTest.h index b4401b23739..d2930c053fe 100644 --- a/Code/Mantid/Framework/Algorithms/test/WorkspaceGroupTest.h +++ b/Code/Mantid/Framework/Algorithms/test/WorkspaceGroupTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include <cmath> -#include "WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAlgorithms/Plus.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/WorkspaceGroup.h" diff --git a/Code/Mantid/Framework/Build/Tests/SConscript b/Code/Mantid/Framework/Build/Tests/SConscript index 99152adbe8e..fe2f5b68b23 100644 --- a/Code/Mantid/Framework/Build/Tests/SConscript +++ b/Code/Mantid/Framework/Build/Tests/SConscript @@ -14,6 +14,7 @@ cppPath = env['CPPPATH'] myenv = env.Clone() myenv.Append(CPPDEFINES=[('IN_MANTID_TESTS',1)]) myenv.Append(CPPPATH=['../../../../Third_Party/src/cxxtest']) +myenv.Append(CPPPATH=['../../TestHelpers/inc']) myenv.Append(LIBPATH=libDirList) # Add the location of the gmock library @@ -31,7 +32,7 @@ elif dist == 'maverick': elif dist == 'lucid': myenv.Append(LIBPATH=[third_party_path+'ubuntu-10.04']) -myenv.Append(LIBS=libList+['gmock']) +myenv.Append(LIBS=libList+['gmock', 'MantidTestHelpers']) #GET LIST OF TESTS path = '../../' diff --git a/Code/Mantid/Framework/DataHandling/test/CreateSampleShapeTest.h b/Code/Mantid/Framework/DataHandling/test/CreateSampleShapeTest.h index 4eeb0bab87e..7b89ad0ba51 100644 --- a/Code/Mantid/Framework/DataHandling/test/CreateSampleShapeTest.h +++ b/Code/Mantid/Framework/DataHandling/test/CreateSampleShapeTest.h @@ -11,7 +11,7 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/Sample.h" #include "MantidGeometry/Objects/Object.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" using namespace Mantid::DataHandling; diff --git a/Code/Mantid/Framework/DataHandling/test/SaveFocussedXYETest.h b/Code/Mantid/Framework/DataHandling/test/SaveFocussedXYETest.h index df3c61f6c84..50217657ae1 100644 --- a/Code/Mantid/Framework/DataHandling/test/SaveFocussedXYETest.h +++ b/Code/Mantid/Framework/DataHandling/test/SaveFocussedXYETest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> #include "MantidDataHandling/SaveFocusedXYE.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/AnalysisDataService.h" #include "MantidKernel/UnitFactory.h" diff --git a/Code/Mantid/Framework/DataHandling/test/SaveRKHTest.h b/Code/Mantid/Framework/DataHandling/test/SaveRKHTest.h index 56b4b755ea9..361941e87d8 100644 --- a/Code/Mantid/Framework/DataHandling/test/SaveRKHTest.h +++ b/Code/Mantid/Framework/DataHandling/test/SaveRKHTest.h @@ -3,7 +3,7 @@ #include <cxxtest/TestSuite.h> #include "MantidDataHandling/SaveRKH.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include <fstream> #include "Poco/File.h" diff --git a/Code/Mantid/Framework/DataHandling/test/SaveSPETest.h b/Code/Mantid/Framework/DataHandling/test/SaveSPETest.h index 26ce788fcf3..45b565f210c 100644 --- a/Code/Mantid/Framework/DataHandling/test/SaveSPETest.h +++ b/Code/Mantid/Framework/DataHandling/test/SaveSPETest.h @@ -5,7 +5,7 @@ #include "MantidDataHandling/SaveSPE.h" #include "MantidKernel/UnitFactory.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/SpectraDetectorMap.h" #include "MantidAPI/NumericAxis.h" diff --git a/Code/Mantid/Framework/DataHandling/test/SetScalingPSDTest.h b/Code/Mantid/Framework/DataHandling/test/SetScalingPSDTest.h index e45af66965d..4e7f1ad9e19 100644 --- a/Code/Mantid/Framework/DataHandling/test/SetScalingPSDTest.h +++ b/Code/Mantid/Framework/DataHandling/test/SetScalingPSDTest.h @@ -4,7 +4,7 @@ #include <cxxtest/TestSuite.h> #include "MantidDataHandling/SetScalingPSD.h" #include "MantidDataHandling/LoadEmptyInstrument.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidKernel/ConfigService.h" #include <Poco/File.h> #include <Poco/Path.h> diff --git a/Code/Mantid/Framework/DataObjects/test/EventWorkspaceTest.h b/Code/Mantid/Framework/DataObjects/test/EventWorkspaceTest.h index d78a707aa9b..72924a6267c 100644 --- a/Code/Mantid/Framework/DataObjects/test/EventWorkspaceTest.h +++ b/Code/Mantid/Framework/DataObjects/test/EventWorkspaceTest.h @@ -14,7 +14,7 @@ #include "MantidAPI/SpectraDetectorMap.h" #include "boost/date_time/gregorian/gregorian.hpp" #include "boost/date_time/posix_time/posix_time.hpp" -#include "../../Geometry/test/ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidKernel/Timer.h" diff --git a/Code/Mantid/Framework/Geometry/test/CompAssemblyTest.h b/Code/Mantid/Framework/Geometry/test/CompAssemblyTest.h index 68c8ad36cec..f8c53a6218d 100644 --- a/Code/Mantid/Framework/Geometry/test/CompAssemblyTest.h +++ b/Code/Mantid/Framework/Geometry/test/CompAssemblyTest.h @@ -8,7 +8,7 @@ #include "MantidGeometry/Instrument/CompAssembly.h" #include "MantidGeometry/V3D.h" #include "MantidGeometry/Quat.h" -#include "ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/Geometry/test/ComponentCreationHelpers.hh b/Code/Mantid/Framework/Geometry/test/ComponentCreationHelpers.hh deleted file mode 100644 index e3b4f150063..00000000000 --- a/Code/Mantid/Framework/Geometry/test/ComponentCreationHelpers.hh +++ /dev/null @@ -1,351 +0,0 @@ -#ifndef COMPONENTCREATIONHELPERS_H_ -#define COMPONENTCREATIONHELPERS_H_ - -#include "MantidGeometry/Instrument/CompAssembly.h" -#include "MantidGeometry/Instrument/ObjComponent.h" -#include "MantidGeometry/Instrument/DetectorGroup.h" -#include "MantidGeometry/Instrument/Detector.h" -#include "MantidGeometry/Instrument/Instrument.h" -#include "MantidGeometry/Instrument/RectangularDetector.h" -#include "MantidGeometry/Objects/Object.h" -#include "MantidGeometry/Objects/ShapeFactory.h" - -namespace ComponentCreationHelper -{ - -using namespace Mantid; -using namespace Mantid::Geometry; - - /** - A set of helper functions for creating various component structures for the unit tests. - - Copyright © 2010 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory - - This file is part of Mantid. - - Mantid is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - Mantid is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - - File change history is stored at: <https://svn.mantidproject.org/mantid/trunk/Code/Mantid> - Code Documentation is available at: <http://doxygen.mantidproject.org> - */ - - - //---------------------------------------------------------------------------------------------- - /** - * Create a capped cylinder object - */ - static Object_sptr createCappedCylinder(double radius, double height, const V3D & baseCentre, const V3D & axis, const std::string & id) - { - std::ostringstream xml; - xml << "<cylinder id=\"" << id << "\">" - << "<centre-of-bottom-base x=\"" << baseCentre.X() << "\" y=\"" << baseCentre.Y() << "\" z=\"" << baseCentre.Z() << "\"/>" - << "<axis x=\"" << axis.X() << "\" y=\"" << axis.Y() << "\" z=\"" << axis.Z() << "\"/>" - << "<radius val=\"" << radius << "\" />" - << "<height val=\"" << height << "\" />" - << "</cylinder>"; - - ShapeFactory shapeMaker; - return shapeMaker.createShape(xml.str()); - } - - - //---------------------------------------------------------------------------------------------- - - /** - * Return the XML for a sphere. - */ - std::string sphereXML(double radius, const V3D & centre, const std::string & id) - { - std::ostringstream xml; - xml << "<sphere id=\"" << id << "\">" - << "<centre x=\"" << centre.X() << "\" y=\"" << centre.Y() << "\" z=\"" << centre.Z() << "\" />" - << "<radius val=\"" << radius << "\" />" - << "</sphere>"; - return xml.str(); - } - - /** - * Create a sphere object - */ - static Object_sptr createSphere(double radius, const V3D & centre, const std::string & id) - { - ShapeFactory shapeMaker; - return shapeMaker.createShape(sphereXML(radius, centre, id)); - } - - - //---------------------------------------------------------------------------------------------- - /** Create a cuboid shape for your pixels */ - Object_sptr createCuboid(double x_side_length, double y_side_length = -1.0, double z_side_length = -1.0) - { - double szX = x_side_length; - double szY = (y_side_length == -1.0 ? szX : y_side_length); - double szZ = (z_side_length == -1.0 ? szX : z_side_length); - std::ostringstream xmlShapeStream; - xmlShapeStream - << " <cuboid id=\"detector-shape\"> " - << "<left-front-bottom-point x=\""<<szX<<"\" y=\""<<-szY<<"\" z=\""<<-szZ<<"\" /> " - << "<left-front-top-point x=\""<<szX<<"\" y=\""<<-szY<<"\" z=\""<<szZ<<"\" /> " - << "<left-back-bottom-point x=\""<<-szX<<"\" y=\""<<-szY<<"\" z=\""<<-szZ<<"\" /> " - << "<right-front-bottom-point x=\""<<szX<<"\" y=\""<<szY<<"\" z=\""<<-szZ<<"\" /> " - << "</cuboid>"; - - std::string xmlCuboidShape(xmlShapeStream.str()); - ShapeFactory shapeCreator; - Object_sptr cuboidShape = shapeCreator.createShape(xmlCuboidShape); - return cuboidShape; - } - - - //---------------------------------------------------------------------------------------------- - /** - * Create a component assembly at the origin made up of 4 cylindrical detectors - */ - static boost::shared_ptr<CompAssembly> createTestAssemblyOfFourCylinders() - { - boost::shared_ptr<CompAssembly> bank = boost::shared_ptr<CompAssembly>(new CompAssembly("BankName")); - // One object - Object_sptr pixelShape = ComponentCreationHelper::createCappedCylinder(0.5, 1.5, V3D(0.0,0.0,0.0), V3D(0.,1.0,0.), "tube"); - // Four object components - for( size_t i = 1; i < 5; ++i ) - { - ObjComponent * physicalPixel = new ObjComponent("pixel", pixelShape); - physicalPixel->setPos(static_cast<double>(i),0.0,0.0); - bank->add(physicalPixel); - } - - return bank; - } - - /** - * Create an object component that has a defined shape - */ - static ObjComponent * createSingleObjectComponent() - { - Object_sptr pixelShape = ComponentCreationHelper::createCappedCylinder(0.5, 1.5, V3D(0.0,0.0,0.0), V3D(0.,1.0,0.), "tube"); - return new ObjComponent("pixel", pixelShape); - } - - /** - * Create a hollow shell, i.e. the intersection of two spheres or radius r1 and r2 - */ - static Object_sptr createHollowShell(double innerRadius, double outerRadius, const V3D & centre = V3D()) - { - std::string wholeXML = - sphereXML(innerRadius, centre, "inner") + "\n" + - sphereXML(outerRadius, centre, "outer") + "\n" + - "<algebra val=\"(outer (# inner))\" />"; - - ShapeFactory shapeMaker; - return shapeMaker.createShape(wholeXML); - } - - //---------------------------------------------------------------------------------------------- - /** - * Create a detector group containing 5 detectors - */ - static boost::shared_ptr<DetectorGroup> createDetectorGroupWith5CylindricalDetectors() - { - const int ndets = 5; - std::vector<boost::shared_ptr<IDetector> > groupMembers(ndets); - // One object - Object_sptr detShape = ComponentCreationHelper::createCappedCylinder(0.5, 1.5, V3D(0.0,0.0,0.0), V3D(0.,1.0,0.), "tube"); - for( int i = 0; i < ndets; ++i ) - { - std::ostringstream os; - os << "d" << i; - boost::shared_ptr<Detector> det(new Detector(os.str(), detShape, NULL)); - det->setID(i+1); - det->setPos((double)(i+1), 2.0, 2.0); - groupMembers[i] = det; - } - - return boost::shared_ptr<DetectorGroup>(new DetectorGroup(groupMembers, false)); - } - - - //---------------------------------------------------------------------------------------------- - /** - * Create a group of two monitors - */ - static boost::shared_ptr<DetectorGroup> createGroupOfTwoMonitors() - { - const int ndets(2); - std::vector<boost::shared_ptr<IDetector> > groupMembers(ndets); - for( int i = 0; i < ndets; ++i ) - { - std::ostringstream os; - os << "m" << i; - boost::shared_ptr<Detector> det(new Detector(os.str(), NULL)); - det->setID(i+1); - det->setPos((double)(i+1), 2.0, 2.0); - det->markAsMonitor(); - groupMembers[i] = det; - } - return boost::shared_ptr<DetectorGroup>(new DetectorGroup(groupMembers, false)); - } - - - //---------------------------------------------------------------------------------------------- - /** - * Create an test instrument with n panels of 9 cylindrical detectors, a source and spherical sample shape. - * - * @param num_banks: number of 9-cylinder banks to create - * @param verbose: prints out the instrument after creation. - */ - static IInstrument_sptr createTestInstrumentCylindrical(int num_banks, - bool verbose = false) - { - boost::shared_ptr<Instrument> testInst(new Instrument("basic")); - - const double cylRadius(0.004); - const double cylHeight(0.0002); - // One object - Object_sptr pixelShape = ComponentCreationHelper::createCappedCylinder(cylRadius, cylHeight, V3D(0.0,-cylHeight/2.0,0.0), V3D(0.,1.0,0.), "pixel-shape"); - - //Just increment pixel ID's - int pixelID = 1; - - for (int banknum=1; banknum <= num_banks; banknum++) - { - //Make a new bank - std::ostringstream bankname; - bankname << "bank" << banknum; - CompAssembly *bank = new CompAssembly(bankname.str()); - - // Four object components - for( int i = -1; i < 2; ++i ) - { - for( int j = -1; j < 2; ++j ) - { - std::ostringstream lexer; - lexer << "pixel-(" << j << "," << i << ")"; - Detector * physicalPixel = new Detector(lexer.str(), pixelShape, bank); - const double xpos = j*cylRadius*2.0; - const double ypos = i*cylHeight; - physicalPixel->setPos(xpos, ypos,0.0); - physicalPixel->setID(pixelID); - pixelID++; - bank->add(physicalPixel); - testInst->markAsDetector(physicalPixel); - } - } - - testInst->add(bank); - bank->setPos(V3D(0.0, 0.0, 5.0*banknum)); - } - - //Define a source component - ObjComponent *source = new ObjComponent("moderator", Object_sptr(new Object), testInst.get()); - source->setPos(V3D(0.0, 0.0, -10.)); - testInst->add(source); - testInst->markAsSource(source); - - // Define a sample as a simple sphere - Object_sptr sampleSphere = createSphere(0.001, V3D(0.0, 0.0, 0.0), "sample-shape"); - ObjComponent *sample = new ObjComponent("sample", sampleSphere, testInst.get()); - testInst->setPos(0.0, 0.0, 0.0); - testInst->add(sample); - testInst->markAsSamplePos(sample); - - if( verbose ) - { - std::cout << "\n\n=== Testing bank positions ==\n"; - const int nchilds = testInst->nelements(); - for(int i = 0; i < nchilds; ++i ) - { - boost::shared_ptr<IComponent> child = testInst->getChild(i); - std::cout << "Component " << i << " at pos " << child->getPos() << "\n"; - if( boost::shared_ptr<ICompAssembly> assem = boost::dynamic_pointer_cast<ICompAssembly>(child) ) - { - for(int j = 0; j < assem->nelements(); ++j ) - { - boost::shared_ptr<IComponent> comp = assem->getChild(j); - std::cout << "Child " << j << " at pos " << comp->getPos() << "\n"; - } - } - } - std::cout << "==================================\n"; - } - - return testInst; - } - - - - - //---------------------------------------------------------------------------------------------- - /** - * Create an test instrument with n panels of rectangular detectors, pixels*pixels in size, a source and spherical sample shape. - * - * @param num_banks: number of 9-cylinder banks to create - * @param verbose: prints out the instrument after creation. - */ - static IInstrument_sptr createTestInstrumentRectangular(int num_banks, int pixels) - { - boost::shared_ptr<Instrument> testInst(new Instrument("basic_rect")); - - const double cylRadius(0.004); - const double cylHeight(0.0002); - // One object - Object_sptr pixelShape = ComponentCreationHelper::createCappedCylinder(cylRadius, cylHeight, V3D(0.0,-cylHeight/2.0,0.0), V3D(0.,1.0,0.), "pixel-shape"); - - //Just increment pixel ID's - int pixelID = 1; - - for (int banknum=1; banknum <= num_banks; banknum++) - { - //Make a new bank - std::ostringstream bankname; - bankname << "bank" << banknum; - - RectangularDetector * bank = new RectangularDetector(bankname.str()); - bank->initialize(pixelShape, - pixels, 0.0, cylRadius*2, - pixels, 0.0, cylRadius*2, - banknum*pixels*pixels, true, pixels); - - // Mark them all as detectors - for (int i=0; i < bank->nelements(); i++) - { - boost::shared_ptr<Geometry::Detector> detector = boost::dynamic_pointer_cast<Geometry::Detector>((*bank)[i]); - if (detector) - { - //Mark it as a detector (add to the instrument cache) - testInst->markAsDetector(detector.get()); - } - } - - testInst->add(bank); - bank->setPos(V3D(0.0, 0.0, 5.0*banknum)); - } - - //Define a source component - ObjComponent *source = new ObjComponent("moderator", Object_sptr(new Object), testInst.get()); - source->setPos(V3D(0.0, 0.0, -10.)); - testInst->add(source); - testInst->markAsSource(source); - - // Define a sample as a simple sphere - Object_sptr sampleSphere = createSphere(0.001, V3D(0.0, 0.0, 0.0), "sample-shape"); - ObjComponent *sample = new ObjComponent("sample", sampleSphere, testInst.get()); - testInst->setPos(0.0, 0.0, 0.0); - testInst->add(sample); - testInst->markAsSamplePos(sample); - - return testInst; - } -} - -#endif //COMPONENTCREATIONHELPERS_H_ diff --git a/Code/Mantid/Framework/Geometry/test/DetectorGroupTest.h b/Code/Mantid/Framework/Geometry/test/DetectorGroupTest.h index 3a9d0854fdf..47d3fb67721 100644 --- a/Code/Mantid/Framework/Geometry/test/DetectorGroupTest.h +++ b/Code/Mantid/Framework/Geometry/test/DetectorGroupTest.h @@ -5,7 +5,7 @@ #include "MantidGeometry/Instrument/DetectorGroup.h" #include "MantidGeometry/Instrument/Detector.h" -#include "ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/Geometry/test/InstrumentRayTracerTest.h b/Code/Mantid/Framework/Geometry/test/InstrumentRayTracerTest.h index f48aed27488..91d20e1bdc0 100644 --- a/Code/Mantid/Framework/Geometry/test/InstrumentRayTracerTest.h +++ b/Code/Mantid/Framework/Geometry/test/InstrumentRayTracerTest.h @@ -8,7 +8,7 @@ #include "MantidGeometry/Objects/InstrumentRayTracer.h" #include "MantidGeometry/V3D.h" #include "MantidKernel/ConfigService.h" -#include "ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" #include <iterator> using namespace Mantid::Geometry; diff --git a/Code/Mantid/Framework/Geometry/test/NearestNeighboursTest.h b/Code/Mantid/Framework/Geometry/test/NearestNeighboursTest.h index bba51fd37c6..190d50604ae 100644 --- a/Code/Mantid/Framework/Geometry/test/NearestNeighboursTest.h +++ b/Code/Mantid/Framework/Geometry/test/NearestNeighboursTest.h @@ -7,7 +7,7 @@ #include "MantidGeometry/Instrument/NearestNeighbours.h" // other headers -#include "ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidGeometry/IInstrument.h" #include "MantidGeometry/IDetector.h" diff --git a/Code/Mantid/Framework/Geometry/test/RectangularDetectorTest.h b/Code/Mantid/Framework/Geometry/test/RectangularDetectorTest.h index 3cbc5b2a926..40f772e104e 100644 --- a/Code/Mantid/Framework/Geometry/test/RectangularDetectorTest.h +++ b/Code/Mantid/Framework/Geometry/test/RectangularDetectorTest.h @@ -9,7 +9,7 @@ #include "MantidGeometry/V3D.h" #include "MantidGeometry/Objects/BoundingBox.h" #include "MantidGeometry/Quat.h" -#include "ComponentCreationHelpers.hh" +#include "MantidTestHelpers/ComponentCreationHelper.h" #include "MantidGeometry/Objects/ShapeFactory.h" diff --git a/Code/Mantid/Framework/Kernel/CMakeLists.txt b/Code/Mantid/Framework/Kernel/CMakeLists.txt index a1fbb10fa4e..b4544a34cc2 100644 --- a/Code/Mantid/Framework/Kernel/CMakeLists.txt +++ b/Code/Mantid/Framework/Kernel/CMakeLists.txt @@ -144,7 +144,7 @@ set ( TEST_FILES test/ArrayBoundedValidatorTest.h test/BinFinderTest.h test/BoundedValidatorTest.h test/CacheTest.h - #test/ConfigServiceTest.h # TODO uses TestChannel.hh + test/ConfigServiceTest.h test/DateAndTimeTest.h test/DateValidatorTest.h test/DirectoryValidatorTest.h @@ -152,7 +152,7 @@ set ( TEST_FILES test/ArrayBoundedValidatorTest.h test/EnvironmentHistoryTest.h test/FacilitiesTest.h test/FileValidatorTest.h - #test/FilterChannelTest.h # TODO uses TestChannel.hh + test/FilterChannelTest.h test/InterpolationTest.h test/ListValidatorTest.h test/LogFilterTest.h diff --git a/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h b/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h index cf37d5a0cc7..52d730fef98 100644 --- a/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h +++ b/Code/Mantid/Framework/Kernel/test/ConfigServiceTest.h @@ -8,13 +8,14 @@ #include "Poco/Path.h" #include "Poco/File.h" #include "boost/shared_ptr.hpp" -#include "TestChannel.hh" +#include "MantidTestHelpers/TestChannel.h" #include <string> #include <fstream> #include <Poco/NObserver.h> using namespace Mantid::Kernel; +using Mantid::TestHelpers::TestChannel; class ConfigServiceTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Kernel/test/FilterChannelTest.h b/Code/Mantid/Framework/Kernel/test/FilterChannelTest.h index 3a380af51d1..e57cffca9c9 100644 --- a/Code/Mantid/Framework/Kernel/test/FilterChannelTest.h +++ b/Code/Mantid/Framework/Kernel/test/FilterChannelTest.h @@ -10,11 +10,12 @@ #include "Poco/LoggingFactory.h" #include "Poco/LoggingRegistry.h" #include "boost/shared_ptr.hpp" -#include "TestChannel.hh" +#include "MantidTestHelpers/TestChannel.h" #include <map> #include <string> using namespace Mantid::Kernel; +using Mantid::TestHelpers::TestChannel; class FilterChannelTest : public CxxTest::TestSuite { diff --git a/Code/Mantid/Framework/Kernel/test/TestChannel.hh b/Code/Mantid/Framework/Kernel/test/TestChannel.hh deleted file mode 100644 index 60542f7acb7..00000000000 --- a/Code/Mantid/Framework/Kernel/test/TestChannel.hh +++ /dev/null @@ -1,74 +0,0 @@ -// -// TestChannel.h -// -// $Id: //poco/1.3/Foundation/testsuite/src/TestChannel.h#1 $ -// -// Definition of the TestChannel class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// Permission is hereby granted, free of charge, to any person or organization -// obtaining a copy of the software and accompanying documentation covered by -// this license (the "Software") to use, reproduce, display, distribute, -// execute, and transmit the Software, and to prepare derivative works of the -// Software, and to permit third-parties to whom the Software is furnished to -// do so, all subject to the following: -// -// The copyright notices in the Software and this entire statement, including -// the above license grant, this restriction and the following disclaimer, -// must be included in all copies of the Software, in whole or in part, and -// all derivative works of the Software, unless such copies or derivative -// works are solely in the form of machine-executable object code generated by -// a source language processor. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// - - -#ifndef TestChannel_INCLUDED -#define TestChannel_INCLUDED - - -#include "Poco/Channel.h" -#include "Poco/Message.h" -#include <list> - - -class TestChannel: public Poco::Channel -{ -public: - typedef std::list<Poco::Message> MsgList; - - TestChannel() - {} - - ~TestChannel() - {} - - void log(const Poco::Message& msg) - { - _msgList.push_back(msg); - } - - MsgList& list() - { - return _msgList; - } - void clear() - { - _msgList.clear(); - } - -private: - MsgList _msgList; -}; - - -#endif // TestChannel_INCLUDED diff --git a/Code/Mantid/Framework/Nexus/test/SaveNXSPETest.h b/Code/Mantid/Framework/Nexus/test/SaveNXSPETest.h index b0a749b1e79..0004468380f 100644 --- a/Code/Mantid/Framework/Nexus/test/SaveNXSPETest.h +++ b/Code/Mantid/Framework/Nexus/test/SaveNXSPETest.h @@ -5,7 +5,7 @@ #include "MantidNexus/SaveNXSPE.h" #include "MantidKernel/UnitFactory.h" -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/SpectraDetectorMap.h" #include "MantidAPI/NumericAxis.h" diff --git a/Code/Mantid/Framework/PythonAPI/test/PythonFrameworkTests.h b/Code/Mantid/Framework/PythonAPI/test/PythonFrameworkTests.h index 8589a6b58b7..6257116312a 100644 --- a/Code/Mantid/Framework/PythonAPI/test/PythonFrameworkTests.h +++ b/Code/Mantid/Framework/PythonAPI/test/PythonFrameworkTests.h @@ -4,7 +4,7 @@ #include <vector> #include <cxxtest/TestSuite.h> -#include "../../Algorithms/test/WorkspaceCreationHelper.hh" +#include "MantidTestHelpers/WorkspaceCreationHelper.h" #include "MantidPythonAPI/FrameworkManagerProxy.h" #include "MantidPythonAPI/SimplePythonAPI.h" diff --git a/Code/Mantid/Framework/SConstruct b/Code/Mantid/Framework/SConstruct index 9e6bf753547..ca99c4adbe1 100644 --- a/Code/Mantid/Framework/SConstruct +++ b/Code/Mantid/Framework/SConstruct @@ -382,9 +382,13 @@ Command(dest_dir+'/setup.py','PythonAPI/setup.py',Copy("$TARGET","$SOURCE")) skiptest=ARGUMENTS.get('skiptest',0) if not int(skiptest) and not env.GetOption('clean'): print 'Building Tests. Specify "skiptest=1" to skip the tests' + # Test helpers + ret = SConscript(['TestHelpers/SConscript']) + env.Install(dest_dir, ret['shared']) # tests hudsonbuild=ARGUMENTS.get('xunitoutput',0) if not int(hudsonbuild): + print 'Using MantidPrinter cxxtest output' ret = SConscript(['Build/Tests/SConscript']) else: print 'Using xUnit Output' diff --git a/Code/Mantid/Framework/TestHelpers/SConscript b/Code/Mantid/Framework/TestHelpers/SConscript new file mode 100644 index 00000000000..5030ed552d4 --- /dev/null +++ b/Code/Mantid/Framework/TestHelpers/SConscript @@ -0,0 +1,22 @@ +#For TestHelpers + +import os +import MantidBuild + +#GET LIST OF CPPS +codeFolder = os.path.abspath('./src') +listCpps = MantidBuild.getCPPFiles(codeFolder) + +#Import environment +Import('env') +myenv = env.Clone() +myenv.Append(CPPDEFINES=[('IN_MANTID_TESTHELPERS',1)]) +myenv.Append(CPPPATH=['#/DataHandling/inc']) +myenv.Append(MYLIBLIST=['MantidDataHandling']) + +listSharedObjects = MantidBuild.getSharedObjects(listCpps, myenv) + +#BUILD CODE +shared = myenv.SharedLibrary('lib/MantidTestHelpers', listCpps, LIBS=myenv['MYLIBLIST'], LIBPATH=myenv['MYLIBDIRLIST'], PDB='lib/MantidTestHelpers.pdb') +retval = { 'shared': shared, 'sharedobjs' : listSharedObjects, 'libs': [ 'MantidTestHelpers' ] } +Return('retval') -- GitLab