diff --git a/Code/Mantid/API/src/CompositeFunction.cpp b/Code/Mantid/API/src/CompositeFunction.cpp index 4ab567a20805eca5b4d77f32f6fe3530df9d8c57..143751d2d687af59252ab15915e0d218e4806577 100644 --- a/Code/Mantid/API/src/CompositeFunction.cpp +++ b/Code/Mantid/API/src/CompositeFunction.cpp @@ -256,7 +256,7 @@ int CompositeFunction::parameterIndex(const std::string& name)const if (index < 0) throw std::invalid_argument("CompositeFunction::getParameter: parameter name must contain function index"); - return m_paramOffsets[index] + getFunction(index)->parameterIndex(pname); + return getFunction(index)->parameterIndex(pname) + m_paramOffsets[index]; } /** @@ -408,7 +408,7 @@ void CompositeFunction::checkFunction() std::vector<IFunction*> functions(m_functions.begin(),m_functions.end()); m_functions.clear(); - for(int i=0;i<functions.size();i++) + for(std::vector<IFunction*>::size_type i=0;i<functions.size();i++) { IFunction* f = functions[i]; CompositeFunction* cf = dynamic_cast<CompositeFunction*>(f); diff --git a/Code/Mantid/API/src/ParameterTie.cpp b/Code/Mantid/API/src/ParameterTie.cpp index d2c8e4892f6dae051439d41fce7834794e6df0cc..d6f03a223d20f014a95ef64a1c03bb5e00e2d1d5 100644 --- a/Code/Mantid/API/src/ParameterTie.cpp +++ b/Code/Mantid/API/src/ParameterTie.cpp @@ -126,8 +126,6 @@ namespace API { fun = getFunction(); } - const CompositeFunction* cf = dynamic_cast<const CompositeFunction*>(fun); - CompositeFunction* cf1 = dynamic_cast<CompositeFunction*>(m_function1); std::string res_expression; try { diff --git a/Code/Mantid/API/test/AlgorithmHistoryTest.h b/Code/Mantid/API/test/AlgorithmHistoryTest.h index 9919773523cc60ab598213e1a33635f92f431e5e..e1ec931d12d2b85501527a206f3313baf0e3a2f6 100644 --- a/Code/Mantid/API/test/AlgorithmHistoryTest.h +++ b/Code/Mantid/API/test/AlgorithmHistoryTest.h @@ -75,6 +75,8 @@ public: TS_ASSERT_THROWS_NOTHING(output << AH); TS_ASSERT_EQUALS(output.str(),correctOutput); + delete timeinfo; + delete alg; } diff --git a/Code/Mantid/API/test/AxisTest.h b/Code/Mantid/API/test/AxisTest.h index f2bdbd8cd393364b4139a4390bd457b3a344f7c5..0f408754560dfd3678b990c522cc284542179845 100644 --- a/Code/Mantid/API/test/AxisTest.h +++ b/Code/Mantid/API/test/AxisTest.h @@ -68,7 +68,8 @@ public: TS_ASSERT_DIFFERS( newSpecAxis, spectraAxis ) Axis* newNumAxis = numericAxis->clone(); TS_ASSERT_DIFFERS( newNumAxis, numericAxis ) - delete newSpecAxis, newNumAxis; + delete newSpecAxis; + delete newNumAxis; } void testTitle() diff --git a/Code/Mantid/API/test/CompositeFunctionTest.h b/Code/Mantid/API/test/CompositeFunctionTest.h index 1239a49988fedb787fe0a164237f5867d60e214e..7e9aa8d0eb34089c0b11929ace7d8b5a44175f80 100644 --- a/Code/Mantid/API/test/CompositeFunctionTest.h +++ b/Code/Mantid/API/test/CompositeFunctionTest.h @@ -401,7 +401,7 @@ public: TS_ASSERT_EQUALS(mfun->parameterIndex("f3.h"),10); TS_ASSERT_EQUALS(mfun->parameterIndex("f3.s"),11); - + delete mfun; } void testSetActive() @@ -466,7 +466,9 @@ public: TS_ASSERT_EQUALS(mfun->getParameter(8),103); TS_ASSERT_EQUALS(mfun->getParameter(9),104); TS_ASSERT_EQUALS(mfun->getParameter(10),3.2); - TS_ASSERT_EQUALS(mfun->getParameter(11),105); + TS_ASSERT_EQUALS(mfun->getParameter(11),105); + + delete mfun; } void testRemoveActive() @@ -534,7 +536,8 @@ public: TS_ASSERT_EQUALS(mfun->getParameter(9),104); TS_ASSERT_EQUALS(mfun->getParameter(10),3.2); TS_ASSERT_EQUALS(mfun->getParameter(11),105); - + + delete mfun; } void testApplyTies() @@ -595,7 +598,8 @@ public: TS_ASSERT_EQUALS(mfun->getParameter(9),3.1); TS_ASSERT_EQUALS(mfun->getParameter(10),79.1); TS_ASSERT_EQUALS(mfun->getParameter(11),3.3); - + + delete mfun; } void testApplyTiesInWrongOrder() @@ -656,7 +660,8 @@ public: TS_ASSERT_EQUALS(mfun->getParameter(9),3.1); TS_ASSERT_EQUALS(mfun->getParameter(10),79.1); TS_ASSERT_EQUALS(mfun->getParameter(11),3.3); - + + delete mfun; } void testRemoveFunction() @@ -773,7 +778,8 @@ public: TS_ASSERT( mfun->isActive(5)); TS_ASSERT( ! mfun->isActive(6)); TS_ASSERT( mfun->isActive(7)); - + + delete mfun; } // replacing function has fewer parameters @@ -1141,7 +1147,8 @@ public: TS_ASSERT_EQUALS(mfun->getParameter("f1.c"),1.1); TS_ASSERT_EQUALS(mfun->getParameter("f1.h"),0.2); TS_ASSERT_EQUALS(mfun->getParameter("f1.s"),1.33); - + + delete mfun; } void testRemoveFunctionWithTies() @@ -1180,7 +1187,8 @@ public: TS_ASSERT_EQUALS(mfun->getParameter("f0.c"),1.1); TS_ASSERT_EQUALS(mfun->getParameter("f0.h"),1.2); TS_ASSERT_EQUALS(mfun->getParameter("f0.s"),0.3); - + + delete mfun; } private: diff --git a/Code/Mantid/API/test/FunctionFactoryTest.h b/Code/Mantid/API/test/FunctionFactoryTest.h index bdf2b749bd1a272e7a6a75d25373da947d63ce8d..5eba358e591aa49bf79ba528ebab2c85ac1351d4 100644 --- a/Code/Mantid/API/test/FunctionFactoryTest.h +++ b/Code/Mantid/API/test/FunctionFactoryTest.h @@ -202,7 +202,8 @@ public: TS_ASSERT_EQUALS(cf->getParameter(0),0.1); TS_ASSERT_EQUALS(cf->getParameter(1),1.1); TS_ASSERT_EQUALS(cf->getParameter(2),0.2); - TS_ASSERT_EQUALS(cf->getParameter(3),1.2); + TS_ASSERT_EQUALS(cf->getParameter(3),1.2); + delete fun; } void testCreateComposite1() @@ -221,7 +222,8 @@ public: TS_ASSERT_EQUALS(cf->getParameter(0),0.); TS_ASSERT_EQUALS(cf->getParameter(1),0.); TS_ASSERT_EQUALS(cf->getParameter(2),0.2); - TS_ASSERT_EQUALS(cf->getParameter(3),1.2); + TS_ASSERT_EQUALS(cf->getParameter(3),1.2); + delete fun; } void testCreateComposite2() @@ -242,7 +244,8 @@ public: TS_ASSERT_EQUALS(cf->getParameter(1),0.); TS_ASSERT_EQUALS(cf->getParameter(2),0.2); TS_ASSERT_EQUALS(cf->getParameter(3),1.2); - TS_ASSERT_EQUALS(fun->name(),"FunctionFactoryTest_CompFunctB"); + TS_ASSERT_EQUALS(fun->name(),"FunctionFactoryTest_CompFunctB"); + delete fun; } void testCreateComposite3() @@ -265,7 +268,8 @@ public: TS_ASSERT_EQUALS(cf->getParameter(3),1.2); TS_ASSERT_EQUALS(fun->name(),"FunctionFactoryTest_CompFunctA"); TS_ASSERT(fun->hasAttribute("attr")); - TS_ASSERT_EQUALS(fun->getAttribute("attr"),"hello"); + TS_ASSERT_EQUALS(fun->getAttribute("attr"),"hello"); + delete fun; } void testCreateCompositeNested() @@ -284,8 +288,10 @@ public: TS_ASSERT_EQUALS(cf->getFunction(0)->name(),"FunctionFactoryTest_CompFunctA"); TS_ASSERT_EQUALS(cf->getFunction(1)->name(),"FunctionFactoryTest_CompFunctB"); TS_ASSERT_EQUALS(dynamic_cast<CompositeFunction*>(cf->getFunction(0))->nFunctions(),2); - TS_ASSERT_EQUALS(dynamic_cast<CompositeFunction*>(cf->getFunction(1))->nFunctions(),2); - } + TS_ASSERT_EQUALS(dynamic_cast<CompositeFunction*>(cf->getFunction(1))->nFunctions(),2); + delete fun; + } + void testCreateWithConstraint() { std::string fnString = "name=FunctionFactoryTest_FunctA,a0=0.1(0<a0<0.2),a1=1.1"; @@ -605,7 +611,8 @@ public: TS_ASSERT_EQUALS(fun1->getParameter(2),28.); TS_ASSERT_EQUALS(fun1->getParameter(3),789); - delete fun; + delete fun; + delete fun1; } }; diff --git a/Code/Mantid/API/test/LogParserTest.h b/Code/Mantid/API/test/LogParserTest.h index 45c606848f3f8ac0c7df98f5702b945ea2ea3c9a..19b498f6fa6a08f44920d30bb29f985669b37b68 100644 --- a/Code/Mantid/API/test/LogParserTest.h +++ b/Code/Mantid/API/test/LogParserTest.h @@ -80,7 +80,8 @@ public: TS_ASSERT_EQUALS(tp1->firstValue(),1); //TS_ASSERT_EQUALS(secondValue(p1),2); TS_ASSERT_EQUALS(tp1->lastValue(),9); - + + delete p1; } void testLate() @@ -113,7 +114,8 @@ public: TS_ASSERT_EQUALS(ti->tm_hour, 14); TS_ASSERT_EQUALS(ti->tm_min, 3); TS_ASSERT_DELTA(timeMean(p1),8.0818, 0.001); - + + delete p1; } void testEarly() @@ -147,6 +149,7 @@ public: TS_ASSERT_EQUALS(ti->tm_min, 23); TS_ASSERT_DELTA(timeMean(p1),4.7096, 0.001); + delete p1; } void testSingle() @@ -168,6 +171,7 @@ public: TS_ASSERT_EQUALS(ti->tm_min, 22); TS_ASSERT_DELTA(timeMean(p1),4., 0.001); + delete p1; } void testStr() @@ -199,7 +203,7 @@ public: TS_ASSERT_EQUALS(ti->tm_hour, 14); TS_ASSERT_EQUALS(ti->tm_min, 3); // assert_throws(timeMean(p1)); - + delete p1; } void testNoICPevent() @@ -230,6 +234,7 @@ public: TS_ASSERT_EQUALS(ti->tm_min, 3); TS_ASSERT_DELTA(timeMean(p1),8.0756, 0.001); + delete p1; } //*/ private: diff --git a/Code/Mantid/API/test/MatrixWorkspaceTest.h b/Code/Mantid/API/test/MatrixWorkspaceTest.h index 8c8cdca8dd9bb71f53d23c31cbf567188aca65bb..82f58710836e50c8d28c052f65b25a070b80ba67 100644 --- a/Code/Mantid/API/test/MatrixWorkspaceTest.h +++ b/Code/Mantid/API/test/MatrixWorkspaceTest.h @@ -123,6 +123,7 @@ public: { Axis* axBad = new Axis(AxisType::Spectra,5); TS_ASSERT_THROWS( ws->replaceAxis(0,axBad), std::runtime_error ) + delete axBad; Axis* ax = new Axis(AxisType::Spectra,1); TS_ASSERT_THROWS( ws->replaceAxis(1,ax), Exception::IndexError ) TS_ASSERT_THROWS_NOTHING( ws->replaceAxis(0,ax) ) @@ -182,6 +183,8 @@ public: TS_ASSERT_EQUALS( ws2->maskedBins(0).rbegin()->first, 1 ) TS_ASSERT_EQUALS( ws2->maskedBins(0).rbegin()->second, 0.5 ) TS_ASSERT_EQUALS( ws2->dataY(0)[1], 0.25 ) + + delete ws2; } private: diff --git a/Code/Mantid/API/test/ParameterReferenceTest.h b/Code/Mantid/API/test/ParameterReferenceTest.h index 5eb634985e721b214217ee22f58d1c9540ab07f7..e4f9c19cf938bc9c4ebbc65c7f26be76e9014995 100644 --- a/Code/Mantid/API/test/ParameterReferenceTest.h +++ b/Code/Mantid/API/test/ParameterReferenceTest.h @@ -125,7 +125,8 @@ public: TS_ASSERT_EQUALS(r9.getIndex(),0); TS_ASSERT_EQUALS(r10.getIndex(),1); TS_ASSERT_EQUALS(r11.getIndex(),2); - + + delete cf; } }; diff --git a/Code/Mantid/API/test/runTests.sh b/Code/Mantid/API/test/runTests.sh index ff7ea78ab0e70ec1d073780acfb6bf3332e9b235..1dc73953863c707e80e03590aa274ca9bdc2f1ef 100644 --- a/Code/Mantid/API/test/runTests.sh +++ b/Code/Mantid/API/test/runTests.sh @@ -26,10 +26,7 @@ echo echo "Compiling the test executable..." g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../Geometry/inc -I ../../../Third_Party/include \ - -L ../../debug -L ../../Build -L ../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidAPI -lMantidKernel -lMantidGeometry -lPocoFoundation -lPocoUtil \ - -lboost_regex -lboost_signals -lmuparserd -lgsl -lgslcblas -lGL -lGLU -lgts \ - -lTKernel -lTKBO -lTKPrim -lTKMesh + -L ../../debug -L ../../Build -lMantidAPI -lMantidCurveFitting echo echo "Running the tests..." diff --git a/Code/Mantid/CurveFitting/src/Fit.cpp b/Code/Mantid/CurveFitting/src/Fit.cpp index 8ece75356a926061cf6efe32975c6de12d41fe90..cea31902f80eee819fdc6e91c1c696b487d407fd 100644 --- a/Code/Mantid/CurveFitting/src/Fit.cpp +++ b/Code/Mantid/CurveFitting/src/Fit.cpp @@ -360,21 +360,22 @@ namespace CurveFitting // check if derivative defined in derived class bool isDerivDefined = true; - try - { const std::vector<double> inTest(nActive(),1.0); std::vector<double> outTest(nActive()); const double xValuesTest = 0; JacobianImpl1 J; - boost::shared_ptr<gsl_matrix> M( gsl_matrix_alloc(1,nActive()) ); - J.setJ(M.get()); + gsl_matrix* M( gsl_matrix_alloc(1,nActive()) ); + J.setJ(M); + try + { // note nData set to zero (last argument) hence this should avoid further memory problems - functionDeriv(NULL, &J, &xValuesTest, 0); + functionDeriv(NULL, &J, &xValuesTest, 0); } catch (Exception::NotImplementedError&) { isDerivDefined = false; } + gsl_matrix_free(M); // What minimizer to use std::string methodUsed = getProperty("Minimizer"); @@ -629,7 +630,7 @@ namespace CurveFitting // take standard deviations to be the square root of the diagonal elements of // the covariance matrix int iPNotFixed = 0; - for(size_t i=0; i < m_function->nParams(); i++) + for(int i=0; i < m_function->nParams(); i++) { standardDeviations.push_back(1.0); if (m_function->isActive(i)) @@ -652,7 +653,7 @@ namespace CurveFitting Mantid::API::ITableWorkspace_sptr m_covariance = Mantid::API::WorkspaceFactory::Instance().createTable("TableWorkspace"); m_covariance->addColumn("str","Name"); std::vector<std::string> paramThatAreFitted; // used for populating 1st "name" column - for(size_t i=0; i < m_function->nParams(); i++) + for(int i=0; i < m_function->nParams(); i++) { if (m_function->isActive(i)) { @@ -699,7 +700,7 @@ namespace CurveFitting //Mantid::API::TableRow row = m_result->appendRow(); //row << "Chi^2/DoF" << finalCostFuncVal; - for(size_t i=0;i<m_function->nParams();i++) + for(int i=0;i<m_function->nParams();i++) { Mantid::API::TableRow row = m_result->appendRow(); row << m_function->parameterName(i) << m_function->getParameter(i); @@ -766,7 +767,8 @@ namespace CurveFitting delete [] l_data.sqrtWeightData; delete [] l_data.holdCalculatedData; gsl_matrix_free (l_data.holdCalculatedJacobian); - + gsl_vector_free (initFuncArg); + return; } diff --git a/Code/Mantid/CurveFitting/src/Fit1D.cpp b/Code/Mantid/CurveFitting/src/Fit1D.cpp index a8c679ef40e88db34cf994930ddace8558380b70..a637e9460e695bb96992c2091be865d6a44e5cbc 100644 --- a/Code/Mantid/CurveFitting/src/Fit1D.cpp +++ b/Code/Mantid/CurveFitting/src/Fit1D.cpp @@ -281,10 +281,11 @@ void Fit1D::exec() std::vector<double> outTest(m_parameterNames.size()); const double xValuesTest = 0; JacobianImpl J; - boost::shared_ptr<gsl_matrix> M( gsl_matrix_alloc(m_parameterNames.size(),1) ); - J.setJ(M.get()); + gsl_matrix* M( gsl_matrix_alloc(m_parameterNames.size(),1) ); + J.setJ(M); // note nData set to zero (last argument) hence this should avoid further memory problems - functionDeriv(&(inTest.front()), &J, &xValuesTest, 0); + functionDeriv(&(inTest.front()), &J, &xValuesTest, 0); + gsl_matrix_free(M); } catch (Exception::NotImplementedError&) { @@ -708,6 +709,7 @@ void Fit1D::exec() delete [] l_data.sigmaData; delete [] l_data.forSimplexLSwrap; delete [] l_data.parameters; + gsl_vector_free (initFuncArg); return; } diff --git a/Code/Mantid/CurveFitting/test/ResolutionTest.h b/Code/Mantid/CurveFitting/test/ResolutionTest.h index 75634a984b1e0ea8cc602a97d14e4022c7366da4..a90ca75dc77a6e7da3491219be1b5245122e01d8 100644 --- a/Code/Mantid/CurveFitting/test/ResolutionTest.h +++ b/Code/Mantid/CurveFitting/test/ResolutionTest.h @@ -149,8 +149,7 @@ void tearDown() const int nX = 100; const int nY = nX - 1; - Mantid::DataObjects::Workspace2D_sptr ws = boost::dynamic_pointer_cast<Mantid::DataObjects::Workspace2D> - (WorkspaceFactory::Instance().create("Workspace2D",1,nX,nY)); + MatrixWorkspace_sptr ws = boost::dynamic_pointer_cast<MatrixWorkspace>(WorkspaceFactory::Instance().create("Workspace2D",1,nX,nY)); double spec; double x; diff --git a/Code/Mantid/CurveFitting/test/runTests.sh b/Code/Mantid/CurveFitting/test/runTests.sh index 865aaee5836a4777f01bcedcfa5d94945a494a5c..acf01d90ffcfadbd7bfb4efef9ce99b9541ad0ed 100755 --- a/Code/Mantid/CurveFitting/test/runTests.sh +++ b/Code/Mantid/CurveFitting/test/runTests.sh @@ -28,10 +28,8 @@ echo echo "Compiling the test executable..." g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../API/inc -I ../../DataObjects/inc -I ../../Geometry/inc \ -I ../../DataHandling/inc -I ../../Algorithms/inc -I ../../Nexus/inc -I ../../../Third_Party/include \ - -L ../../debug -L ../../Build -L ../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidCurveFitting -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects -lMantidDataHandling -lMantidNexus -lMantidAlgorithms \ - -lPocoFoundation -lPocoUtil -lboost_date_time -lboost_regex -lboost_signals \ - -lmuparserd -lgsl -lgslcblas + -L ../../debug -L ../../Build \ + -lMantidCurveFitting -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects -lMantidDataHandling -lMantidNexus -lMantidAlgorithms echo echo "Running the tests..." diff --git a/Code/Mantid/DataHandling/inc/MantidDataHandling/SaveSPE.h b/Code/Mantid/DataHandling/inc/MantidDataHandling/SaveSPE.h index a1eecbf7e136d9704269cbf58b27bb33c0ba07e3..7e7940ecc7783dcdedf249ab6c283825b507aaf3 100755 --- a/Code/Mantid/DataHandling/inc/MantidDataHandling/SaveSPE.h +++ b/Code/Mantid/DataHandling/inc/MantidDataHandling/SaveSPE.h @@ -43,8 +43,8 @@ namespace DataHandling class DLLExport SaveSPE : public API::Algorithm { public: - /// (Empty) Constructor - SaveSPE() : API::Algorithm(), m_remainder(-1), m_nBins(-1) {} + /// Constructor + SaveSPE(); /// Virtual destructor virtual ~SaveSPE() {} /// Algorithm's name @@ -53,12 +53,12 @@ public: virtual const int version() const { return (1); } /// Algorithm's category for identification virtual const std::string category() const { return "DataHandling"; } - /// + private: - ///the number of bins in each histogram, as the histogram must have common bins this shouldn't change - int m_nBins; - ///the SPE files have a constant number of numbers writen on each line, but depending on the number of bins there will be some "spare" numbers at the end of the block, this holds that number of spares - int m_remainder; + /// Initialisation code + void init(); + ///Execution code + void exec(); void writeHists(const API::MatrixWorkspace_const_sptr WS, FILE * const outFile); void writeHist(const API::MatrixWorkspace_const_sptr WS, FILE * const outFile, const int specIn) const; @@ -66,12 +66,12 @@ private: void writeBins(const MantidVec &Vs, FILE * const outFile) const; void writeValue(const double value, FILE * const outFile) const; void logMissingMasked(const std::vector<int> &inds, const int nonMasked, const int masked) const; - /// Initialisation code - void init(); - ///Execution code - void exec(); + + ///the SPE files have a constant number of numbers writen on each line, but depending on the number of bins there will be some "spare" numbers at the end of the block, this holds that number of spares + int m_remainder; + ///the number of bins in each histogram, as the histogram must have common bins this shouldn't change + int m_nBins; -protected: /// the mask flag (=-1e30) from the SPE specification http://www.mantidproject.org/images/3/3d/Spe_file_format.pdf static const double MASK_FLAG; /// the error value (=0.0) for spectra whose detectors are all masked, from the SPE specification http://www.mantidproject.org/images/3/3d/Spe_file_format.pdf diff --git a/Code/Mantid/DataHandling/src/SaveSPE.cpp b/Code/Mantid/DataHandling/src/SaveSPE.cpp index 17200938b780850bd7da180ed1f709b4377b53d0..50a5cfc573ed6b4a1d32226b78e11f65929fef95 100755 --- a/Code/Mantid/DataHandling/src/SaveSPE.cpp +++ b/Code/Mantid/DataHandling/src/SaveSPE.cpp @@ -31,6 +31,8 @@ static const int NUM_PER_LINE = 8; const double SaveSPE::MASK_FLAG=-1e30; const double SaveSPE::MASK_ERROR=0.0; +SaveSPE::SaveSPE() : API::Algorithm(), m_remainder(-1), m_nBins(-1) {} + //--------------------------------------------------- // Private member functions //--------------------------------------------------- diff --git a/Code/Mantid/DataHandling/test/runTests.sh b/Code/Mantid/DataHandling/test/runTests.sh index e762560d2062282691c712d6db5df6c07aa5fa43..84000d5ae4db4f794124e648b2de1f4f4afe3f2c 100644 --- a/Code/Mantid/DataHandling/test/runTests.sh +++ b/Code/Mantid/DataHandling/test/runTests.sh @@ -31,12 +31,8 @@ echo "Compiling the test executable..." # -lboost_filesystem added for the SaveCSVTest test g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../API/inc -I ../../DataObjects/inc \ -I ../../Geometry/inc -I ../../../Third_Party/include \ - -L../../debug -L../../Build -L../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidDataHandling -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects \ - -lPocoFoundation -lPocoUtil \ - -lboost_regex -lboost_signals -lboost_date_time \ - -lmuparserd -lgsl -lgslcblas -lNeXus -lGL -lGLU -lgts \ - -lTKernel -lTKBO -lTKPrim -lTKMesh + -L../../debug -L../../Build \ + -lMantidDataHandling -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects echo diff --git a/Code/Mantid/DataObjects/src/TableWorkspace.cpp b/Code/Mantid/DataObjects/src/TableWorkspace.cpp index f5cda999c2153c1b173fea67dbd122fa77aa7271..49a01d18c38fd13a82581c58242f90fc51da435f 100644 --- a/Code/Mantid/DataObjects/src/TableWorkspace.cpp +++ b/Code/Mantid/DataObjects/src/TableWorkspace.cpp @@ -17,8 +17,10 @@ namespace Mantid Kernel::Logger& TableWorkspace::g_log = Kernel::Logger::get("TableWorkspace"); /// Constructor - TableWorkspace::TableWorkspace(int nrows) - {setRowCount(nrows);} + TableWorkspace::TableWorkspace(int nrows) : ITableWorkspace(), m_rowCount(0) + { + setRowCount(nrows); + } ///Destructor TableWorkspace::~TableWorkspace() diff --git a/Code/Mantid/DataObjects/test/CompressedWorkspace2DTest.h b/Code/Mantid/DataObjects/test/CompressedWorkspace2DTest.h index 4891e6f6ad387eb08ce5e50f1eeebeadb62d5801..762ef82bd5fe0f2ed1105a724e3d846ef261a943 100644 --- a/Code/Mantid/DataObjects/test/CompressedWorkspace2DTest.h +++ b/Code/Mantid/DataObjects/test/CompressedWorkspace2DTest.h @@ -66,6 +66,7 @@ public: CompressedWorkspace2D *ws = new CompressedWorkspace2D; TS_ASSERT( dynamic_cast<Workspace2D*>(ws) ) TS_ASSERT( dynamic_cast<Mantid::API::Workspace*>(ws) ) + delete ws; } void testId() diff --git a/Code/Mantid/DataObjects/test/ManagedWorkspace2DTest.h b/Code/Mantid/DataObjects/test/ManagedWorkspace2DTest.h index d1914adb69edacdb6c3f36f537acc5949dbbeb8b..3cdb244a929553617cde8b183d75225dd6299999 100644 --- a/Code/Mantid/DataObjects/test/ManagedWorkspace2DTest.h +++ b/Code/Mantid/DataObjects/test/ManagedWorkspace2DTest.h @@ -74,6 +74,7 @@ public: ManagedWorkspace2D *ws = new ManagedWorkspace2D; TS_ASSERT( dynamic_cast<Workspace2D*>(ws) ) TS_ASSERT( dynamic_cast<Mantid::API::Workspace*>(ws) ) + delete ws; } void testId() diff --git a/Code/Mantid/DataObjects/test/RefAxisTest.h b/Code/Mantid/DataObjects/test/RefAxisTest.h index 98af94c9087a60bba1330109a9c6786e081eae2c..f5c317a77b9172aec5c0421c16bdbbaac7bbc26f 100644 --- a/Code/Mantid/DataObjects/test/RefAxisTest.h +++ b/Code/Mantid/DataObjects/test/RefAxisTest.h @@ -33,9 +33,10 @@ public: a[i]=i+0.1; } for (int j = 0; j < 5; ++j) { - space->dataX(j) = *( new Mantid::MantidVec(a+(5*j), a+(5*j)+5) ); + space->dataX(j) = Mantid::MantidVec(a+(5*j), a+(5*j)+5); } - delete a,b; + delete[] a; + delete[] b; // Create the axis that the tests will be performed on refAxis = new RefAxis(5, space); @@ -46,7 +47,8 @@ public: ~RefAxisTest() { delete refAxis; - delete space, space2; + delete space; + delete space2; } void testConstructor() @@ -68,6 +70,7 @@ public: TS_ASSERT( clonedAxis->isNumeric() ) TS_ASSERT_EQUALS( (*clonedAxis)(0,0), 0.0 ) TS_ASSERT_THROWS( (*clonedAxis)(0,1), std::range_error ) + delete clonedAxis; } void testOperatorBrackets() diff --git a/Code/Mantid/DataObjects/test/WorkspaceValidatorsTest.h b/Code/Mantid/DataObjects/test/WorkspaceValidatorsTest.h index 3bd119ca9fb63b7cdcab8308487e3e4d92da8764..42ecf0003c7beddc3433b4266146b067d920c283 100644 --- a/Code/Mantid/DataObjects/test/WorkspaceValidatorsTest.h +++ b/Code/Mantid/DataObjects/test/WorkspaceValidatorsTest.h @@ -169,6 +169,7 @@ public: IValidator<MatrixWorkspace_sptr> *v = compVal.clone(); TS_ASSERT_DIFFERS( v, &compVal ) TS_ASSERT( dynamic_cast<CompositeValidator<>*>(v) ) + delete v; } void testCompositeValidator_isValidandAdd() diff --git a/Code/Mantid/DataObjects/test/runTests.sh b/Code/Mantid/DataObjects/test/runTests.sh index 158b6f898f09952d8a73c4a1d92a1b3990fe20df..9d0dcae6195a7962c32634e434ba82b9f07270ad 100755 --- a/Code/Mantid/DataObjects/test/runTests.sh +++ b/Code/Mantid/DataObjects/test/runTests.sh @@ -11,6 +11,9 @@ # Author: Russell Taylor, 07/11/07 # +# Remove old test build +rm -rf runner.* + echo "Generating the source file from the test header files..." # Chaining all tests together can have effects that you don't think of # - it's always a good idea to run your new/changed test on its own @@ -24,10 +27,8 @@ echo echo "Compiling the test executable..." g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../API/inc -I ../../Geometry/inc \ -I ../../../Third_Party/include \ - -L ../../debug -L ../../Build -L ../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidDataObjects -lMantidKernel -lMantidGeometry -lMantidAPI -lPocoFoundation -lPocoUtil \ - -lboost_regex -lboost_signals -lmuparserd -lgsl -lgslcblas -lGL -lGLU -lgts \ - -lTKernel -lTKBO -lTKPrim -lTKMesh + -L ../../debug -L ../../Build \ + -lMantidDataObjects echo echo "Running the tests..." @@ -38,7 +39,6 @@ echo # Remove the generated files to ensure that they're not inadvertently run # when something in the chain has failed. echo "Cleaning up..." -rm -rf runner.* rm -f *.properties rm -f Test.log echo "Done." diff --git a/Code/Mantid/Geometry/test/runTests.sh b/Code/Mantid/Geometry/test/runTests.sh index 9cc1502ea4ee3a18459270e25f1dd0c65cc19429..1c566268a8403f45d2b829293e12c19bf00c7703 100755 --- a/Code/Mantid/Geometry/test/runTests.sh +++ b/Code/Mantid/Geometry/test/runTests.sh @@ -25,10 +25,7 @@ echo echo "Compiling the test executable..." g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../../Third_Party/include \ - -L ../../debug -L ../../Build -L ../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidGeometry -lMantidKernel -lPocoFoundation -lPocoUtil \ - -lboost_regex -lboost_signals -lgsl -lgslcblas -lGL -lGLU -lgts \ - -lTKernel -lTKBO -lTKPrim -lTKMesh + -L ../../debug -L ../../Build -lMantidGeometry -lMantidKernel echo echo "Running the tests..." diff --git a/Code/Mantid/Kernel/test/FilePropertyTest.h b/Code/Mantid/Kernel/test/FilePropertyTest.h index 7c0f2a0655d3a352c2442683c16e6c68c6824a3e..20db5ae9bec6783295ee91de8d939e9716cae860 100644 --- a/Code/Mantid/Kernel/test/FilePropertyTest.h +++ b/Code/Mantid/Kernel/test/FilePropertyTest.h @@ -72,6 +72,7 @@ public: msg = fp->setValue("GEM38371.raw"); TS_ASSERT_EQUALS(msg, "") + delete fp; } void testSaveProperty() @@ -84,6 +85,8 @@ public: //Test for some random file name as this doesn't need to exist here std::string msg = fp->setValue("filepropertytest.sav"); TS_ASSERT_EQUALS(msg, "") + + delete fp; } }; diff --git a/Code/Mantid/Kernel/test/LogFilterTest.h b/Code/Mantid/Kernel/test/LogFilterTest.h index 0a550b4610487e67559ebc9d56761d2dd04d4293..57ee3822270fce40cd90035a39f9ddcff324415e 100644 --- a/Code/Mantid/Kernel/test/LogFilterTest.h +++ b/Code/Mantid/Kernel/test/LogFilterTest.h @@ -22,7 +22,12 @@ public: p->addValue("2007-11-30T16:17:30",4); p->addValue("2007-11-30T16:17:40",5); } - + + ~LogFilterTest() + { + delete p; + } + void testnthValue() { TS_ASSERT_EQUALS( p->size(), 5 ) diff --git a/Code/Mantid/Kernel/test/PropertyTest.h b/Code/Mantid/Kernel/test/PropertyTest.h index aa06b8b821ca7afb0f1a34afcfdb07c282d23aca..9d4cf47f9649048453c2063a6ec29518b937d377 100644 --- a/Code/Mantid/Kernel/test/PropertyTest.h +++ b/Code/Mantid/Kernel/test/PropertyTest.h @@ -27,6 +27,11 @@ public: p = new PropertyHelper; } + ~PropertyTest() + { + delete p; + } + void testName() { TS_ASSERT( ! p->name().compare("Test") ) diff --git a/Code/Mantid/Kernel/test/TimeSeriesPropertyTest.h b/Code/Mantid/Kernel/test/TimeSeriesPropertyTest.h index 0efaefc9d87763f889efad73ce2b052781267acc..bbdb4aa3112f8981026f9730883b8e29b71a67f3 100644 --- a/Code/Mantid/Kernel/test/TimeSeriesPropertyTest.h +++ b/Code/Mantid/Kernel/test/TimeSeriesPropertyTest.h @@ -17,6 +17,13 @@ public: sProp = new TimeSeriesProperty<std::string>("stringProp"); } + ~TimeSeriesPropertyTest() + { + delete iProp; + delete dProp; + delete sProp; + } + void testConstructor() { // Test that all the base class member variables are correctly assigned to diff --git a/Code/Mantid/Kernel/test/runTests.sh b/Code/Mantid/Kernel/test/runTests.sh index 3a87d02bc2daae6832b80125590ffb453e3c98e0..fbe9b02bb0474276c0294784b65a24bd6dcb4507 100755 --- a/Code/Mantid/Kernel/test/runTests.sh +++ b/Code/Mantid/Kernel/test/runTests.sh @@ -26,8 +26,7 @@ echo echo "Compiling the test executable..." g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../../Third_Party/include \ - -L ../../debug -L ../../Build -L ../../../Third_Party/lib/linux64 \ - -lMantidKernel -lPocoFoundationd -lPocoUtild -lboost_signals + -L ../../debug -L ../../Build -lMantidKernel echo echo "Running the tests..." diff --git a/Code/Mantid/Nexus/src/LoadNexusProcessed.cpp b/Code/Mantid/Nexus/src/LoadNexusProcessed.cpp index 8205ad74a2e4f10324405ca810fef382498c350d..cad445576285e05b9e8fe49aaafe5378ec904c42 100644 --- a/Code/Mantid/Nexus/src/LoadNexusProcessed.cpp +++ b/Code/Mantid/Nexus/src/LoadNexusProcessed.cpp @@ -354,6 +354,7 @@ namespace Mantid } local_workspace->mutableSpectraMap().populate(spectra_list, det_list.get(), ndets); + delete[] spectra_list; } /** diff --git a/Code/Mantid/Nexus/src/NexusClasses.cpp b/Code/Mantid/Nexus/src/NexusClasses.cpp index f072dd7a34653137ef609c8ff223b1383567f6b3..8a359d5589e3c4ede95b840b29a3e4171c6f7f45 100644 --- a/Code/Mantid/Nexus/src/NexusClasses.cpp +++ b/Code/Mantid/Nexus/src/NexusClasses.cpp @@ -310,7 +310,7 @@ std::vector< std::string >& NXNote::data() NXgetdata(m_fileID,buffer); NXclosedata(m_fileID); std::istringstream istr(std::string(buffer,n)); - delete buffer; + delete[] buffer; /* end of new code */ m_data.clear(); diff --git a/Code/Mantid/Nexus/test/runTests.sh b/Code/Mantid/Nexus/test/runTests.sh index 6fea0fb79db4a2f10b7203420ed7f4d255ac8cec..b2c9e96df443e0fb6354136c8912fbfbc050c9c0 100644 --- a/Code/Mantid/Nexus/test/runTests.sh +++ b/Code/Mantid/Nexus/test/runTests.sh @@ -25,10 +25,8 @@ echo echo "Compiling the test executable..." g++ -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../API/inc -I ../../DataObjects/inc -I ../../DataHandling/inc -I ../../Geometry/inc \ - -I ../../../Third_Party/include -L../../debug -L../../Build -L../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidNexus -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects -lMantidDataHandling \ - -lboost_date_time -lPocoFoundation -lPocoUtil \ - -lboost_regex -lboost_signals -lmuparserd -lgsl -lgslcblas + -I ../../../Third_Party/include -L../../debug -L../../Build \ + -lMantidNexus -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects -lMantidDataHandling echo diff --git a/Code/Mantid/PythonAPI/test/runTests.sh b/Code/Mantid/PythonAPI/test/runTests.sh index a5b9e08b97906d542e66a5dfefd3e27ab8577045..085452a95765ec72ef07d1fb7e520c466bb069cc 100644 --- a/Code/Mantid/PythonAPI/test/runTests.sh +++ b/Code/Mantid/PythonAPI/test/runTests.sh @@ -26,12 +26,8 @@ echo echo "Compiling the test executable..." g++ -w -O0 -g3 -o runner.exe runner.cpp -I ../inc -I ../../Kernel/inc -I ../../API/inc -I ../../DataObjects/inc -I ../../Geometry/inc \ -I ../../../Third_Party/include -I /usr/include/python2.3 \ - -L ../../debug -L ../../Build -L ../../../Third_Party/lib/linux64 -L $OPENCASCADELIBS \ - -lMantidPythonAPI -lMantidKernel -lMantidGeometry -lMantidAPI -lMantidDataObjects \ - -lPocoFoundation -lPocoUtil -lboost_python -lboost_regex \ - -lboost_date_time -lboost_signals -lpython2.3 \ - -lmuparserd -lgsl -lgslcblas -lGL -lGLU -lgts \ - -lTKernel -lTKBO -lTKPrim -lTKMesh + -L ../../debug -L ../../Build \ + -lMantidPythonAPI echo echo "Running the tests..."