From bfca7296e6b94985630615bc5d330ff4dd321e23 Mon Sep 17 00:00:00 2001 From: Samuel Jones <samjones714@gmail.com> Date: Wed, 22 May 2019 16:55:26 +0100 Subject: [PATCH] GCC8 fixes catch exception by refference, no const casting etc --- Framework/API/test/AlgorithmFactoryTest.h | 2 +- Framework/API/test/AlgorithmManagerTest.h | 6 +- Framework/API/test/AlgorithmPropertyTest.h | 2 +- Framework/API/test/AlgorithmTest.h | 15 +- Framework/API/test/AnalysisDataServiceTest.h | 39 +-- Framework/API/test/BinEdgeAxisTest.h | 4 +- Framework/API/test/BoxControllerTest.h | 2 +- Framework/API/test/CompositeFunctionTest.h | 12 +- Framework/API/test/DetectorInfoTest.h | 16 +- Framework/API/test/ExperimentInfoTest.h | 28 +- Framework/API/test/ExpressionTest.h | 16 +- Framework/API/test/FermiChopperModelTest.h | 8 +- .../API/test/FileBackedExperimentInfoTest.h | 4 +- Framework/API/test/FileFinderTest.h | 16 +- Framework/API/test/FrameworkManagerTest.h | 6 +- Framework/API/test/FunctionAttributeTest.h | 2 +- .../API/test/FunctionDomainGeneralTest.h | 2 +- .../API/test/FunctionParameterDecoratorTest.h | 55 ++-- Framework/API/test/FunctionTest.h | 8 +- Framework/API/test/FunctionValuesTest.h | 14 +- Framework/API/test/IFunction1DSpectrumTest.h | 2 +- Framework/API/test/ILatticeFunctionTest.h | 4 +- Framework/API/test/IMDWorkspaceTest.h | 5 +- .../API/test/IkedaCarpenterModeratorTest.h | 14 +- .../API/test/ImmutableCompositeFunctionTest.h | 4 +- .../API/test/ImplicitFunctionFactoryTest.h | 2 +- ...plicitFunctionParameterParserFactoryTest.h | 2 +- .../test/ImplicitFunctionParserFactoryTest.h | 2 +- Framework/API/test/IndexTypePropertyTest.h | 2 +- .../API/test/InstrumentDataServiceTest.h | 6 +- Framework/API/test/LatticeDomainTest.h | 4 +- Framework/API/test/LiveListenerFactoryTest.h | 7 +- Framework/API/test/LogFilterGeneratorTest.h | 4 +- Framework/API/test/LogManagerTest.h | 32 +-- .../API/test/MatrixWorkspaceMDIteratorTest.h | 2 +- Framework/API/test/MatrixWorkspaceTest.h | 127 ++++----- Framework/API/test/MultiDomainFunctionTest.h | 4 +- .../API/test/MultiPeriodGroupAlgorithmTest.h | 4 +- Framework/API/test/NumericAxisTest.h | 20 +- .../test/ParamFunctionAttributeHolderTest.h | 4 +- Framework/API/test/ParameterTieTest.h | 24 +- Framework/API/test/ProgressTest.h | 4 +- .../API/test/RemoteJobManagerFactoryTest.h | 16 +- Framework/API/test/RunTest.h | 36 +-- Framework/API/test/SampleTest.h | 6 +- Framework/API/test/ScopedWorkspaceTest.h | 2 +- Framework/API/test/SpectraAxisTest.h | 13 +- .../API/test/SpectrumDetectorMappingTest.h | 14 +- Framework/API/test/SpectrumInfoTest.h | 18 +- Framework/API/test/TempFunctionTest.h | 6 +- Framework/API/test/TextAxisTest.h | 2 +- .../API/test/VectorParameterParserTest.h | 4 +- Framework/API/test/VectorParameterTest.h | 2 +- Framework/API/test/WorkspaceFactoryTest.h | 6 +- Framework/API/test/WorkspaceGroupTest.h | 10 +- Framework/API/test/WorkspaceHistoryTest.h | 4 +- Framework/API/test/WorkspaceOpOverloadsTest.h | 2 +- Framework/API/test/WorkspacePropertyTest.h | 4 +- Framework/Algorithms/src/MergeRuns.cpp | 2 +- Framework/Algorithms/src/RadiusSum.cpp | 9 +- .../src/ReflectometryReductionOneAuto2.cpp | 2 +- Framework/Algorithms/test/AddNoteTest.h | 6 +- .../Algorithms/test/AddTimeSeriesLogTest.h | 16 +- .../Algorithms/test/AlignDetectorsTest.h | 2 +- .../test/AnnularRingAbsorptionTest.h | 6 +- .../Algorithms/test/AnyShapeAbsorptionTest.h | 4 +- .../test/Bin2DPowderDiffractionTest.h | 2 +- .../Algorithms/test/BinaryOperationTest.h | 2 +- Framework/Algorithms/test/CalculateIqtTest.h | 8 +- .../Algorithms/test/ConjoinWorkspacesTest.h | 6 +- Framework/Algorithms/test/ConjoinXRunsTest.h | 10 +- .../test/ConvertSpectrumAxis2Test.h | 23 +- .../Algorithms/test/ConvertSpectrumAxisTest.h | 8 +- .../test/ConvertTableToMatrixWorkspaceTest.h | 4 +- Framework/Algorithms/test/CopyDataRangeTest.h | 10 +- Framework/Algorithms/test/CorrectToFileTest.h | 2 +- .../test/CreateLogTimeCorrectionTest.h | 2 +- .../Algorithms/test/CreatePSDBleedMaskTest.h | 2 +- .../test/CreateSingleValuedWorkspaceTest.h | 4 +- .../test/CreateTransmissionWorkspaceTest.h | 16 +- .../Algorithms/test/CreateWorkspaceTest.h | 2 +- .../Algorithms/test/CropToComponentTest.h | 2 +- Framework/Algorithms/test/CropWorkspaceTest.h | 2 +- .../Algorithms/test/CrossCorrelateTest.h | 2 +- .../test/CuboidGaugeVolumeAbsorptionTest.h | 2 +- .../Algorithms/test/CylinderAbsorptionTest.h | 2 +- Framework/Algorithms/test/DeleteLogTest.h | 2 +- .../test/DetectorEfficiencyCorTest.h | 2 +- Framework/Algorithms/test/ExponentialTest.h | 2 +- .../Algorithms/test/ExtractFFTSpectrumTest.h | 2 +- Framework/Algorithms/test/FFTTest.h | 10 +- .../Algorithms/test/FilterByLogValueTest.h | 10 +- .../Algorithms/test/FilterByXValueTest.h | 2 +- .../test/GenerateEventsFilterTest.h | 2 +- Framework/Algorithms/test/GetAllEiTest.h | 8 +- Framework/Algorithms/test/GetEiTest.h | 2 +- Framework/Algorithms/test/GetEiV1Test.h | 2 +- .../Algorithms/test/He3TubeEfficiencyTest.h | 8 +- Framework/Algorithms/test/IQTransformTest.h | 2 +- .../test/IndirectFitDataCreationHelperTest.h | 4 +- Framework/Algorithms/test/IntegrationTest.h | 2 +- .../Algorithms/test/InterpolatingRebinTest.h | 2 +- .../Algorithms/test/InterpolationOptionTest.h | 4 +- .../test/MCAbsorptionStrategyTest.h | 2 +- .../Algorithms/test/MCInteractionVolumeTest.h | 4 +- .../test/MagFormFactorCorrectionTest.h | 2 +- Framework/Algorithms/test/MaskBinsTest.h | 2 +- .../Algorithms/test/MaskInstrumentTest.h | 4 +- .../test/MaxEnt/MaxentCalculatorTest.h | 26 +- .../test/MaxEnt/MaxentSpaceRealTest.h | 2 +- Framework/Algorithms/test/MaxEntTest.h | 16 +- .../test/MayersSampleCorrectionStrategyTest.h | 2 +- .../test/MayersSampleCorrectionTest.h | 4 +- Framework/Algorithms/test/MergeRunsTest.h | 6 +- .../test/ModeratorTzeroLinearTest.h | 6 +- .../test/MonteCarloAbsorptionTest.h | 8 +- .../Algorithms/test/MultiplyDivideTest.in.h | 4 +- .../Algorithms/test/NormaliseByCurrentTest.h | 2 +- .../Algorithms/test/NormaliseByDetectorTest.h | 2 +- .../Algorithms/test/NormaliseToMonitorTest.h | 2 +- Framework/Algorithms/test/PlusMinusTest.in.h | 4 +- Framework/Algorithms/test/PoissonErrorsTest.h | 4 +- .../test/PolarizationCorrectionWildesTest.h | 8 +- .../test/PolarizationEfficiencyCorTest.h | 26 +- Framework/Algorithms/test/PowerTest.h | 2 +- Framework/Algorithms/test/RadiusSumTest.h | 6 +- Framework/Algorithms/test/RebinTest.h | 4 +- .../Algorithms/test/RebinToWorkspaceTest.h | 2 +- .../test/ReflectometryReductionOne2Test.h | 2 +- Framework/Algorithms/test/RegroupTest.h | 4 +- .../Algorithms/test/RemoveBackgroundTest.h | 4 +- .../Algorithms/test/RenameWorkspaceTest.h | 12 +- .../Algorithms/test/RenameWorkspacesTest.h | 12 +- Framework/Algorithms/test/RingProfileTest.h | 8 +- .../test/SANSCollimationLengthEstimatorTest.h | 2 +- Framework/Algorithms/test/ScaleXTest.h | 4 +- Framework/Algorithms/test/SmoothDataTest.h | 4 +- .../Algorithms/test/SmoothNeighboursTest.h | 6 +- Framework/Algorithms/test/SortEventsTest.h | 2 +- Framework/Algorithms/test/Stitch1DManyTest.h | 26 +- Framework/Algorithms/test/Stitch1DTest.h | 4 +- .../Algorithms/test/SumEventsByLogValueTest.h | 4 +- Framework/Algorithms/test/SumRowColumnTest.h | 2 +- Framework/Algorithms/test/SumSpectraTest.h | 6 +- Framework/Algorithms/test/TransposeTest.h | 2 +- .../Algorithms/test/UnGroupWorkspaceTest.h | 2 +- .../Algorithms/test/UnwrapMonitorsInTOFTest.h | 2 +- .../Algorithms/test/WeightingStrategyTest.h | 8 +- Framework/Beamline/test/DetectorInfoTest.h | 4 +- Framework/Catalog/test/ONCatEntityTest.h | 4 +- Framework/Catalog/test/ONCatTest.h | 6 +- .../Crystal/test/CalibrationHelpersTest.h | 2 +- .../Crystal/test/CombinePeaksWorkspacesTest.h | 2 +- .../Crystal/test/DiffPeaksWorkspacesTest.h | 2 +- .../Crystal/test/FindSXPeaksHelperTest.h | 6 +- Framework/Crystal/test/FindSXPeaksTest.h | 2 +- Framework/Crystal/test/IndexSXPeaksTest.h | 6 +- .../Crystal/test/PeakStatisticsToolsTest.h | 4 +- Framework/Crystal/test/SetUBTest.h | 8 +- .../test/Algorithms/ConvertToYSpaceTest.h | 10 +- .../Algorithms/ConvolutionFitSequentialTest.h | 22 +- .../Algorithms/EstimateFitParametersTest.h | 6 +- .../CurveFitting/test/Algorithms/FitTest.h | 4 +- .../test/Algorithms/QENSFitSequentialTest.h | 2 +- .../test/Algorithms/QENSFitSimultaneousTest.h | 2 +- .../RefinePowderInstrumentParametersTest.h | 2 +- .../Algorithms/SeqDomainSpectrumCreatorTest.h | 4 +- .../VesuvioCalculateGammaBackgroundTest.h | 6 +- .../test/Algorithms/VesuvioCalculateMSTest.h | 20 +- .../test/AugmentedLagrangianOptimizerTest.h | 8 +- .../CurveFitting/test/ComplexMatrixTest.h | 4 +- .../CurveFitting/test/ComplexVectorTest.h | 4 +- .../test/Constraints/BoundaryConstraintTest.h | 4 +- Framework/CurveFitting/test/FitMWTest.h | 4 +- .../test/FuncMinimizers/FABADAMinimizerTest.h | 2 +- .../FunctionDomain1DSpectrumCreatorTest.h | 10 +- .../CurveFitting/test/Functions/BSplineTest.h | 16 +- .../test/Functions/ChebyshevTest.h | 12 +- .../ComptonScatteringCountRateTest.h | 4 +- .../test/Functions/CrystalFieldControlTest.h | 2 +- .../Functions/CrystalFieldMultiSpectrumTest.h | 2 +- .../test/Functions/CrystalFieldPeaksTest.h | 4 +- .../test/Functions/CrystalFieldSpectrumTest.h | 8 +- .../test/Functions/CubicSplineTest.h | 10 +- .../test/Functions/FullprofPolynomialTest.h | 4 +- .../GramCharlierComptonProfileTest.h | 2 +- .../test/Functions/LinearBackgroundTest.h | 4 +- .../test/Functions/PawleyFunctionTest.h | 50 ++-- .../Functions/PeakParameterFunctionTest.h | 10 +- .../test/Functions/PolynomialTest.h | 6 +- .../test/Functions/QuadraticTest.h | 6 +- .../test/Functions/StretchExpTest.h | 2 +- .../test/Functions/TabulatedFunctionTest.h | 4 +- Framework/CurveFitting/test/GSLMatrixTest.h | 10 +- Framework/CurveFitting/test/GSLVectorTest.h | 6 +- .../test/HistogramDomainCreatorTest.h | 2 +- .../test/IPeakFunctionIntensityTest.h | 4 +- .../test/LatticeDomainCreatorTest.h | 4 +- .../CurveFitting/test/LatticeFunctionTest.h | 2 +- Framework/DataHandling/src/AsciiPointBase.cpp | 2 +- Framework/DataHandling/src/LoadBBY.cpp | 6 +- Framework/DataHandling/src/LoadILLSANS.cpp | 6 +- Framework/DataHandling/src/LoadMuonNexus1.cpp | 2 +- Framework/DataHandling/src/LoadNexusLogs.cpp | 6 +- .../DataHandling/test/CompressEventsTest.h | 2 +- .../test/CreateChopperModelTest.h | 6 +- .../test/CreateModeratorModelTest.h | 6 +- .../test/CreatePolarizationEfficienciesTest.h | 4 +- .../test/CreateSimulationWorkspaceTest.h | 4 +- .../ExtractPolarizationEfficienciesTest.h | 12 +- .../test/FilterEventsByLogValuePreNexusTest.h | 2 +- .../DataHandling/test/GroupDetectors2Test.h | 2 +- .../JoinISISPolarizationEfficienciesTest.h | 6 +- Framework/DataHandling/test/LoadBBYTest.h | 2 +- .../DataHandling/test/LoadCanSAS1dTest.h | 2 +- .../DataHandling/test/LoadDetectorInfoTest.h | 2 +- Framework/DataHandling/test/LoadEMUauTest.h | 2 +- .../test/LoadEventNexusIndexSetupTest.h | 10 +- .../DataHandling/test/LoadEventNexusTest.h | 2 +- .../test/LoadEventPreNexus2Test.h | 6 +- Framework/DataHandling/test/LoadFITSTest.h | 28 +- Framework/DataHandling/test/LoadGSSTest.h | 6 +- .../DataHandling/test/LoadIDFFromNexusTest.h | 2 +- .../DataHandling/test/LoadISISNexusTest.h | 10 +- .../LoadISISPolarizationEfficienciesTest.h | 2 +- .../test/LoadInstrumentFromRawTest.h | 2 +- .../DataHandling/test/LoadInstrumentTest.h | 6 +- Framework/DataHandling/test/LoadLogTest.h | 4 +- .../DataHandling/test/LoadMappingTableTest.h | 2 +- .../DataHandling/test/LoadMcStasNexusTest.h | 2 +- Framework/DataHandling/test/LoadMcStasTest.h | 2 +- Framework/DataHandling/test/LoadMuonLogTest.h | 2 +- .../DataHandling/test/LoadMuonNexus1Test.h | 2 +- .../test/LoadNexusProcessedTest.h | 2 +- Framework/DataHandling/test/LoadNexusTest.h | 2 +- Framework/DataHandling/test/LoadPLNTest.h | 2 +- Framework/DataHandling/test/LoadRKHTest.h | 2 +- Framework/DataHandling/test/LoadRaw3Test.h | 16 +- Framework/DataHandling/test/LoadRawBin0Test.h | 2 +- .../DataHandling/test/LoadRawSpectrum0Test.h | 2 +- Framework/DataHandling/test/LoadSESANSTest.h | 2 +- .../test/LoadSampleEnvironmentTest.h | 4 +- Framework/DataHandling/test/LoadSpice2dTest.h | 4 +- Framework/DataHandling/test/LoadTBLTest.h | 4 +- .../test/PDLoadCharacterizationsTest.h | 2 +- .../DataHandling/test/ReadMaterialTest.h | 2 +- Framework/DataHandling/test/RemoveLogsTest.h | 4 +- Framework/DataHandling/test/SaveAscii2Test.h | 24 +- .../test/SaveBankScatteringAnglesTest.h | 2 +- Framework/DataHandling/test/SaveCSVTest.h | 2 +- Framework/DataHandling/test/SaveDiffCalTest.h | 4 +- Framework/DataHandling/test/SaveFITSTest.h | 18 +- Framework/DataHandling/test/SaveGDATest.h | 2 +- Framework/DataHandling/test/SaveNXSPETest.h | 3 +- .../test/SaveNexusProcessedTest.h | 2 +- .../test/SaveOpenGenieAsciiTest.h | 4 +- Framework/DataHandling/test/SaveRKHTest.h | 6 +- .../test/SaveReflectometryAsciiTest.h | 4 +- Framework/DataHandling/test/SaveSESANSTest.h | 2 +- Framework/DataHandling/test/SetBeamTest.h | 10 +- Framework/DataHandling/test/SetSampleTest.h | 8 +- .../test/SortTableWorkspaceTest.h | 8 +- .../test/UpdateInstrumentFromFileTest.h | 4 +- .../MortonIndex/WideIntImpl.h | 4 +- .../DataObjects/src/EventWorkspaceMRU.cpp | 12 +- .../test/AffineMatrixParameterParserTest.h | 4 +- .../test/AffineMatrixParameterTest.h | 8 +- .../test/BoxControllerNeXusIOTest.h | 10 +- .../test/CoordTransformAffineParserTest.h | 4 +- .../test/CoordTransformDistanceParserTest.h | 4 +- Framework/DataObjects/test/EventListTest.h | 84 +++--- .../DataObjects/test/EventWorkspaceTest.h | 20 +- Framework/DataObjects/test/FakeMDTest.h | 2 +- Framework/DataObjects/test/Histogram1DTest.h | 10 +- Framework/DataObjects/test/MDBoxBaseTest.h | 2 +- .../DataObjects/test/MDBoxFlatTreeTest.h | 2 +- Framework/DataObjects/test/MDBoxTest.h | 2 +- .../DataObjects/test/MDEventFactoryTest.h | 6 +- Framework/DataObjects/test/MDEventTest.h | 4 +- .../DataObjects/test/MDEventWorkspaceTest.h | 6 +- .../MDFramesToSpecialCoordinateSystemTest.h | 4 +- Framework/DataObjects/test/MDGridBoxTest.h | 2 +- .../test/MDHistoWorkspaceIteratorTest.h | 2 +- .../DataObjects/test/MaskWorkspaceTest.h | 4 +- Framework/DataObjects/test/PeakColumnTest.h | 9 +- Framework/DataObjects/test/RefAxisTest.h | 18 +- .../DataObjects/test/TableWorkspaceTest.h | 23 +- Framework/DataObjects/test/VectorColumnTest.h | 2 +- Framework/DataObjects/test/Workspace2DTest.h | 12 +- .../DataObjects/test/WorkspaceCreationTest.h | 4 +- .../test/WorkspaceValidatorsTest.h | 2 +- Framework/Geometry/test/BasicHKLFiltersTest.h | 18 +- Framework/Geometry/test/BoundingBoxTest.h | 10 +- Framework/Geometry/test/CSGObjectTest.h | 6 +- Framework/Geometry/test/CenteringGroupTest.h | 4 +- Framework/Geometry/test/CompAssemblyTest.h | 14 +- Framework/Geometry/test/ComponentTest.h | 4 +- .../test/CompositeBraggScattererTest.h | 6 +- Framework/Geometry/test/ContainerTest.h | 4 +- .../Geometry/test/ConvexPolygonIteratorTest.h | 2 +- Framework/Geometry/test/ConvexPolygonTest.h | 4 +- Framework/Geometry/test/GoniometerTest.h | 4 +- Framework/Geometry/test/GridDetectorTest.h | 14 +- Framework/Geometry/test/GroupTest.h | 14 +- Framework/Geometry/test/HKLFilterTest.h | 8 +- .../Geometry/test/HKLFilterWavelengthTest.h | 12 +- .../Geometry/test/IMDDimensionFactoryTest.h | 20 +- .../test/InstrumentDefinitionParserTest.h | 6 +- .../Geometry/test/InstrumentRayTracerTest.h | 4 +- Framework/Geometry/test/InstrumentTest.h | 41 +-- .../test/IsotropicAtomBraggScattererTest.h | 6 +- .../Geometry/test/MDGeometryXMLBuilderTest.h | 8 +- .../Geometry/test/MDGeometryXMLParserTest.h | 16 +- .../test/MDHistoDimensionBuilderTest.h | 16 +- .../Geometry/test/MDHistoDimensionTest.h | 2 +- .../test/MatrixVectorPairParserTest.h | 8 +- Framework/Geometry/test/MeshObjectTest.h | 2 +- Framework/Geometry/test/ObjCompAssemblyTest.h | 15 +- Framework/Geometry/test/ObjComponentTest.h | 6 +- Framework/Geometry/test/OrientedLatticeTest.h | 2 +- Framework/Geometry/test/ParCompAssemblyTest.h | 8 +- Framework/Geometry/test/ParDetectorTest.h | 4 +- Framework/Geometry/test/ParInstrumentTest.h | 13 +- .../Geometry/test/ParObjCompAssemblyTest.h | 6 +- Framework/Geometry/test/ParObjComponentTest.h | 4 +- .../Geometry/test/PointGroupFactoryTest.h | 4 +- Framework/Geometry/test/PointGroupTest.h | 4 +- Framework/Geometry/test/RasterizeTest.h | 2 +- .../Geometry/test/RectangularDetectorTest.h | 12 +- Framework/Geometry/test/ReferenceFrameTest.h | 2 +- .../Geometry/test/ReflectionConditionTest.h | 4 +- .../test/SampleEnvironmentFactoryTest.h | 4 +- .../SampleEnvironmentSpecFileFinderTest.h | 10 +- .../test/SampleEnvironmentSpecParserTest.h | 10 +- .../Geometry/test/SampleEnvironmentSpecTest.h | 6 +- .../Geometry/test/SampleEnvironmentTest.h | 2 +- .../Geometry/test/SpaceGroupFactoryTest.h | 18 +- .../Geometry/test/StructuredDetectorTest.h | 24 +- .../test/SymmetryElementFactoryTest.h | 2 +- Framework/Geometry/test/SymmetryElementTest.h | 2 +- .../test/SymmetryOperationFactoryTest.h | 8 +- .../test/SymmetryOperationSymbolParserTest.h | 6 +- .../Geometry/test/SymmetryOperationTest.h | 6 +- Framework/Geometry/test/TorusTest.h | 3 +- Framework/Geometry/test/UnitCellTest.h | 4 +- Framework/Geometry/test/V3RTest.h | 13 +- .../test/XMLInstrumentParameterTest.h | 2 +- Framework/HistogramData/test/AddableTest.h | 8 +- .../test/CountStandardDeviationsTest.h | 8 +- .../HistogramData/test/CountVariancesTest.h | 8 +- Framework/HistogramData/test/CountsTest.h | 12 +- .../test/EstimatePolynomialTest.h | 6 +- .../test/FixedLengthVectorTest.h | 11 +- .../HistogramData/test/FrequenciesTest.h | 8 +- .../test/FrequencyStandardDeviationsTest.h | 8 +- .../test/FrequencyVariancesTest.h | 8 +- .../HistogramData/test/HistogramBuilderTest.h | 6 +- .../HistogramData/test/HistogramMathTest.h | 46 ++-- Framework/HistogramData/test/HistogramTest.h | 241 ++++++++++-------- .../HistogramData/test/InterpolateTest.h | 24 +- .../HistogramData/test/MultipliableTest.h | 8 +- Framework/HistogramData/test/PointsTest.h | 2 +- Framework/HistogramData/test/RebinTest.h | 17 +- Framework/ICat/test/CatalogLoginTest.h | 2 +- Framework/ICat/test/CatalogSearchTest.h | 8 +- .../MantidIndexing/SpectrumNumberTranslator.h | 4 +- Framework/Indexing/test/GroupTest.h | 2 +- Framework/Indexing/test/IndexInfoTest.h | 8 +- Framework/Indexing/test/IndexSetTest.h | 10 +- Framework/Indexing/test/PartitionerTest.h | 12 +- .../test/SpectrumNumberTranslatorTest.h | 28 +- Framework/Kernel/test/ArrayPropertyTest.h | 9 +- Framework/Kernel/test/AtomTest.h | 4 +- Framework/Kernel/test/BinaryFileTest.h | 10 +- .../Kernel/test/BinaryStreamReaderTest.h | 2 +- .../test/BoseEinsteinDistributionTest.h | 4 +- .../Kernel/test/ComputeResourceInfoTest.h | 8 +- Framework/Kernel/test/ConfigServiceTest.h | 6 +- Framework/Kernel/test/DataServiceTest.h | 18 +- .../Kernel/test/DateAndTimeHelpersTest.h | 2 +- Framework/Kernel/test/DateAndTimeTest.h | 8 +- Framework/Kernel/test/DiskBufferTest.h | 2 +- Framework/Kernel/test/DynamicFactoryTest.h | 22 +- Framework/Kernel/test/FacilitiesTest.h | 9 +- Framework/Kernel/test/FileDescriptorTest.h | 8 +- Framework/Kernel/test/FunctionTaskTest.h | 2 +- Framework/Kernel/test/IndexSetTest.h | 10 +- Framework/Kernel/test/InstrumentInfoTest.h | 12 +- Framework/Kernel/test/InterpolationTest.h | 6 +- Framework/Kernel/test/ListValidatorTest.h | 6 +- Framework/Kernel/test/LiveListenerInfoTest.h | 4 +- Framework/Kernel/test/LogParserTest.h | 2 +- Framework/Kernel/test/MagneticIonTest.h | 8 +- Framework/Kernel/test/MaterialBuilderTest.h | 30 +-- Framework/Kernel/test/MaterialTest.h | 2 +- Framework/Kernel/test/MaterialXMLParserTest.h | 8 +- Framework/Kernel/test/MatrixTest.h | 35 +-- Framework/Kernel/test/NeutronAtomTest.h | 4 +- Framework/Kernel/test/NexusDescriptorTest.h | 8 +- Framework/Kernel/test/OptionalBoolTest.h | 4 +- .../test/PropertyManagerDataServiceTest.h | 6 +- .../Kernel/test/PropertyManagerPropertyTest.h | 2 +- Framework/Kernel/test/PropertyManagerTest.h | 36 +-- Framework/Kernel/test/PropertyTest.h | 2 +- .../Kernel/test/PropertyWithValueJSONTest.h | 6 +- Framework/Kernel/test/PropertyWithValueTest.h | 2 +- Framework/Kernel/test/SLSQPMinimizerTest.h | 8 +- Framework/Kernel/test/StatisticsTest.h | 2 +- Framework/Kernel/test/StringsTest.h | 2 +- .../Kernel/test/ThreadPoolRunnableTest.h | 2 +- Framework/Kernel/test/ThreadPoolTest.h | 2 +- .../Kernel/test/TimeSeriesPropertyTest.h | 44 ++-- Framework/Kernel/test/TimeSplitterTest.h | 6 +- Framework/Kernel/test/UnitConversionTest.h | 4 +- Framework/Kernel/test/UnitFactoryTest.h | 2 +- Framework/Kernel/test/UnitTest.h | 21 +- Framework/Kernel/test/V3DTest.h | 2 +- Framework/Kernel/test/VectorHelperTest.h | 21 +- .../LiveData/src/ISIS/DAE/isisds_command.cpp | 5 +- .../LiveData/test/FileEventDataListenerTest.h | 2 +- .../LiveData/test/ISISHistoDataListenerTest.h | 4 +- .../test/KafkaEventStreamDecoderTest.h | 6 +- .../test/CachedExperimentInfoTest.h | 8 +- .../CompositeImplicitFunctionParserTest.h | 4 +- .../ConvertMDHistoToMatrixWorkspaceTest.h | 2 +- .../test/ConvertToMDComponentsTest.h | 4 +- Framework/MDAlgorithms/test/ConvertToMDTest.h | 2 +- .../MDAlgorithms/test/ConvertToQ3DdETest.h | 2 +- .../test/ConvertToReflectometryQTest.h | 14 +- .../test/CreateMDHistoWorkspaceTest.h | 6 +- Framework/MDAlgorithms/test/CreateMDTest.h | 8 +- .../MDAlgorithms/test/CreateMDWorkspaceTest.h | 4 +- Framework/MDAlgorithms/test/CutMDTest.h | 2 +- Framework/MDAlgorithms/test/FindPeaksMDTest.h | 2 +- .../test/FitResolutionConvolvedModelTest.h | 2 +- .../test/ImportMDEventWorkspaceTest.h | 2 +- .../test/ImportMDHistoWorkspaceTest.h | 20 +- .../MDAlgorithms/test/IntegrateFluxTest.h | 2 +- .../MDAlgorithms/test/InvalidParameterTest.h | 2 +- Framework/MDAlgorithms/test/LoadDNSSCDTest.h | 2 +- Framework/MDAlgorithms/test/LoadSQW2Test.h | 6 +- Framework/MDAlgorithms/test/LoadSQWTest.h | 2 +- .../MDAlgorithms/test/MDEventWSWrapperTest.h | 6 +- .../test/MDResolutionConvolutionFactoryTest.h | 2 +- .../MDAlgorithms/test/MDTransfFactoryTest.h | 2 +- .../MDAlgorithms/test/MDTransfModQTest.h | 2 +- Framework/MDAlgorithms/test/MDTransfQ3DTest.h | 2 +- .../MDAlgorithms/test/MDWSDescriptionTest.h | 8 +- Framework/MDAlgorithms/test/MDWSTransfTest.h | 4 +- Framework/MDAlgorithms/test/MaskMDTest.h | 2 +- .../test/PreprocessDetectorsToMDTest.h | 2 +- .../test/ReflectometryTransformKiKfTest.h | 12 +- .../test/ReflectometryTransformPTest.h | 12 +- .../test/ReflectometryTransformQxQzTest.h | 12 +- Framework/MDAlgorithms/test/ReplicateMDTest.h | 4 +- .../test/TobyFitResolutionModelTest.h | 2 +- .../MDAlgorithms/test/WeightedMeanMDTest.h | 2 +- .../test/BroadcastWorkspaceTest.h | 2 +- .../MPIAlgorithms/test/GatherWorkspacesTest.h | 2 +- Framework/Muon/src/MuonAlgorithmHelper.cpp | 2 +- Framework/Muon/test/ApplyDeadTimeCorrTest.h | 6 +- .../test/ApplyMuonDetectorGroupPairingTest.h | 18 +- Framework/Muon/test/AsymmetryCalcTest.h | 4 +- Framework/Muon/test/CalMuonDeadTimeTest.h | 2 +- .../Muon/test/CalMuonDetectorPhasesTest.h | 4 +- .../Muon/test/CalculateMuonAsymmetryTest.h | 6 +- .../EstimateMuonAsymmetryFromCountsTest.h | 4 +- .../LoadAndApplyMuonDetectorGroupingTest.h | 7 +- Framework/Muon/test/MuonAlgorithmHelperTest.h | 8 +- .../Muon/test/MuonGroupingAsymmetryTest.h | 12 +- Framework/Muon/test/MuonGroupingCountsTest.h | 8 +- .../Muon/test/MuonPairingAsymmetryTest.h | 8 +- Framework/Muon/test/MuonPreProcessTest.h | 12 +- Framework/Muon/test/PhaseQuadMuonTest.h | 8 +- .../Muon/test/PlotAsymmetryByLogValueTest.h | 2 +- Framework/Parallel/test/EventLoaderTest.h | 2 +- .../src/Exports/DataProcessorAlgorithm.cpp | 14 +- .../mantid/api/src/Exports/IPeakFunction.cpp | 2 +- .../geometry/src/Exports/Instrument.cpp | 15 +- .../test/cpp/IFunction1DAdapterTest.h | 4 +- .../test/cpp/IPeakFunctionAdapterTest.h | 4 +- .../test/cpp/PySequenceToVectorTest.h | 2 +- .../cpp/PythonAlgorithmInstantiatorTest.h | 2 +- .../PythonInterface/test/cpp/ToPyListTest.h | 2 +- .../WorkspaceCreationHelperModule.cpp | 10 +- .../test/AbortRemoteJob2Test.h | 14 +- .../test/AbortRemoteJobTest.h | 14 +- .../RemoteAlgorithms/test/Authenticate2Test.h | 16 +- .../RemoteAlgorithms/test/AuthenticateTest.h | 16 +- .../test/DownloadRemoteFile2Test.h | 16 +- .../test/DownloadRemoteFileTest.h | 16 +- Framework/RemoteAlgorithms/test/Logout2Test.h | 6 +- .../test/QueryAllRemoteJobs2Test.h | 8 +- .../test/QueryAllRemoteJobsTest.h | 8 +- .../test/QueryRemoteFile2Test.h | 12 +- .../test/QueryRemoteFileTest.h | 12 +- .../test/QueryRemoteJob2Test.h | 12 +- .../test/QueryRemoteJobTest.h | 12 +- .../RemoteAlgorithms/test/SimpleJSONTest.h | 12 +- .../test/StartRemoteTransaction2Test.h | 12 +- .../test/StartRemoteTransactionTest.h | 12 +- .../test/StopRemoteTransaction2Test.h | 14 +- .../test/StopRemoteTransactionTest.h | 14 +- .../test/SubmitRemoteJob2Test.h | 40 +-- .../test/SubmitRemoteJobTest.h | 40 +-- .../test/UploadRemoteFile2Test.h | 24 +- .../test/UploadRemoteFileTest.h | 24 +- .../test/MantidWebServiceAPIJobManagerTest.h | 78 +++--- .../src/PoldiUtilities/PoldiBasicChopper.cpp | 2 +- Framework/SINQ/test/MillerIndicesIOTest.h | 6 +- Framework/SINQ/test/MillerIndicesTest.h | 6 +- Framework/SINQ/test/Poldi2DFunctionTest.h | 2 +- .../SINQ/test/PoldiAutoCorrelationCoreTest.h | 9 +- Framework/SINQ/test/PoldiConversionsTest.h | 19 +- Framework/SINQ/test/PoldiDGridTest.h | 2 +- .../SINQ/test/PoldiDeadWireDecoratorTest.h | 2 +- .../SINQ/test/PoldiDetectorDecoratorTest.h | 12 +- Framework/SINQ/test/PoldiFitPeaks1D2Test.h | 10 +- Framework/SINQ/test/PoldiFitPeaks2DTest.h | 30 +-- .../SINQ/test/PoldiIndexKnownCompoundsTest.h | 49 ++-- .../SINQ/test/PoldiInstrumentAdapterTest.h | 14 +- Framework/SINQ/test/PoldiPeakCollectionTest.h | 9 +- Framework/SINQ/test/PoldiPeakSearchTest.h | 6 +- Framework/SINQ/test/PoldiPeakTest.h | 4 +- .../test/PoldiResidualCorrelationCoreTest.h | 4 +- Framework/SINQ/test/PoldiSourceSpectrumTest.h | 6 +- .../test/PoldiSpectrumDomainFunctionTest.h | 8 +- .../test/PoldiSpectrumPawleyFunctionTest.h | 4 +- .../SINQ/test/PoldiTimeTransformerTest.h | 2 +- Framework/SINQ/test/PoldiTruncateDataTest.h | 22 +- Framework/SINQ/test/UncertainValueIOTest.h | 4 +- Framework/SINQ/test/UncertainValueTest.h | 10 +- Framework/Types/test/DateAndTimeTest.h | 9 +- .../src/DgsConvertToEnergyTransfer.cpp | 2 +- .../test/AlignAndFocusPowderTest.h | 2 +- .../test/IMuonAsymmetryCalculatorTest.h | 2 +- .../WorkflowAlgorithms/test/MuonProcessTest.h | 12 +- .../test/ProcessIndirectFitParametersTest.h | 8 +- .../WorkflowAlgorithms/test/StepScanTest.h | 4 +- qt/icons/test/IconTest.h | 4 +- .../test/CompositePeaksPresenterVsiTest.h | 4 +- .../test/EventNexusLoadingPresenterTest.h | 10 +- .../VatesAPI/test/FieldDataToMetadataTest.h | 4 +- .../test/MDEWEventNexusLoadingPresenterTest.h | 10 +- .../test/MDEWInMemoryLoadingPresenterTest.h | 14 +- .../test/MDHWInMemoryLoadingPresenterTest.h | 14 +- .../test/MDHWNexusLoadingPresenterTest.h | 10 +- .../VatesAPI/test/NullPeaksPresenterVsiTest.h | 8 +- .../VatesAPI/test/SQWLoadingPresenterTest.h | 10 +- .../VatesAPI/test/TimeToTimeStepTest.h | 4 +- .../test/VatesKnowledgeSerializerTest.h | 4 +- .../VatesAPI/test/ViewFrustumTest.h | 2 +- .../VatesAPI/test/vtkDataSetFactoryTest.h | 2 +- .../test/vtkDataSetToImplicitFunctionTest.h | 2 +- .../vtkDataSetToNonOrthogonalDataSetTest.h | 12 +- .../vtkDataSetToPeaksFilteredDataSetTest.h | 6 +- .../test/vtkDataSetToScaledDataSetTest.h | 2 +- .../test/vtkDataSetToWsLocationTest.h | 2 +- .../VatesAPI/test/vtkDataSetToWsNameTest.h | 2 +- .../VatesAPI/test/vtkMDHexFactoryTest.h | 10 +- .../test/vtkMDHistoHex4DFactoryTest.h | 6 +- .../VatesAPI/test/vtkMDHistoHexFactoryTest.h | 6 +- .../VatesAPI/test/vtkMDHistoLineFactoryTest.h | 6 +- .../VatesAPI/test/vtkMDHistoQuadFactoryTest.h | 6 +- .../VatesAPI/test/vtkMDLineFactoryTest.h | 4 +- .../VatesAPI/test/vtkMDQuadFactoryTest.h | 4 +- .../VatesAPI/test/vtkPeakMarkerFactoryTest.h | 4 +- .../test/vtkSplatterPlotFactoryTest.h | 4 +- qt/python/mantidqt/_common.sip | 6 +- .../mantidqtpython/mantidqtpython_def.sip | 46 ++-- .../EnggDiffFittingPresenter.cpp | 2 +- .../Indirect/test/ConvFitModelTest.h | 4 +- .../Indirect/test/IndirectFitDataTest.h | 4 +- .../test/IndirectFitOutputOptionsModelTest.h | 12 +- .../Indirect/test/IndirectFittingModelTest.h | 6 +- .../test/MuonAnalysisDataLoaderTest.h | 6 +- .../test/MuonAnalysisFitDataPresenterTest.h | 6 +- .../test/MuonAnalysisHelperTest.h | 2 +- .../test/MuonAnalysisResultTableCreatorTest.h | 8 +- qt/scientific_interfaces/test/RunMapTest.h | 4 +- .../common/src/MuonFitPropertyBrowser.cpp | 2 +- .../PostprocessingAlgorithmTest.h | 6 +- .../PreprocessingAlgorithmTest.h | 6 +- .../DataProcessorUI/ProcessingAlgorithmTest.h | 8 +- .../DataProcessorUI/QOneLevelTreeModelTest.h | 8 +- .../DataProcessorUI/QTwoLevelTreeModelTest.h | 14 +- qt/widgets/common/test/LogValueFinderTest.h | 8 +- .../common/test/ParseKeyValueStringTest.h | 20 +- qt/widgets/common/test/PlotAxisTest.h | 4 +- qt/widgets/common/test/Python/SipTest.h | 2 +- .../instrumentview/src/InstrumentWidget.cpp | 2 +- .../src/InstrumentWidgetMaskTab.cpp | 2 +- .../instrumentview/src/UnwrappedSurface.cpp | 2 +- qt/widgets/mplcpp/test/ArtistTest.h | 2 +- qt/widgets/mplcpp/test/AxesTest.h | 10 +- qt/widgets/mplcpp/test/ColormapTest.h | 2 +- qt/widgets/mplcpp/test/CyclerTest.h | 2 +- qt/widgets/mplcpp/test/FigureTest.h | 2 +- qt/widgets/mplcpp/test/Line2DTest.h | 2 +- qt/widgets/mplcpp/test/QBackendExtractTest.h | 2 +- qt/widgets/sliceviewer/test/PeakPaletteTest.h | 16 +- 601 files changed, 2529 insertions(+), 2410 deletions(-) diff --git a/Framework/API/test/AlgorithmFactoryTest.h b/Framework/API/test/AlgorithmFactoryTest.h index c1e9f80d2a3..a6c91898822 100644 --- a/Framework/API/test/AlgorithmFactoryTest.h +++ b/Framework/API/test/AlgorithmFactoryTest.h @@ -126,7 +126,7 @@ public: auto &algFactory = AlgorithmFactory::Instance(); TS_ASSERT_THROWS(algFactory.highestVersion("ToyAlgorithm"), - std::invalid_argument); + const std::invalid_argument &); algFactory.subscribe<ToyAlgorithm>(); TS_ASSERT_EQUALS(1, algFactory.highestVersion("ToyAlgorithm")); diff --git a/Framework/API/test/AlgorithmManagerTest.h b/Framework/API/test/AlgorithmManagerTest.h index 3fc570aff94..3504b241881 100644 --- a/Framework/API/test/AlgorithmManagerTest.h +++ b/Framework/API/test/AlgorithmManagerTest.h @@ -111,7 +111,7 @@ public: void testVersionFail() { const size_t nalgs = AlgorithmFactory::Instance().getKeys().size(); TS_ASSERT_THROWS(AlgorithmFactory::Instance().subscribe<AlgTestFail>(), - std::runtime_error); + const std::runtime_error &); // Size should be the same TS_ASSERT_EQUALS(AlgorithmFactory::Instance().getKeys().size(), nalgs); } @@ -124,9 +124,9 @@ public: void testInstance() { TS_ASSERT_THROWS_NOTHING(AlgorithmManager::Instance().create("AlgTest")); TS_ASSERT_THROWS(AlgorithmManager::Instance().create("AlgTest", 3), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(AlgorithmManager::Instance().create("aaaaaa"), - std::runtime_error); + const std::runtime_error &); } void testClear() { diff --git a/Framework/API/test/AlgorithmPropertyTest.h b/Framework/API/test/AlgorithmPropertyTest.h index 1c5f15d65e2..59a023747f8 100644 --- a/Framework/API/test/AlgorithmPropertyTest.h +++ b/Framework/API/test/AlgorithmPropertyTest.h @@ -142,7 +142,7 @@ public: IAlgorithm_sptr adder = Mantid::API::AlgorithmFactory::Instance().create("SimpleSum", 1); TS_ASSERT_THROWS(testAlg.setProperty("CalculateStep", adder), - std::invalid_argument); + const std::invalid_argument &); // Add the required property so now it should pass adder->initialize(); TS_ASSERT_THROWS_NOTHING(testAlg.setProperty("CalculateStep", adder)); diff --git a/Framework/API/test/AlgorithmTest.h b/Framework/API/test/AlgorithmTest.h index 4f1786545ad..f59d60b333b 100644 --- a/Framework/API/test/AlgorithmTest.h +++ b/Framework/API/test/AlgorithmTest.h @@ -293,7 +293,7 @@ public: void testExecute() { ToyAlgorithm myAlg; - TS_ASSERT_THROWS(myAlg.execute(), std::runtime_error); + TS_ASSERT_THROWS(myAlg.execute(), const std::runtime_error &); TS_ASSERT(!myAlg.isExecuted()); TS_ASSERT_THROWS_NOTHING(myAlg.initialize()); TS_ASSERT_THROWS_NOTHING(myAlg.execute()); @@ -303,7 +303,7 @@ public: void testSetPropertyValue() { TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("prop1", "val")) TS_ASSERT_THROWS(alg.setPropertyValue("prop3", "1"), - Exception::NotFoundError) + const Exception::NotFoundError &) } void testExistsProperty() { @@ -315,7 +315,8 @@ public: std::string value; TS_ASSERT_THROWS_NOTHING(value = alg.getPropertyValue("prop2")) TS_ASSERT(!value.compare("1")) - TS_ASSERT_THROWS(alg.getPropertyValue("ghjkgh"), Exception::NotFoundError) + TS_ASSERT_THROWS(alg.getPropertyValue("ghjkgh"), + const Exception::NotFoundError &) } void testGetProperties() { @@ -373,7 +374,7 @@ public: void test_From_String_With_Invalid_Input_Throws() { const std::string input = "()"; - TS_ASSERT_THROWS(Algorithm::fromString(input), std::runtime_error); + TS_ASSERT_THROWS(Algorithm::fromString(input), const std::runtime_error &); } void test_Construction_Via_Valid_String_With_No_Properties() { @@ -988,11 +989,11 @@ public: TS_ASSERT_THROWS( indexAlg.getWorkspaceAndIndices<MatrixWorkspace>("InputWorkspace2"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( (indexAlg.setWorkspaceInputProperties<MatrixWorkspace, std::string>( "InputWorkspace2", "wksp", IndexType::SpectrumNum, "1:5")), - std::runtime_error); + const std::runtime_error &); } void testIndexingAlgorithm_failExistingIndexProperty() { @@ -1001,7 +1002,7 @@ public: TS_ASSERT_THROWS(indexAlg.declareProperty( make_unique<WorkspaceProperty<MatrixWorkspace>>( "InputWorkspace", "", Direction::Input)), - std::runtime_error); + const std::runtime_error &); } private: diff --git a/Framework/API/test/AnalysisDataServiceTest.h b/Framework/API/test/AnalysisDataServiceTest.h index ab64f981d67..485e3f7520f 100644 --- a/Framework/API/test/AnalysisDataServiceTest.h +++ b/Framework/API/test/AnalysisDataServiceTest.h @@ -79,7 +79,7 @@ public: TS_ASSERT_THROWS_NOTHING(ads.retrieve("Z")); ads.remove("Z"); - TS_ASSERT_THROWS(ads.retrieve("z"), Exception::NotFoundError); + TS_ASSERT_THROWS(ads.retrieve("z"), const Exception::NotFoundError &); } void test_retrieveWorkspaces_with_empty_list_returns_empty_list() { @@ -88,16 +88,17 @@ public: } void test_retrieveWorkspaces_with_all_missing_items_throws_exception() { - TS_ASSERT_THROWS(ads.retrieveWorkspaces({"a"}), Exception::NotFoundError); + TS_ASSERT_THROWS(ads.retrieveWorkspaces({"a"}), + const Exception::NotFoundError &); TS_ASSERT_THROWS(ads.retrieveWorkspaces({"a", "b"}), - Exception::NotFoundError); + const Exception::NotFoundError &); } void test_retrieveWorkspaces_with_some_missing_items_throws_exception() { const std::string name("test_some_missing_items"); addToADS(name); TS_ASSERT_THROWS(ads.retrieveWorkspaces({"a", "b"}), - Exception::NotFoundError); + const Exception::NotFoundError &); ads.remove(name); } @@ -148,7 +149,7 @@ public: const std::string name = "SameName"; TS_ASSERT_THROWS_NOTHING(addToADS(name)); // Adding again will throw - TS_ASSERT_THROWS(addToADS(name), std::runtime_error); + TS_ASSERT_THROWS(addToADS(name), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(ads.remove(name)); } @@ -173,7 +174,7 @@ public: TS_ASSERT_EQUALS(ads.doesExist(name), true); std::string banned = "Also.Contains.Illegal"; // This should not be allowed now. - TS_ASSERT_THROWS(addToADS(banned), std::invalid_argument); + TS_ASSERT_THROWS(addToADS(banned), const std::invalid_argument &); // Clear up ads.setIllegalCharacterList(""); } @@ -182,7 +183,7 @@ public: test_AddOrReplace_Does_Not_Throw_When_Adding_Object_That_Has_A_Name_That_Already_Exists() { const std::string name("MySpaceAddOrReplace"); TS_ASSERT_THROWS_NOTHING(addOrReplaceToADS(name)); - TS_ASSERT_THROWS(addToADS(name), std::runtime_error); + TS_ASSERT_THROWS(addToADS(name), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(addOrReplaceToADS(name)); TS_ASSERT_THROWS_NOTHING(ads.remove(name)); } @@ -191,7 +192,7 @@ public: const std::string name("MySpace"); addToADS(name); TS_ASSERT_THROWS_NOTHING(ads.remove(name)); - TS_ASSERT_THROWS(ads.retrieve(name), std::runtime_error); + TS_ASSERT_THROWS(ads.retrieve(name), const std::runtime_error &); // Remove should not throw but give a warning in the log file, changed by // LCC 05/2008 TS_ASSERT_THROWS_NOTHING(ads.remove("ttttt")); @@ -328,7 +329,7 @@ public: group->addWorkspace(ws2); // ADS must have 2 workspaces TS_ASSERT_EQUALS(ads.size(), 2); - TS_ASSERT_THROWS(ads.add("Group", group), std::runtime_error); + TS_ASSERT_THROWS(ads.add("Group", group), const std::runtime_error &); // there must be 4 workspaces in the ADS TS_ASSERT_EQUALS(ads.size(), 4); TS_ASSERT(ads.doesExist("Group")); @@ -400,9 +401,10 @@ public: TS_ASSERT_EQUALS(ads.size(), 4); // name doesn't exist - TS_ASSERT_THROWS(ads.deepRemoveGroup("abc"), std::runtime_error); + TS_ASSERT_THROWS(ads.deepRemoveGroup("abc"), const std::runtime_error &); // workspace isn't a group - TS_ASSERT_THROWS(ads.deepRemoveGroup("group_1"), std::runtime_error); + TS_ASSERT_THROWS(ads.deepRemoveGroup("group_1"), + const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(ads.deepRemoveGroup("group")); TS_ASSERT_EQUALS(ads.size(), 1); @@ -423,11 +425,11 @@ public: TS_ASSERT_EQUALS(group->size(), 1); TS_ASSERT_THROWS(ads.removeFromGroup("group", "noworkspace"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ads.removeFromGroup("nogroup", "noworkspace"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ads.removeFromGroup("nogroup", "group_1"), - std::runtime_error); + const std::runtime_error &); ads.clear(); } @@ -493,9 +495,10 @@ public: auto nullWS = MockWorkspace_sptr(); // Shouldn't be able to add null pointers - TS_ASSERT_THROWS(ads.add("null_workspace", nullWS), std::runtime_error); + TS_ASSERT_THROWS(ads.add("null_workspace", nullWS), + const std::runtime_error &); TS_ASSERT_THROWS(ads.addOrReplace("null_workspace", nullWS), - std::runtime_error); + const std::runtime_error &); TS_ASSERT(!ads.doesExist("null_workspace")); } @@ -519,10 +522,10 @@ private: << " is not allowed but ADS did not throw."; if (replace) { TSM_ASSERT_THROWS(errorMsg.str(), addToADS(name.str()), - std::invalid_argument); + const std::invalid_argument &); } else { TSM_ASSERT_THROWS(errorMsg.str(), addOrReplaceToADS(name.str()), - std::invalid_argument); + const std::invalid_argument &); } bool stored = ads.doesExist(name.str()); TS_ASSERT_EQUALS(stored, false); diff --git a/Framework/API/test/BinEdgeAxisTest.h b/Framework/API/test/BinEdgeAxisTest.h index 7ff1cfe8157..261954ac305 100644 --- a/Framework/API/test/BinEdgeAxisTest.h +++ b/Framework/API/test/BinEdgeAxisTest.h @@ -77,8 +77,8 @@ public: ax1.setValue(i, static_cast<double>(i + 1)); } - TS_ASSERT_THROWS(ax1.indexOfValue(0.9), std::out_of_range); // start - TS_ASSERT_THROWS(ax1.indexOfValue(10.1), std::out_of_range); // end + TS_ASSERT_THROWS(ax1.indexOfValue(0.9), const std::out_of_range &); // start + TS_ASSERT_THROWS(ax1.indexOfValue(10.1), const std::out_of_range &); // end } }; diff --git a/Framework/API/test/BoxControllerTest.h b/Framework/API/test/BoxControllerTest.h index 1d4bd01fd3d..6f8245e75bb 100644 --- a/Framework/API/test/BoxControllerTest.h +++ b/Framework/API/test/BoxControllerTest.h @@ -122,7 +122,7 @@ public: void test_setSplitTopIntoThrowsForWrongDimension() { BoxController sc(1); TSM_ASSERT_THROWS("Should throw for setting a wrong dimension", - sc.setSplitTopInto(1, 10), std::invalid_argument); + sc.setSplitTopInto(1, 10), const std::invalid_argument &); } void doTest_numBoxes(BoxController &bc, size_t expectedNumEntries) { diff --git a/Framework/API/test/CompositeFunctionTest.h b/Framework/API/test/CompositeFunctionTest.h index 17febbfef1c..e3e41046dfe 100644 --- a/Framework/API/test/CompositeFunctionTest.h +++ b/Framework/API/test/CompositeFunctionTest.h @@ -528,12 +528,12 @@ public: mfun->fix(10); // g2->fix(1); // This doesn't work - TS_ASSERT_THROWS(mfun->setActiveParameter(0, 0), std::runtime_error); - TS_ASSERT_THROWS(mfun->setActiveParameter(1, 0), std::runtime_error); - TS_ASSERT_THROWS(mfun->setActiveParameter(4, 0), std::runtime_error); - TS_ASSERT_THROWS(mfun->setActiveParameter(6, 0), std::runtime_error); - TS_ASSERT_THROWS(mfun->setActiveParameter(7, 0), std::runtime_error); - TS_ASSERT_THROWS(mfun->setActiveParameter(10, 0), std::runtime_error); + TS_ASSERT_THROWS(mfun->setActiveParameter(0, 0), const std::runtime_error &); + TS_ASSERT_THROWS(mfun->setActiveParameter(1, 0), const std::runtime_error &); + TS_ASSERT_THROWS(mfun->setActiveParameter(4, 0), const std::runtime_error &); + TS_ASSERT_THROWS(mfun->setActiveParameter(6, 0), const std::runtime_error &); + TS_ASSERT_THROWS(mfun->setActiveParameter(7, 0), const std::runtime_error &); + TS_ASSERT_THROWS(mfun->setActiveParameter(10, 0), const std::runtime_error &); mfun->setActiveParameter(2, 100); mfun->setActiveParameter(3, 101); diff --git a/Framework/API/test/DetectorInfoTest.h b/Framework/API/test/DetectorInfoTest.h index 986817e8664..3ad8b9ea178 100644 --- a/Framework/API/test/DetectorInfoTest.h +++ b/Framework/API/test/DetectorInfoTest.h @@ -72,7 +72,7 @@ public: void test_l1_no_instrument() { TS_ASSERT_THROWS(m_workspaceNoInstrument.detectorInfo().l1(), - std::runtime_error); + const std::runtime_error &); } void test_l1_no_instrument_call_once_regression() { @@ -82,9 +82,9 @@ public: // call to `l1` can be repeated. If the bug is reintroduced this test will // not fail but FREEZE. TS_ASSERT_THROWS(m_workspaceNoInstrument.detectorInfo().l1(), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(m_workspaceNoInstrument.detectorInfo().l1(), - std::runtime_error); + const std::runtime_error &); } void test_isMonitor() { @@ -141,8 +141,8 @@ public: TS_ASSERT_DELTA(detectorInfo.twoTheta(1), 0.0, 1e-6); TS_ASSERT_DELTA(detectorInfo.twoTheta(2), 0.0199973, 1e-6); // Monitors - TS_ASSERT_THROWS(detectorInfo.twoTheta(3), std::logic_error); - TS_ASSERT_THROWS(detectorInfo.twoTheta(4), std::logic_error); + TS_ASSERT_THROWS(detectorInfo.twoTheta(3), const std::logic_error &); + TS_ASSERT_THROWS(detectorInfo.twoTheta(4), const std::logic_error &); } // Legacy test via the workspace method detectorTwoTheta(), which might be @@ -160,8 +160,8 @@ public: TS_ASSERT_DELTA(detectorInfo.signedTwoTheta(1), 0.0, 1e-6); TS_ASSERT_DELTA(detectorInfo.signedTwoTheta(2), 0.0199973, 1e-6); // Monitors - TS_ASSERT_THROWS(detectorInfo.signedTwoTheta(3), std::logic_error); - TS_ASSERT_THROWS(detectorInfo.signedTwoTheta(4), std::logic_error); + TS_ASSERT_THROWS(detectorInfo.signedTwoTheta(3), const std::logic_error &); + TS_ASSERT_THROWS(detectorInfo.signedTwoTheta(4), const std::logic_error &); } void test_position() { @@ -432,7 +432,7 @@ public: auto ws1 = makeWorkspace(1); auto ws2 = makeWorkspace(2); TS_ASSERT_THROWS(ws2->mutableDetectorInfo() = ws1->detectorInfo(), - std::runtime_error); + const std::runtime_error &); } private: diff --git a/Framework/API/test/ExperimentInfoTest.h b/Framework/API/test/ExperimentInfoTest.h index 850df22c71d..91464c748eb 100644 --- a/Framework/API/test/ExperimentInfoTest.h +++ b/Framework/API/test/ExperimentInfoTest.h @@ -113,13 +113,14 @@ public: void test_Setting_A_New_Source_With_NULL_Ptr_Throws() { ExperimentInfo ws; - TS_ASSERT_THROWS(ws.setModeratorModel(nullptr), std::invalid_argument); + TS_ASSERT_THROWS(ws.setModeratorModel(nullptr), + const std::invalid_argument &); } void test_Retrieving_Source_Properties_Before_Set_Throws() { ExperimentInfo ws; - TS_ASSERT_THROWS(ws.moderatorModel(), std::runtime_error); + TS_ASSERT_THROWS(ws.moderatorModel(), const std::runtime_error &); } void test_Setting_New_Source_Description_With_Valid_Object_Does_Not_Throw() { @@ -137,7 +138,8 @@ public: void test_Setting_A_New_Chopper_With_NULL_Ptr_Throws() { ExperimentInfo_sptr ws = createTestInfoWithChopperPoints(1); - TS_ASSERT_THROWS(ws->setChopperModel(nullptr), std::invalid_argument); + TS_ASSERT_THROWS(ws->setChopperModel(nullptr), + const std::invalid_argument &); } void test_Setting_A_New_Chopper_To_Point_Lower_Point_Succeeds() { @@ -151,13 +153,13 @@ public: ExperimentInfo_sptr ws = createTestInfoWithChopperPoints(1); TS_ASSERT_THROWS_NOTHING(ws->setChopperModel(new FakeChopper)); - TS_ASSERT_THROWS(ws->chopperModel(1), std::invalid_argument); + TS_ASSERT_THROWS(ws->chopperModel(1), const std::invalid_argument &); } void test_Getting_Chopper_At_Index_Greater_Than_Descriptions_Added_Throws() { ExperimentInfo_sptr ws = createTestInfoWithChopperPoints(1); - TS_ASSERT_THROWS(ws->chopperModel(2), std::invalid_argument); + TS_ASSERT_THROWS(ws->chopperModel(2), const std::invalid_argument &); } void test_GetSetSample() { @@ -175,7 +177,7 @@ public: void test_GetLog_Throws_If_No_Log_Or_Instrument_Parameter_Exists() { ExperimentInfo expt; - TS_ASSERT_THROWS(expt.getLog("__NOTALOG__"), std::invalid_argument); + TS_ASSERT_THROWS(expt.getLog("__NOTALOG__"), const std::invalid_argument &); } void @@ -186,7 +188,7 @@ public: addInstrumentWithParameter(expt, instPar, actualLogName); TS_ASSERT_THROWS(expt.getLog(instPar), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void @@ -222,7 +224,7 @@ public: ExperimentInfo expt; TS_ASSERT_THROWS(expt.getLogAsSingleValue("__NOTALOG__"), - std::invalid_argument); + const std::invalid_argument &); } void @@ -233,7 +235,7 @@ public: addInstrumentWithParameter(expt, instPar, actualLogName); TS_ASSERT_THROWS(expt.getLogAsSingleValue(instPar), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void @@ -373,7 +375,7 @@ public: ExperimentInfo_sptr exptInfo = createTestInfoWithDirectEModeLog(); TS_ASSERT_THROWS(exptInfo->getEFixed(1), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void test_correct_efixed_value_is_returned_for_direct_run() { @@ -388,7 +390,7 @@ public: ExperimentInfo_sptr exptInfo(new ExperimentInfo); Instrument_sptr inst = addInstrumentWithIndirectEmodeParameter(exptInfo); - TS_ASSERT_THROWS(exptInfo->getEFixed(), std::runtime_error); + TS_ASSERT_THROWS(exptInfo->getEFixed(), const std::runtime_error &); } void @@ -397,7 +399,7 @@ public: addInstrumentWithIndirectEmodeParameter(exptInfo); IDetector_const_sptr det = exptInfo->getInstrument()->getDetector(3); - TS_ASSERT_THROWS(exptInfo->getEFixed(det), std::runtime_error); + TS_ASSERT_THROWS(exptInfo->getEFixed(det), const std::runtime_error &); } void @@ -466,7 +468,7 @@ public: void test_Getting_Group_For_Unknown_ID_Throws() { ExperimentInfo expt; - TS_ASSERT_THROWS(expt.groupOfDetectorID(1), std::out_of_range); + TS_ASSERT_THROWS(expt.groupOfDetectorID(1), const std::out_of_range &); } void diff --git a/Framework/API/test/ExpressionTest.h b/Framework/API/test/ExpressionTest.h index 76bc723be3b..802ffd48bce 100644 --- a/Framework/API/test/ExpressionTest.h +++ b/Framework/API/test/ExpressionTest.h @@ -50,8 +50,8 @@ public: void testMismatchedBrackets() { Expression expr; - TS_ASSERT_THROWS(expr.parse("b*(c+a"), std::runtime_error); - TS_ASSERT_THROWS(expr.parse("b*c+a)"), std::runtime_error); + TS_ASSERT_THROWS(expr.parse("b*(c+a"), const std::runtime_error &); + TS_ASSERT_THROWS(expr.parse("b*c+a)"), const std::runtime_error &); } void testFunctions() { @@ -247,10 +247,10 @@ public: TS_ASSERT_EQUALS(e12[1].name(), "%%"); Expression e13(bin_ops1, un_ops1); - TS_ASSERT_THROWS(e13.parse("x==%%"), std::runtime_error); + TS_ASSERT_THROWS(e13.parse("x==%%"), const std::runtime_error &); Expression e14(bin_ops1, un_ops1); - TS_ASSERT_THROWS(e14.parse("x==%% "), std::runtime_error); + TS_ASSERT_THROWS(e14.parse("x==%% "), const std::runtime_error &); std::vector<std::string> bin_ops2{"-", "--"}; std::unordered_set<std::string> un_ops2{"-", "--"}; @@ -324,7 +324,7 @@ public: TS_ASSERT_EQUALS(expression[0][0][0].name(), "1"); Expression e1; - TS_ASSERT_THROWS(e1.parse("---1"), std::runtime_error); + TS_ASSERT_THROWS(e1.parse("---1"), const std::runtime_error &); } void testRemoveBrackets() { @@ -402,15 +402,15 @@ public: void testEndOnOperator() { { Expression expression; - TS_ASSERT_THROWS(expression.parse("x+y+z + "), std::runtime_error); + TS_ASSERT_THROWS(expression.parse("x+y+z + "), const std::runtime_error &); } { Expression expression; - TS_ASSERT_THROWS(expression.parse("x*z-"), std::runtime_error); + TS_ASSERT_THROWS(expression.parse("x*z-"), const std::runtime_error &); } { Expression expression; - TS_ASSERT_THROWS(expression.parse("x*z="), std::runtime_error); + TS_ASSERT_THROWS(expression.parse("x*z="), const std::runtime_error &); } { Expression expression; diff --git a/Framework/API/test/FermiChopperModelTest.h b/Framework/API/test/FermiChopperModelTest.h index 8c8c41502eb..7e286708244 100644 --- a/Framework/API/test/FermiChopperModelTest.h +++ b/Framework/API/test/FermiChopperModelTest.h @@ -22,7 +22,7 @@ public: void test_Default_Object_Throws_When_Computing_Pulse_Variance() { using namespace Mantid::API; FermiChopperModel chopper; - TS_ASSERT_THROWS(chopper.pulseTimeVariance(), std::invalid_argument); + TS_ASSERT_THROWS(chopper.pulseTimeVariance(), const std::invalid_argument &); } void test_Getters_Produce_Expected_Values_When_Set_By_Settings() { @@ -67,7 +67,7 @@ public: chopper->setAngularVelocityInHz(350); chopper->setChopperRadius(155.0 / 1000.); - TS_ASSERT_THROWS(chopper->pulseTimeVariance(), std::invalid_argument); + TS_ASSERT_THROWS(chopper->pulseTimeVariance(), const std::invalid_argument &); } void @@ -76,9 +76,9 @@ public: FermiChopperModel_sptr chopper = createTestChopperBySetters(); TS_ASSERT_THROWS(chopper->sampleTimeDistribution(-0.01), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(chopper->sampleTimeDistribution(1.01), - std::invalid_argument); + const std::invalid_argument &); } void diff --git a/Framework/API/test/FileBackedExperimentInfoTest.h b/Framework/API/test/FileBackedExperimentInfoTest.h index 469f2a71397..28f6643ae61 100644 --- a/Framework/API/test/FileBackedExperimentInfoTest.h +++ b/Framework/API/test/FileBackedExperimentInfoTest.h @@ -167,7 +167,7 @@ public: void test_getEFixed() { auto fileBacked = createTestObject(); - TS_ASSERT_THROWS(fileBacked->getEFixed(10100), std::runtime_error); + TS_ASSERT_THROWS(fileBacked->getEFixed(10100), const std::runtime_error &); } void test_setEFixed() { @@ -183,7 +183,7 @@ public: // Create the file backed experiment info, shouldn't be loaded yet FileBackedExperimentInfo fileBacked(m_filename, "/not/right/path"); - TS_ASSERT_THROWS(fileBacked.toString(), std::runtime_error); + TS_ASSERT_THROWS(fileBacked.toString(), const std::runtime_error &); } private: diff --git a/Framework/API/test/FileFinderTest.h b/Framework/API/test/FileFinderTest.h index 04df991f430..b94cf7e80ef 100644 --- a/Framework/API/test/FileFinderTest.h +++ b/Framework/API/test/FileFinderTest.h @@ -175,10 +175,10 @@ public: TS_ASSERT_THROWS( fName = FileFinder::Instance().makeFileName("ABCD", instrument), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS( fName = FileFinder::Instance().makeFileName("123456", instrument), - std::invalid_argument); + const std::invalid_argument &); fName = FileFinder::Instance().makeFileName("0", instrument); TS_ASSERT_EQUALS(fName, "HRP00000"); @@ -310,19 +310,19 @@ public: std::vector<std::string> files; TS_ASSERT_THROWS(files = FileFinder::Instance().findRuns("MUSR15189-n15193"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(files = FileFinder::Instance().findRuns("MUSR15189n-15193"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(files = FileFinder::Instance().findRuns("MUSR15189-15193n"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(files = FileFinder::Instance().findRuns("MUSR15189-151n93"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(files = FileFinder::Instance().findRuns("MUSR15n189-151n93"), - Exception::NotFoundError); + const Exception::NotFoundError &); TS_ASSERT_THROWS_NOTHING( files = FileFinder::Instance().findRuns("MUSR15189-15193")); TS_ASSERT_EQUALS(files.size(), 5); @@ -622,7 +622,7 @@ public: std::string accidentalEndOfRange = "99999"; range << startOfRange << "-" << accidentalEndOfRange; TS_ASSERT_THROWS(files = fileFinder.findRuns(range.str().c_str()), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); fileFinder.setCaseSensitive(startingCaseOption); } diff --git a/Framework/API/test/FrameworkManagerTest.h b/Framework/API/test/FrameworkManagerTest.h index 2ed4b3cca01..a76b34f7dc7 100644 --- a/Framework/API/test/FrameworkManagerTest.h +++ b/Framework/API/test/FrameworkManagerTest.h @@ -71,9 +71,9 @@ public: FrameworkManager::Instance().createAlgorithm("ToyAlgorithm2")) TS_ASSERT_THROWS( FrameworkManager::Instance().createAlgorithm("ToyAlgorithm2", "", 3), - std::runtime_error) + const std::runtime_error &) TS_ASSERT_THROWS(FrameworkManager::Instance().createAlgorithm("aaaaaa"), - std::runtime_error) + const std::runtime_error &) } void testcreateAlgorithmWithProps() { @@ -97,7 +97,7 @@ public: void testGetWorkspace() { TS_ASSERT_THROWS(FrameworkManager::Instance().getWorkspace("wrongname"), - std::runtime_error) + const std::runtime_error &) } }; diff --git a/Framework/API/test/FunctionAttributeTest.h b/Framework/API/test/FunctionAttributeTest.h index 40f9358d6cc..5b47668af33 100644 --- a/Framework/API/test/FunctionAttributeTest.h +++ b/Framework/API/test/FunctionAttributeTest.h @@ -54,7 +54,7 @@ public: att.setDouble(1.1); TS_ASSERT_EQUALS(att.asDouble(), 1.1); - TS_ASSERT_THROWS(att.setInt(100), std::runtime_error); + TS_ASSERT_THROWS(att.setInt(100), const std::runtime_error &); att.fromString("0.5"); TS_ASSERT_EQUALS(att.asDouble(), 0.5); diff --git a/Framework/API/test/FunctionDomainGeneralTest.h b/Framework/API/test/FunctionDomainGeneralTest.h index 340ce141754..f3178a80e9a 100644 --- a/Framework/API/test/FunctionDomainGeneralTest.h +++ b/Framework/API/test/FunctionDomainGeneralTest.h @@ -88,7 +88,7 @@ public: TS_ASSERT_EQUALS(domain.size(), 5); TS_ASSERT_EQUALS(domain.columnCount(), 3); Column_sptr column4(new TestColumn<int>(2)); - TS_ASSERT_THROWS(domain.addColumn(column4), std::runtime_error); + TS_ASSERT_THROWS(domain.addColumn(column4), const std::runtime_error &); } void test_column_values() { diff --git a/Framework/API/test/FunctionParameterDecoratorTest.h b/Framework/API/test/FunctionParameterDecoratorTest.h index 0a5aee63ca0..4c831f6f1b5 100644 --- a/Framework/API/test/FunctionParameterDecoratorTest.h +++ b/Framework/API/test/FunctionParameterDecoratorTest.h @@ -23,8 +23,8 @@ using namespace Mantid::API; using namespace Mantid::Kernel; -using ::testing::Mock; using ::testing::_; +using ::testing::Mock; class FunctionParameterDecoratorTest; @@ -137,13 +137,13 @@ public: void testSetDecoratedFunctionInvalidName() { TestableFunctionParameterDecorator fn; TS_ASSERT_THROWS(fn.setDecoratedFunction("INVALIDFUNCTION"), - Exception::NotFoundError); + const Exception::NotFoundError &); TS_ASSERT(!fn.getDecoratedFunction()); } void testThrowIfNoFunctionSet() { TestableFunctionParameterDecorator fn; - TS_ASSERT_THROWS(fn.throwIfNoFunctionSet(), std::runtime_error); + TS_ASSERT_THROWS(fn.throwIfNoFunctionSet(), const std::runtime_error &); fn.setDecoratedFunction("FunctionWithParameters"); TS_ASSERT_THROWS_NOTHING(fn.throwIfNoFunctionSet()); } @@ -172,10 +172,13 @@ public: void testGetSetParameter() { TestableFunctionParameterDecorator invalidFn; - TS_ASSERT_THROWS(invalidFn.setParameter(0, 2.0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.getParameter(0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.setParameter("Height", 2.0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.getParameter("Height"), std::runtime_error); + TS_ASSERT_THROWS(invalidFn.setParameter(0, 2.0), + const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.getParameter(0), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.setParameter("Height", 2.0), + const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.getParameter("Height"), + const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); @@ -185,18 +188,19 @@ public: IFunction_sptr decoratedFunction = fn->getDecoratedFunction(); TS_ASSERT_EQUALS(fn->getParameter(0), decoratedFunction->getParameter(0)); TS_ASSERT_EQUALS(fn->getParameter(0), 2.0); - TS_ASSERT_THROWS(fn->getParameter(10), std::out_of_range); + TS_ASSERT_THROWS(fn->getParameter(10), const std::out_of_range &); TS_ASSERT_THROWS_NOTHING(fn->setParameter("Height", 4.0)); TS_ASSERT_EQUALS(fn->getParameter("Height"), decoratedFunction->getParameter("Height")); TS_ASSERT_EQUALS(fn->getParameter("Height"), 4.0); - TS_ASSERT_THROWS(fn->getParameter("DoesNotExist"), std::invalid_argument); + TS_ASSERT_THROWS(fn->getParameter("DoesNotExist"), + const std::invalid_argument &); } void testExplicitelySet() { TestableFunctionParameterDecorator invalidFn; - TS_ASSERT_THROWS(invalidFn.isExplicitlySet(0), std::runtime_error); + TS_ASSERT_THROWS(invalidFn.isExplicitlySet(0), const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); @@ -213,8 +217,8 @@ public: void testGetSetError() { TestableFunctionParameterDecorator invalidFn; - TS_ASSERT_THROWS(invalidFn.getError(0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.setError(0, 2.0), std::runtime_error); + TS_ASSERT_THROWS(invalidFn.getError(0), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.setError(0, 2.0), const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); @@ -229,9 +233,9 @@ public: void testFixUnfixIsFixed() { TestableFunctionParameterDecorator invalidFn; - TS_ASSERT_THROWS(invalidFn.isFixed(0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.fix(0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.unfix(0), std::runtime_error); + TS_ASSERT_THROWS(invalidFn.isFixed(0), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.fix(0), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.unfix(0), const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); @@ -287,11 +291,11 @@ public: void testTies() { TestableFunctionParameterDecorator invalidFn; - TS_ASSERT_THROWS(invalidFn.tie("Name", "a=b"), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.applyTies(), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.clearTies(), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.removeTie(0), std::runtime_error); - TS_ASSERT_THROWS(invalidFn.getTie(0), std::runtime_error); + TS_ASSERT_THROWS(invalidFn.tie("Name", "a=b"), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.applyTies(), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.clearTies(), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.removeTie(0), const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.getTie(0), const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); @@ -367,8 +371,9 @@ public: void testSetParameterDescription() { TestableFunctionParameterDecorator invalidFn; TS_ASSERT_THROWS(invalidFn.setParameterDescription(0, "None"), - std::runtime_error); - TS_ASSERT_THROWS(invalidFn.parameterDescription(0), std::runtime_error); + const std::runtime_error &); + TS_ASSERT_THROWS(invalidFn.parameterDescription(0), + const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); @@ -379,12 +384,12 @@ public: TS_ASSERT_EQUALS(fn->parameterDescription(0), decoratedFunction->parameterDescription(0)); TS_ASSERT_EQUALS(fn->parameterDescription(0), "None"); - TS_ASSERT_THROWS(fn->parameterDescription(10), std::out_of_range); + TS_ASSERT_THROWS(fn->parameterDescription(10), const std::out_of_range &); TS_ASSERT_THROWS_NOTHING( fn->setParameterDescription("Height", "Something")); TS_ASSERT_THROWS(fn->setParameterDescription("DoesNotExist", "Something"), - std::invalid_argument); + const std::invalid_argument &); } void testBeforeDecoratedFunctionSetIsCalled() { @@ -423,7 +428,7 @@ public: Workspace_const_sptr ws = boost::make_shared<const WorkspaceGroup>(); TestableFunctionParameterDecorator invalidFn; - TS_ASSERT_THROWS(invalidFn.setWorkspace(ws), std::runtime_error); + TS_ASSERT_THROWS(invalidFn.setWorkspace(ws), const std::runtime_error &); FunctionParameterDecorator_sptr fn = getFunctionParameterDecoratorGaussian(); diff --git a/Framework/API/test/FunctionTest.h b/Framework/API/test/FunctionTest.h index 9cedd97efea..fdb172aeb83 100644 --- a/Framework/API/test/FunctionTest.h +++ b/Framework/API/test/FunctionTest.h @@ -188,10 +188,10 @@ public: TS_ASSERT(!f.isFixed(2)); TS_ASSERT(f.isFixed(3)); - TS_ASSERT_THROWS(f.activeParameter(1), std::runtime_error); - TS_ASSERT_THROWS(f.activeParameter(3), std::runtime_error); - TS_ASSERT_THROWS(f.setActiveParameter(1, 0), std::runtime_error); - TS_ASSERT_THROWS(f.setActiveParameter(3, 0), std::runtime_error); + TS_ASSERT_THROWS(f.activeParameter(1), const std::runtime_error &); + TS_ASSERT_THROWS(f.activeParameter(3), const std::runtime_error &); + TS_ASSERT_THROWS(f.setActiveParameter(1, 0), const std::runtime_error &); + TS_ASSERT_THROWS(f.setActiveParameter(3, 0), const std::runtime_error &); } void testUnfix() { diff --git a/Framework/API/test/FunctionValuesTest.h b/Framework/API/test/FunctionValuesTest.h index ba55f11917c..efb8f8ec64e 100644 --- a/Framework/API/test/FunctionValuesTest.h +++ b/Framework/API/test/FunctionValuesTest.h @@ -64,24 +64,24 @@ public: FunctionDomain1DVector domain3(x3); FunctionValues values3(domain3); - TS_ASSERT_THROWS(values3 += values1, std::runtime_error); + TS_ASSERT_THROWS(values3 += values1, const std::runtime_error &); } void testFitData() { FunctionDomain1DVector domain(x); FunctionValues values1(domain); - TS_ASSERT_THROWS(values1.getFitData(0), std::runtime_error); - TS_ASSERT_THROWS(values1.getFitWeight(0), std::runtime_error); + TS_ASSERT_THROWS(values1.getFitData(0), const std::runtime_error &); + TS_ASSERT_THROWS(values1.getFitWeight(0), const std::runtime_error &); values1.setFitData(5, 10.1); for (size_t i = 0; i < values1.size(); ++i) { TS_ASSERT_EQUALS(values1.getFitData(i), i == 5 ? 10.1 : 0.0); - TS_ASSERT_THROWS(values1.getFitWeight(i), std::runtime_error); + TS_ASSERT_THROWS(values1.getFitWeight(i), const std::runtime_error &); } std::vector<double> y(9); - TS_ASSERT_THROWS(values1.setFitData(y), std::invalid_argument); + TS_ASSERT_THROWS(values1.setFitData(y), const std::invalid_argument &); y.resize(10); for (size_t i = 0; i < y.size(); ++i) { @@ -101,11 +101,11 @@ public: values1.setFitWeight(5, 10.1); for (size_t i = 0; i < values1.size(); ++i) { TS_ASSERT_EQUALS(values1.getFitWeight(i), i == 5 ? 10.1 : 0.0); - TS_ASSERT_THROWS(values1.getFitData(i), std::runtime_error); + TS_ASSERT_THROWS(values1.getFitData(i), const std::runtime_error &); } std::vector<double> y(9); - TS_ASSERT_THROWS(values1.setFitWeights(y), std::invalid_argument); + TS_ASSERT_THROWS(values1.setFitWeights(y), const std::invalid_argument &); y.resize(10); for (size_t i = 0; i < y.size(); ++i) { diff --git a/Framework/API/test/IFunction1DSpectrumTest.h b/Framework/API/test/IFunction1DSpectrumTest.h index 8bbf8c45003..1b534adeb73 100644 --- a/Framework/API/test/IFunction1DSpectrumTest.h +++ b/Framework/API/test/IFunction1DSpectrumTest.h @@ -59,7 +59,7 @@ public: IFunction_sptr fun(new ConcreteFunction1DSpectrum); - TS_ASSERT_THROWS(fun->function(domain, values), std::invalid_argument); + TS_ASSERT_THROWS(fun->function(domain, values), const std::invalid_argument &); } private: diff --git a/Framework/API/test/ILatticeFunctionTest.h b/Framework/API/test/ILatticeFunctionTest.h index fbc282aaf04..eac5855a691 100644 --- a/Framework/API/test/ILatticeFunctionTest.h +++ b/Framework/API/test/ILatticeFunctionTest.h @@ -70,11 +70,11 @@ public: EXPECT_CALL(wrongDomain, size()).WillRepeatedly(Return(1)); FunctionValues values(wrongDomain); - TS_ASSERT_THROWS(fn.function(wrongDomain, values), std::invalid_argument); + TS_ASSERT_THROWS(fn.function(wrongDomain, values), const std::invalid_argument &); MockJacobian jacobian; TS_ASSERT_THROWS(fn.functionDeriv(wrongDomain, jacobian), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/API/test/IMDWorkspaceTest.h b/Framework/API/test/IMDWorkspaceTest.h index d684f1714f6..de32c35f3cc 100644 --- a/Framework/API/test/IMDWorkspaceTest.h +++ b/Framework/API/test/IMDWorkspaceTest.h @@ -88,7 +88,8 @@ public: WorkspaceTester matrixWS; matrixWS.initialize(1, 1, 1); TSM_ASSERT_THROWS("Id doesn't exist. Should throw during find routine.", - matrixWS.getDimensionWithId("3"), std::overflow_error); + matrixWS.getDimensionWithId("3"), + const std::overflow_error &); } void testGetDimension() { @@ -106,7 +107,7 @@ public: matrixWS.initialize(1, 1, 1); TSM_ASSERT_THROWS( "The dimension does not exist. Attempting to get it should throw", - matrixWS.getDimensionWithId("1"), std::overflow_error); + matrixWS.getDimensionWithId("1"), const std::overflow_error &); } void testGetNPoints() { diff --git a/Framework/API/test/IkedaCarpenterModeratorTest.h b/Framework/API/test/IkedaCarpenterModeratorTest.h index a61ffb3e5ad..e74ba160bfe 100644 --- a/Framework/API/test/IkedaCarpenterModeratorTest.h +++ b/Framework/API/test/IkedaCarpenterModeratorTest.h @@ -36,19 +36,19 @@ public: void test_Initializing_With_Empty_String_Throws() { Mantid::API::IkedaCarpenterModerator ikmod; - TS_ASSERT_THROWS(ikmod.initialize(""), std::invalid_argument); + TS_ASSERT_THROWS(ikmod.initialize(""), const std::invalid_argument &); } void test_Initializing_With_Invalid_String_Throws() { Mantid::API::IkedaCarpenterModerator ikmod; - TS_ASSERT_THROWS(ikmod.initialize("TiltAngle"), std::invalid_argument); + TS_ASSERT_THROWS(ikmod.initialize("TiltAngle"), const std::invalid_argument &); } void test_Initializing_With_String_Containing_Unknown_Parameter_Throws() { Mantid::API::IkedaCarpenterModerator ikmod; - TS_ASSERT_THROWS(ikmod.initialize("unknown=6.3"), std::invalid_argument); + TS_ASSERT_THROWS(ikmod.initialize("unknown=6.3"), const std::invalid_argument &); } void @@ -88,9 +88,9 @@ public: IkedaCarpenterModerator_sptr ikmod = createTestModerator(); TS_ASSERT_THROWS(ikmod->sampleTimeDistribution(-0.01), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(ikmod->sampleTimeDistribution(-1.5), - std::invalid_argument); + const std::invalid_argument &); } void @@ -122,8 +122,8 @@ public: IkedaCarpenterModerator_sptr ikmod = createTestModerator(); TS_ASSERT_THROWS(ikmod->sampleTimeDistribution(1.01), - std::invalid_argument); - TS_ASSERT_THROWS(ikmod->sampleTimeDistribution(5.5), std::invalid_argument); + const std::invalid_argument &); + TS_ASSERT_THROWS(ikmod->sampleTimeDistribution(5.5), const std::invalid_argument &); } private: diff --git a/Framework/API/test/ImmutableCompositeFunctionTest.h b/Framework/API/test/ImmutableCompositeFunctionTest.h index 98f3a83d486..336aaa437dc 100644 --- a/Framework/API/test/ImmutableCompositeFunctionTest.h +++ b/Framework/API/test/ImmutableCompositeFunctionTest.h @@ -249,12 +249,12 @@ public: void testParameterAliasUnique() { TS_ASSERT_THROWS(ImmutableCompositeFunctionTest_FunctionThrow icf, - Mantid::Kernel::Exception::ExistsError); + const Mantid::Kernel::Exception::ExistsError &); } void testSetAliasThrowsIfNameDoesntExist() { TS_ASSERT_THROWS(ImmutableCompositeFunctionTest_FunctionThrow1 icf, - std::invalid_argument); + const std::invalid_argument &); } void testAddTies() { diff --git a/Framework/API/test/ImplicitFunctionFactoryTest.h b/Framework/API/test/ImplicitFunctionFactoryTest.h index a83ebe21e68..f94b5c4a70e 100644 --- a/Framework/API/test/ImplicitFunctionFactoryTest.h +++ b/Framework/API/test/ImplicitFunctionFactoryTest.h @@ -189,7 +189,7 @@ public: "Should have thrown exeption on use of create rather than " "createunwrapped.", Mantid::API::ImplicitFunctionFactory::Instance().create(""), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h b/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h index 6a3238ee3bb..ba81f84ee36 100644 --- a/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h +++ b/Framework/API/test/ImplicitFunctionParameterParserFactoryTest.h @@ -98,7 +98,7 @@ public: "createunwrapped.", Mantid::API::ImplicitFunctionParameterParserFactory::Instance().create( ""), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/API/test/ImplicitFunctionParserFactoryTest.h b/Framework/API/test/ImplicitFunctionParserFactoryTest.h index 4d2e04d375f..e1db7e32ba7 100644 --- a/Framework/API/test/ImplicitFunctionParserFactoryTest.h +++ b/Framework/API/test/ImplicitFunctionParserFactoryTest.h @@ -100,7 +100,7 @@ public: "Should have thrown exception on use of create rather than " "createunwrapped.", Mantid::API::ImplicitFunctionParserFactory::Instance().create(""), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/API/test/IndexTypePropertyTest.h b/Framework/API/test/IndexTypePropertyTest.h index 4bd587a8d7e..78ce5d79332 100644 --- a/Framework/API/test/IndexTypePropertyTest.h +++ b/Framework/API/test/IndexTypePropertyTest.h @@ -29,7 +29,7 @@ public: } void testContructorFailsWithInvalidIndexType() { - TS_ASSERT_THROWS(IndexTypeProperty("IndexType", 0), std::invalid_argument); + TS_ASSERT_THROWS(IndexTypeProperty("IndexType", 0), const std::invalid_argument &); } void testSingleIndexTypeAutomaticallySet() { diff --git a/Framework/API/test/InstrumentDataServiceTest.h b/Framework/API/test/InstrumentDataServiceTest.h index a4b79bfe9b9..8ea7156d885 100644 --- a/Framework/API/test/InstrumentDataServiceTest.h +++ b/Framework/API/test/InstrumentDataServiceTest.h @@ -32,7 +32,7 @@ public: void testAdd() { // Adding an Instrument with empty name should throw TS_ASSERT_THROWS(InstrumentDataService::Instance().add("", inst1), - std::runtime_error); + const std::runtime_error &); // This should not throw, valid name TS_ASSERT_THROWS_NOTHING( InstrumentDataService::Instance().add("inst1", inst1)); @@ -42,7 +42,7 @@ public: void testAddOrReplace() { // AddorReplace an Instrument with empty name should throw TS_ASSERT_THROWS(InstrumentDataService::Instance().addOrReplace("", inst2), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS_NOTHING( InstrumentDataService::Instance().addOrReplace("inst2", inst2)); TS_ASSERT_EQUALS(inst2.use_count(), 2); @@ -73,7 +73,7 @@ public: // Should throw if the instrument can not be retrieved TS_ASSERT_THROWS( InstrumentDataService::Instance().retrieve("notregistered"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void testRemove() { diff --git a/Framework/API/test/LatticeDomainTest.h b/Framework/API/test/LatticeDomainTest.h index eade0e1e48c..b1ed9e0d0d4 100644 --- a/Framework/API/test/LatticeDomainTest.h +++ b/Framework/API/test/LatticeDomainTest.h @@ -13,8 +13,8 @@ #include "MantidKernel/Exception.h" using Mantid::API::LatticeDomain; -using Mantid::Kernel::Exception::IndexError; using Mantid::Kernel::V3D; +using Mantid::Kernel::Exception::IndexError; using namespace Mantid::API; @@ -51,7 +51,7 @@ public: TS_ASSERT_THROWS_NOTHING(domain[1]); TS_ASSERT_THROWS_NOTHING(domain[2]); - TS_ASSERT_THROWS(domain[3], IndexError) + TS_ASSERT_THROWS(domain[3], const IndexError &) } }; diff --git a/Framework/API/test/LiveListenerFactoryTest.h b/Framework/API/test/LiveListenerFactoryTest.h index 70d2d204209..31535cf950f 100644 --- a/Framework/API/test/LiveListenerFactoryTest.h +++ b/Framework/API/test/LiveListenerFactoryTest.h @@ -103,7 +103,7 @@ public: // Check that unregistered class request throws TS_ASSERT_THROWS(factory.create("fdsfds", false), - Mantid::Kernel::Exception::NotFoundError) + const Mantid::Kernel::Exception::NotFoundError &) TS_ASSERT(testing::Mock::VerifyAndClearExpectations(product.get())); factory.unsubscribe("MockLiveListener"); } @@ -139,7 +139,8 @@ public: EXPECT_CALL(*product, connect(testing::_)) .WillOnce(testing::Return(false /*cannot connect*/)); Kernel::ConfigService::Instance().setFacility("TEST"); - TS_ASSERT_THROWS(factory.create("MINITOPAZ", true), std::runtime_error); + TS_ASSERT_THROWS(factory.create("MINITOPAZ", true), + const std::runtime_error &); TS_ASSERT(testing::Mock::VerifyAndClearExpectations(product.get())); // Now test that it doesn't throw if we ask not to connect EXPECT_CALL(*product, connect(testing::_)).Times(0); @@ -164,7 +165,7 @@ public: Mantid::Kernel::DynamicFactory<ILiveListener> &f = LiveListenerFactory::Instance(); TS_ASSERT_THROWS(f.createUnwrapped(""), - Mantid::Kernel::Exception::NotImplementedError) + const Mantid::Kernel::Exception::NotImplementedError &) factory.unsubscribe("MockLiveListener"); } }; diff --git a/Framework/API/test/LogFilterGeneratorTest.h b/Framework/API/test/LogFilterGeneratorTest.h index 685cc2f5213..12fd7bb1c4d 100644 --- a/Framework/API/test/LogFilterGeneratorTest.h +++ b/Framework/API/test/LogFilterGeneratorTest.h @@ -37,13 +37,13 @@ public: auto ws = createTestWorkspace(); LogFilterGenerator generator(LogFilterGenerator::FilterType::Status, ws); TS_ASSERT_THROWS(generator.generateFilter("NonExistentLog"), - std::invalid_argument); + const std::invalid_argument &); } void test_logExistsButIsNotNumericTimeSeries_throws() { auto ws = createTestWorkspace(); LogFilterGenerator generator(LogFilterGenerator::FilterType::Status, ws); - TS_ASSERT_THROWS(generator.generateFilter("BadLog"), std::invalid_argument); + TS_ASSERT_THROWS(generator.generateFilter("BadLog"), const std::invalid_argument &); } void test_typeIsNone_noFilterReturned() { diff --git a/Framework/API/test/LogManagerTest.h b/Framework/API/test/LogManagerTest.h index 6d4060d3966..7664d642819 100644 --- a/Framework/API/test/LogManagerTest.h +++ b/Framework/API/test/LogManagerTest.h @@ -85,7 +85,7 @@ public: TS_ASSERT(!pp->name().compare("Test")); TS_ASSERT(dynamic_cast<ConcreteProperty *>(pp)); TS_ASSERT_THROWS(pp = runInfo.getProperty("NotThere"), - Exception::NotFoundError); + const Exception::NotFoundError &); std::vector<Property *> props = runInfo.getProperties(); TS_ASSERT(!props.empty()); @@ -106,7 +106,7 @@ public: void testStartTime() { LogManager runInfo; // Nothing there yet - TS_ASSERT_THROWS(runInfo.startTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.startTime(), const std::runtime_error &); // Add run_start and see that get picked up const std::string run_start("2013-12-19T13:38:00"); auto run_start_prop = @@ -125,7 +125,7 @@ public: TS_ASSERT_EQUALS(runInfo.startTime(), DateAndTime(run_start)); // And back to failure if they're both that run_start_prop->setValue(epoch); - TS_ASSERT_THROWS(runInfo.startTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.startTime(), const std::runtime_error &); // Set run_start back to valid value and make start_time contain nonsense run_start_prop->setValue(run_start); @@ -137,17 +137,17 @@ public: TS_ASSERT_EQUALS(runInfo.startTime(), DateAndTime(run_start)); // Now make run_start something invalid run_start_prop->setValue("notADate"); - TS_ASSERT_THROWS(runInfo.startTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.startTime(), const std::runtime_error &); // And check things if it's the wrong property type runInfo.removeProperty("run_start"); addTimeSeriesEntry(runInfo, "run_start", 4.44); - TS_ASSERT_THROWS(runInfo.startTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.startTime(), const std::runtime_error &); } void testEndTime() { LogManager runInfo; // Nothing there yet - TS_ASSERT_THROWS(runInfo.endTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.endTime(), const std::runtime_error &); // Add run_end and see that get picked up const std::string run_end("2013-12-19T13:38:00"); auto run_end_prop = new PropertyWithValue<std::string>("run_end", run_end); @@ -170,11 +170,11 @@ public: TS_ASSERT_EQUALS(runInfo.endTime(), DateAndTime(run_end)); // Now make run_end something invalid run_end_prop->setValue("notADate"); - TS_ASSERT_THROWS(runInfo.endTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.endTime(), const std::runtime_error &); // And check things if it's the wrong property type runInfo.removeProperty("run_end"); addTimeSeriesEntry(runInfo, "run_end", 4.44); - TS_ASSERT_THROWS(runInfo.endTime(), std::runtime_error); + TS_ASSERT_THROWS(runInfo.endTime(), const std::runtime_error &); } void testMemory() { @@ -202,7 +202,7 @@ public: void test_GetTimeSeriesProperty_Throws_When_Log_Does_Not_Exist() { LogManager runInfo; TS_ASSERT_THROWS(runInfo.getTimeSeriesProperty<double>("not_a_log"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void @@ -212,13 +212,13 @@ public: runInfo.addProperty(name, 5.6); // Standard double property TS_ASSERT_THROWS(runInfo.getTimeSeriesProperty<double>(name), - std::invalid_argument); + const std::invalid_argument &); } void test_GetPropertyAsType_Throws_When_Property_Does_Not_Exist() { LogManager runInfo; TS_ASSERT_THROWS(runInfo.getPropertyValueAsType<double>("not_a_log"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void test_GetPropertyAsType_Returns_Expected_Value_When_Type_Is_Correct() { @@ -238,7 +238,7 @@ public: runInfo.addProperty("double_prop", 6.7); // Standard double property TS_ASSERT_THROWS(runInfo.getPropertyValueAsType<int>("double_prop"), - std::invalid_argument); + const std::invalid_argument &); } void test_GetPropertyAsSingleValue_SingleValue_DoubleType() { @@ -295,13 +295,13 @@ public: const std::string name = "T_prop"; runInfo.addProperty<double>(name, 1.0); TS_ASSERT_THROWS(runInfo.getPropertyAsIntegerValue(name), - std::invalid_argument); + const std::invalid_argument &); } void test_GetPropertyAsSingleInteger_Throws_for_nonexistant_property() { LogManager runInfo; TS_ASSERT_THROWS(runInfo.getPropertyAsIntegerValue("T_prop"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void test_GetPropertyAsSingleValue_TimeSeries_DoubleType() { @@ -334,7 +334,7 @@ public: runInfo.addProperty<std::string>(name, "hello"); // not a number TS_ASSERT_THROWS(runInfo.getPropertyAsSingleValue(name), - std::invalid_argument); + const std::invalid_argument &); } void @@ -345,7 +345,7 @@ public: runInfo.addProperty<bool>(name, value); // Adds a bool property TS_ASSERT_THROWS(runInfo.getPropertyAsSingleValue(name), - std::invalid_argument); + const std::invalid_argument &); } void diff --git a/Framework/API/test/MatrixWorkspaceMDIteratorTest.h b/Framework/API/test/MatrixWorkspaceMDIteratorTest.h index 103df1ce698..0a3d5f4358b 100644 --- a/Framework/API/test/MatrixWorkspaceMDIteratorTest.h +++ b/Framework/API/test/MatrixWorkspaceMDIteratorTest.h @@ -139,7 +139,7 @@ public: // quick checks to make sure things are returning the expected values TS_ASSERT(!(ws->isCommonBins())); - TS_ASSERT_THROWS(ws->blocksize(), std::logic_error); + TS_ASSERT_THROWS(ws->blocksize(), const std::logic_error &); TS_ASSERT_EQUALS(ws->size(), 17); // Split in 4 iterators auto iterators = ws->createIterators(4, nullptr); diff --git a/Framework/API/test/MatrixWorkspaceTest.h b/Framework/API/test/MatrixWorkspaceTest.h index 8f78d300b15..ae1928b3fa2 100644 --- a/Framework/API/test/MatrixWorkspaceTest.h +++ b/Framework/API/test/MatrixWorkspaceTest.h @@ -545,16 +545,16 @@ public: void testAxes() { TS_ASSERT_EQUALS(ws->axes(), 2); } void testGetAxis() { - TS_ASSERT_THROWS(ws->getAxis(-1), Exception::IndexError); + TS_ASSERT_THROWS(ws->getAxis(-1), const Exception::IndexError &); TS_ASSERT_THROWS_NOTHING(ws->getAxis(0)); TS_ASSERT(ws->getAxis(0)); TS_ASSERT(ws->getAxis(0)->isNumeric()); - TS_ASSERT_THROWS(ws->getAxis(2), Exception::IndexError); + TS_ASSERT_THROWS(ws->getAxis(2), const Exception::IndexError &); } void testReplaceAxis() { Axis *ax = new SpectraAxis(ws.get()); - TS_ASSERT_THROWS(ws->replaceAxis(2, ax), Exception::IndexError); + TS_ASSERT_THROWS(ws->replaceAxis(2, ax), const Exception::IndexError &); TS_ASSERT_THROWS_NOTHING(ws->replaceAxis(0, ax)); TS_ASSERT(ws->getAxis(0)->isSpectra()); } @@ -734,15 +734,18 @@ public: TS_ASSERT(!ws2->hasMaskedBins(-1)); // Will throw if nothing masked for spectrum - TS_ASSERT_THROWS(ws2->maskedBins(0), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS(ws2->maskedBins(0), + const Mantid::Kernel::Exception::IndexError &); // Will throw if attempting to mask invalid spectrum TS_ASSERT_THROWS(ws2->maskBin(-1, 1), - Mantid::Kernel::Exception::IndexError); - TS_ASSERT_THROWS(ws2->maskBin(1, 1), Mantid::Kernel::Exception::IndexError); + const Mantid::Kernel::Exception::IndexError &); + TS_ASSERT_THROWS(ws2->maskBin(1, 1), + const Mantid::Kernel::Exception::IndexError &); // ...or an invalid bin TS_ASSERT_THROWS(ws2->maskBin(0, -1), - Mantid::Kernel::Exception::IndexError); - TS_ASSERT_THROWS(ws2->maskBin(0, 2), Mantid::Kernel::Exception::IndexError); + const Mantid::Kernel::Exception::IndexError &); + TS_ASSERT_THROWS(ws2->maskBin(0, 2), + const Mantid::Kernel::Exception::IndexError &); // Now do a valid masking TS_ASSERT_THROWS_NOTHING(ws2->maskBin(0, 1, 0.5)); @@ -825,7 +828,8 @@ public: // Check it throws for non-spectra axis ws.replaceAxis(1, new NumericAxis(1)); - TS_ASSERT_THROWS(ws.getSpectrumToWorkspaceIndexMap(), std::runtime_error); + TS_ASSERT_THROWS(ws.getSpectrumToWorkspaceIndexMap(), + const std::runtime_error &); } void test_getDetectorIDToWorkspaceIndexMap() { @@ -841,7 +845,7 @@ public: ws->getSpectrum(2).addDetectorID(99); // Set a second ID on one spectrum TS_ASSERT_THROWS(ws->getDetectorIDToWorkspaceIndexMap(true), - std::runtime_error); + const std::runtime_error &); detid2index_map idmap2 = ws->getDetectorIDToWorkspaceIndexMap(); TS_ASSERT_EQUALS(idmap2.size(), 6); } @@ -988,13 +992,13 @@ public: void test_setMDMasking() { WorkspaceTester ws; TSM_ASSERT_THROWS("Characterisation test. This is not implemented.", - ws.setMDMasking(nullptr), std::runtime_error); + ws.setMDMasking(nullptr), const std::runtime_error &); } void test_clearMDMasking() { WorkspaceTester ws; TSM_ASSERT_THROWS("Characterisation test. This is not implemented.", - ws.clearMDMasking(), std::runtime_error); + ws.clearMDMasking(), const std::runtime_error &); } void test_getSpecialCoordinateSystem_default() { @@ -1039,11 +1043,11 @@ public: void test_getFirstPulseTime_getLastPulseTime_throws_if_protoncharge_missing_or_empty() { WorkspaceTester ws; - TS_ASSERT_THROWS(ws.getFirstPulseTime(), std::runtime_error); - TS_ASSERT_THROWS(ws.getLastPulseTime(), std::runtime_error); + TS_ASSERT_THROWS(ws.getFirstPulseTime(), const std::runtime_error &); + TS_ASSERT_THROWS(ws.getLastPulseTime(), const std::runtime_error &); ws.mutableRun().addLogData(new TimeSeriesProperty<double>("proton_charge")); - TS_ASSERT_THROWS(ws.getFirstPulseTime(), std::runtime_error); - TS_ASSERT_THROWS(ws.getLastPulseTime(), std::runtime_error); + TS_ASSERT_THROWS(ws.getFirstPulseTime(), const std::runtime_error &); + TS_ASSERT_THROWS(ws.getLastPulseTime(), const std::runtime_error &); } void @@ -1053,13 +1057,13 @@ public: proton_charge->addValue("2013-04-21T10:19:10", 1); proton_charge->addValue("2013-04-21T10:19:12", 2); ws.mutableRun().addLogData(proton_charge); - TS_ASSERT_THROWS(ws.getFirstPulseTime(), std::invalid_argument); - TS_ASSERT_THROWS(ws.getLastPulseTime(), std::invalid_argument); + TS_ASSERT_THROWS(ws.getFirstPulseTime(), const std::invalid_argument &); + TS_ASSERT_THROWS(ws.getLastPulseTime(), const std::invalid_argument &); ws.mutableRun().addProperty( new PropertyWithValue<double>("proton_charge", 99.0), true); - TS_ASSERT_THROWS(ws.getFirstPulseTime(), std::invalid_argument); - TS_ASSERT_THROWS(ws.getLastPulseTime(), std::invalid_argument); + TS_ASSERT_THROWS(ws.getFirstPulseTime(), const std::invalid_argument &); + TS_ASSERT_THROWS(ws.getLastPulseTime(), const std::invalid_argument &); } void test_getXMinMax() { @@ -1209,7 +1213,8 @@ public: const size_t start = 0; const size_t stop = 8; size_t width = 0; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); width = 3; TS_ASSERT_THROWS_NOTHING(ws.getImageY(start, stop, width)); } @@ -1223,9 +1228,11 @@ public: size_t start = 10; size_t stop = 8; size_t width = 3; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); start = 9; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); start = 0; TS_ASSERT_THROWS_NOTHING(ws.getImageY(start, stop, width)); } @@ -1239,9 +1246,11 @@ public: size_t start = 0; size_t stop = 18; size_t width = 3; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); stop = 9; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); stop = 8; TS_ASSERT_THROWS_NOTHING(ws.getImageY(start, stop, width)); } @@ -1255,7 +1264,8 @@ public: size_t start = 1; size_t stop = 0; size_t width = 1; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); stop = 1; TS_ASSERT_THROWS_NOTHING(ws.getImageY(start, stop, width)); } @@ -1269,7 +1279,8 @@ public: size_t start = 0; size_t stop = 7; size_t width = 3; - TS_ASSERT_THROWS(ws.getImageY(start, stop, width), std::runtime_error); + TS_ASSERT_THROWS(ws.getImageY(start, stop, width), + const std::runtime_error &); } void test_getImage_wrong_indexStart() { @@ -1284,14 +1295,14 @@ public: double startX = 3; double endX = 4; TS_ASSERT_THROWS(ws.getImageY(start, stop, width, startX, endX), - std::runtime_error); + const std::runtime_error &); WorkspaceTester wsh; wsh.initialize(9, 1, 1); startX = 2; endX = 2; TS_ASSERT_THROWS(wsh.getImageY(start, stop, width, startX, endX), - std::runtime_error); + const std::runtime_error &); } void test_getImage_wrong_indexEnd() { @@ -1306,7 +1317,7 @@ public: double startX = 1.0; double endX = 0.0; TS_ASSERT_THROWS(ws.getImageY(start, stop, width, startX, endX), - std::runtime_error); + const std::runtime_error &); WorkspaceTester wsh; wsh.initialize(9, 2, 2); @@ -1316,7 +1327,7 @@ public: startX = 1.0; endX = 0.0; TS_ASSERT_THROWS(wsh.getImageY(start, stop, width, startX, endX), - std::runtime_error); + const std::runtime_error &); } void test_getImage_single_bin_histo() { @@ -1463,14 +1474,14 @@ public: auto image = createImage(2, 3); WorkspaceTester ws; ws.initialize(2, 2, 1); - TS_ASSERT_THROWS(ws.setImageY(*image), std::runtime_error); + TS_ASSERT_THROWS(ws.setImageY(*image), const std::runtime_error &); } void test_setImage_not_single_bin() { auto image = createImage(2, 3); WorkspaceTester ws; ws.initialize(20, 3, 2); - TS_ASSERT_THROWS(ws.setImageY(*image), std::runtime_error); + TS_ASSERT_THROWS(ws.setImageY(*image), const std::runtime_error &); } void test_setImageY() { @@ -1644,15 +1655,15 @@ public: TS_ASSERT_THROWS_NOTHING(specInfo.detector(0)); const auto &det = specInfo.detector(0); // Failing legacy methods (use DetectorInfo/SpectrumInfo instead): - TS_ASSERT_THROWS(det.getPos(), std::runtime_error); - TS_ASSERT_THROWS(det.getRelativePos(), std::runtime_error); - TS_ASSERT_THROWS(det.getRotation(), std::runtime_error); - TS_ASSERT_THROWS(det.getRelativeRot(), std::runtime_error); - TS_ASSERT_THROWS(det.getPhi(), std::runtime_error); + TS_ASSERT_THROWS(det.getPos(), const std::runtime_error &); + TS_ASSERT_THROWS(det.getRelativePos(), const std::runtime_error &); + TS_ASSERT_THROWS(det.getRotation(), const std::runtime_error &); + TS_ASSERT_THROWS(det.getRelativeRot(), const std::runtime_error &); + TS_ASSERT_THROWS(det.getPhi(), const std::runtime_error &); // Failing methods, currently without replacement: - TS_ASSERT_THROWS(det.solidAngle(V3D(0, 0, 0)), std::runtime_error); + TS_ASSERT_THROWS(det.solidAngle(V3D(0, 0, 0)), const std::runtime_error &); BoundingBox bb; - TS_ASSERT_THROWS(det.getBoundingBox(bb), std::runtime_error); + TS_ASSERT_THROWS(det.getBoundingBox(bb), const std::runtime_error &); // Moving parent not possible since non-detector components do not have time // indices and thus DetectorInfo cannot tell which set of detector positions // to adjust. @@ -1663,12 +1674,12 @@ public: TS_ASSERT_THROWS(compInfo.setPosition(compInfo.parent(compInfo.indexOf( det.getComponentID())), V3D(1, 2, 3)), - std::runtime_error); + const std::runtime_error &); // Try to rotate the parent TS_ASSERT_THROWS(compInfo.setRotation(compInfo.parent(compInfo.indexOf( det.getComponentID())), Quat(1, 2, 3, 4)), - std::runtime_error); + const std::runtime_error &); } void test_legacy_setting_spectrum_numbers_with_MPI() { @@ -1735,8 +1746,8 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 3, xValues); TS_ASSERT_EQUALS(workspace.getNumberHistograms(), 1); - TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, 1), std::out_of_range); - TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, -1), std::out_of_range); + TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, 1), const std::out_of_range &); + TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, -1), const std::out_of_range &); } void @@ -1744,8 +1755,8 @@ public: std::vector<double> const xValues{1.0, 2.0, 3.0, 4.0}; auto const workspace = getWorkspaceWithPopulatedX(1, 4, 3, xValues); - TS_ASSERT_THROWS(workspace.yIndexOfX(5.), std::out_of_range); - TS_ASSERT_THROWS(workspace.yIndexOfX(0.), std::out_of_range); + TS_ASSERT_THROWS(workspace.yIndexOfX(5.), const std::out_of_range &); + TS_ASSERT_THROWS(workspace.yIndexOfX(0.), const std::out_of_range &); } void @@ -1810,8 +1821,8 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 3, xValues); TS_ASSERT_EQUALS(workspace.getNumberHistograms(), 1); - TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, 1), std::out_of_range); - TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, -1), std::out_of_range); + TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, 1), const std::out_of_range &); + TS_ASSERT_THROWS(workspace.yIndexOfX(2.5, -1), const std::out_of_range &); } void @@ -1820,11 +1831,11 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 3, xValues); TS_ASSERT_THROWS(workspace.yIndexOfX(std::nextafter(5.3, 10.0)), - std::out_of_range); - TS_ASSERT_THROWS(workspace.yIndexOfX(5.4), std::out_of_range); + const std::out_of_range &); + TS_ASSERT_THROWS(workspace.yIndexOfX(5.4), const std::out_of_range &); TS_ASSERT_THROWS(workspace.yIndexOfX(std::nextafter(2.3, 0.0)), - std::out_of_range); - TS_ASSERT_THROWS(workspace.yIndexOfX(0.), std::out_of_range); + const std::out_of_range &); + TS_ASSERT_THROWS(workspace.yIndexOfX(0.), const std::out_of_range &); } void @@ -1889,7 +1900,7 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 4, xValues); TS_ASSERT_THROWS(workspace.yIndexOfX(2.0, 0, 0.0002), - std::invalid_argument); + const std::invalid_argument &); } void @@ -1898,7 +1909,7 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 4, xValues); TS_ASSERT_THROWS(workspace.yIndexOfX(1.9992, 0, 0.0002), - std::invalid_argument); + const std::invalid_argument &); } void @@ -1906,7 +1917,7 @@ public: std::vector<double> const xValues{1.0, 1.9997, 3.0, 4.0}; auto const workspace = getWorkspaceWithPopulatedX(1, 4, 4, xValues); - TS_ASSERT_THROWS(workspace.yIndexOfX(3.5), std::invalid_argument); + TS_ASSERT_THROWS(workspace.yIndexOfX(3.5), const std::invalid_argument &); } void @@ -1939,7 +1950,7 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 4, xValues); TS_ASSERT_THROWS(workspace.yIndexOfX(1.9994, 0, 0.0002), - std::invalid_argument); + const std::invalid_argument &); } void @@ -1948,7 +1959,7 @@ public: auto const workspace = getWorkspaceWithPopulatedX(1, 4, 4, xValues); TS_ASSERT_THROWS(workspace.yIndexOfX(2.0, 0, 0.0002), - std::invalid_argument); + const std::invalid_argument &); } void @@ -1956,7 +1967,7 @@ public: std::vector<double> const xValues{4.0, 3.0, 1.9997, 1.0}; auto const workspace = getWorkspaceWithPopulatedX(1, 4, 4, xValues); - TS_ASSERT_THROWS(workspace.yIndexOfX(3.5), std::invalid_argument); + TS_ASSERT_THROWS(workspace.yIndexOfX(3.5), const std::invalid_argument &); } void diff --git a/Framework/API/test/MultiDomainFunctionTest.h b/Framework/API/test/MultiDomainFunctionTest.h index 62f5ef1d7fc..7e076be2a88 100644 --- a/Framework/API/test/MultiDomainFunctionTest.h +++ b/Framework/API/test/MultiDomainFunctionTest.h @@ -233,10 +233,10 @@ public: FunctionValues values(domain); multi.setDomainIndex(0, 3); - TS_ASSERT_THROWS(multi.function(domain, values), std::invalid_argument); + TS_ASSERT_THROWS(multi.function(domain, values), const std::invalid_argument &); multi.setDomainIndex(0, 4); - TS_ASSERT_THROWS(multi.function(domain, values), std::invalid_argument); + TS_ASSERT_THROWS(multi.function(domain, values), const std::invalid_argument &); } void test_calc() { diff --git a/Framework/API/test/MultiPeriodGroupAlgorithmTest.h b/Framework/API/test/MultiPeriodGroupAlgorithmTest.h index 0cd963993c1..5803429c280 100644 --- a/Framework/API/test/MultiPeriodGroupAlgorithmTest.h +++ b/Framework/API/test/MultiPeriodGroupAlgorithmTest.h @@ -160,7 +160,7 @@ public: alg.setPropertyValue("OutputWorkspace", "outWS"); TSM_ASSERT_THROWS("Should throw because fetchInputPropertyName is " "returning the name of a property which doesn't exist.", - alg.execute(), std::runtime_error); + alg.execute(), const std::runtime_error &); } void test_input_property_doesnt_exist_throws() { @@ -200,7 +200,7 @@ public: alg.setPropertyValue("OutputWorkspace", "outWS"); TSM_ASSERT_THROWS("Should throw because fetchInputPropertyName is " "returning the name of a property which doesn't exist.", - alg.execute(), Kernel::Exception::NotFoundError); + alg.execute(), const Kernel::Exception::NotFoundError &); } void test_process_groups_with_array_input() { diff --git a/Framework/API/test/NumericAxisTest.h b/Framework/API/test/NumericAxisTest.h index 56d38407c04..2fc2a4c9268 100644 --- a/Framework/API/test/NumericAxisTest.h +++ b/Framework/API/test/NumericAxisTest.h @@ -59,7 +59,7 @@ public: TS_ASSERT_EQUALS(copiedAxis.unit()->unitID(), "Wavelength"); TS_ASSERT(copiedAxis.isNumeric()); TS_ASSERT_EQUALS(copiedAxis(0), 5.5); - TS_ASSERT_THROWS(copiedAxis(1), Exception::IndexError); + TS_ASSERT_THROWS(copiedAxis(1), const Exception::IndexError &); } void testClone() { @@ -99,13 +99,15 @@ public: void testIsText() { TS_ASSERT(!numericAxis->isText()); } void testOperatorBrackets() { - TS_ASSERT_THROWS((*numericAxis)(-1), Exception::IndexError); - TS_ASSERT_THROWS((*numericAxis)(5), Exception::IndexError); + TS_ASSERT_THROWS((*numericAxis)(-1), const Exception::IndexError &); + TS_ASSERT_THROWS((*numericAxis)(5), const Exception::IndexError &); } void testSetValue() { - TS_ASSERT_THROWS(numericAxis->setValue(-1, 1.1), Exception::IndexError); - TS_ASSERT_THROWS(numericAxis->setValue(5, 1.1), Exception::IndexError); + TS_ASSERT_THROWS(numericAxis->setValue(-1, 1.1), + const Exception::IndexError &); + TS_ASSERT_THROWS(numericAxis->setValue(5, 1.1), + const Exception::IndexError &); for (int i = 0; i < 5; ++i) { TS_ASSERT_THROWS_NOTHING(numericAxis->setValue(i, i + 0.5)); @@ -114,8 +116,8 @@ public: } void testSpectraNo() { - TS_ASSERT_THROWS(numericAxis->spectraNo(-1), std::domain_error); - TS_ASSERT_THROWS(numericAxis->spectraNo(5), std::domain_error); + TS_ASSERT_THROWS(numericAxis->spectraNo(-1), const std::domain_error &); + TS_ASSERT_THROWS(numericAxis->spectraNo(5), const std::domain_error &); } void testConversionToBins() { @@ -215,8 +217,8 @@ public: axis.setValue(i, static_cast<double>(i)); } - TS_ASSERT_THROWS(axis.indexOfValue(-0.6), std::out_of_range); - TS_ASSERT_THROWS(axis.indexOfValue(4.6), std::out_of_range); + TS_ASSERT_THROWS(axis.indexOfValue(-0.6), const std::out_of_range &); + TS_ASSERT_THROWS(axis.indexOfValue(4.6), const std::out_of_range &); } private: diff --git a/Framework/API/test/ParamFunctionAttributeHolderTest.h b/Framework/API/test/ParamFunctionAttributeHolderTest.h index 3531977d7a8..d347d77bda1 100644 --- a/Framework/API/test/ParamFunctionAttributeHolderTest.h +++ b/Framework/API/test/ParamFunctionAttributeHolderTest.h @@ -51,9 +51,9 @@ public: using namespace Mantid::API; FakeParamFunctionAttributeHolder funct; - TS_ASSERT_THROWS(funct.getAttribute("NonExistent"), std::invalid_argument); + TS_ASSERT_THROWS(funct.getAttribute("NonExistent"), const std::invalid_argument &); TS_ASSERT_THROWS(funct.setAttribute("NonExistent", IFunction::Attribute(1)), - std::invalid_argument); + const std::invalid_argument &); } void test_hasAttribute_Returns_True_For_Existing_Attribute() { diff --git a/Framework/API/test/ParameterTieTest.h b/Framework/API/test/ParameterTieTest.h index d7cd0318b6f..6ddfe2e1399 100644 --- a/Framework/API/test/ParameterTieTest.h +++ b/Framework/API/test/ParameterTieTest.h @@ -127,11 +127,11 @@ public: TS_ASSERT_EQUALS(tie.getLocalFunction(), g1.get()); TS_ASSERT_EQUALS(tie.getLocalIndex(), 2); - TS_ASSERT_THROWS(mustThrow1(&mfun), std::invalid_argument); - TS_ASSERT_THROWS(mustThrow2(&mfun), std::invalid_argument); - TS_ASSERT_THROWS(mustThrow3(&mfun), std::out_of_range); + TS_ASSERT_THROWS(mustThrow1(&mfun), const std::invalid_argument &); + TS_ASSERT_THROWS(mustThrow2(&mfun), const std::invalid_argument &); + TS_ASSERT_THROWS(mustThrow3(&mfun), const std::out_of_range &); - TS_ASSERT_THROWS(tie.set("a+b"), std::invalid_argument); + TS_ASSERT_THROWS(tie.set("a+b"), const std::invalid_argument &); } void testComposite1() { @@ -185,25 +185,25 @@ public: TS_ASSERT_EQUALS(tie1.asString(mf2.get()), "f0.sig=sin(f0.sig)+f1.cen/2"); ParameterTie tie2(&mfun, "f1.f0.sig", "123.4"); - TS_ASSERT_THROWS(tie2.asString(mf1.get()), std::logic_error); + TS_ASSERT_THROWS(tie2.asString(mf1.get()), const std::logic_error &); TS_ASSERT_EQUALS(tie2.asString(&mfun), "f1.f0.sig=123.4"); TS_ASSERT_EQUALS(tie2.asString(mf2.get()), "f0.sig=123.4"); TS_ASSERT_EQUALS(tie2.asString(g1.get()), "sig=123.4"); ParameterTie tie3(g1.get(), "sig", "123.4"); - TS_ASSERT_THROWS(tie3.asString(mf1.get()), std::logic_error); + TS_ASSERT_THROWS(tie3.asString(mf1.get()), const std::logic_error &); TS_ASSERT_EQUALS(tie3.asString(&mfun), "f1.f0.sig=123.4"); TS_ASSERT_EQUALS(tie3.asString(mf2.get()), "f0.sig=123.4"); TS_ASSERT_EQUALS(tie3.asString(g1.get()), "sig=123.4"); ParameterTie tie4(mf2.get(), "f0.sig", "123.4"); - TS_ASSERT_THROWS(tie4.asString(mf1.get()), std::logic_error); + TS_ASSERT_THROWS(tie4.asString(mf1.get()), const std::logic_error &); TS_ASSERT_EQUALS(tie4.asString(&mfun), "f1.f0.sig=123.4"); TS_ASSERT_EQUALS(tie4.asString(mf2.get()), "f0.sig=123.4"); TS_ASSERT_EQUALS(tie4.asString(g1.get()), "sig=123.4"); ParameterTie tie5(nth.get(), "a", "cos(B1e2Ta_)-sin(alpha12)"); - TS_ASSERT_THROWS(tie5.asString(mf1.get()), std::logic_error); + TS_ASSERT_THROWS(tie5.asString(mf1.get()), const std::logic_error &); TS_ASSERT_EQUALS(tie5.asString(&mfun), "f1.f2.a=cos(f1.f2.B1e2Ta_)-sin(f1.f2.alpha12)"); TS_ASSERT_EQUALS(tie5.asString(mf2.get()), @@ -221,11 +221,11 @@ public: TS_ASSERT_EQUALS(tie.getLocalIndex(), 1); TS_ASSERT_DELTA(tie.eval(), 0.6, 0.00001); - TS_ASSERT_THROWS(mustThrow4(&bk), std::invalid_argument); - TS_ASSERT_THROWS(mustThrow5(&bk), std::invalid_argument); - TS_ASSERT_THROWS(tie.set("q+p"), std::invalid_argument); + TS_ASSERT_THROWS(mustThrow4(&bk), const std::invalid_argument &); + TS_ASSERT_THROWS(mustThrow5(&bk), const std::invalid_argument &); + TS_ASSERT_THROWS(tie.set("q+p"), const std::invalid_argument &); - TS_ASSERT_THROWS(tie.set(""), std::runtime_error); + TS_ASSERT_THROWS(tie.set(""), const std::runtime_error &); } void test_untie_fixed() { diff --git a/Framework/API/test/ProgressTest.h b/Framework/API/test/ProgressTest.h index 5878a82418a..32b95dec616 100644 --- a/Framework/API/test/ProgressTest.h +++ b/Framework/API/test/ProgressTest.h @@ -20,8 +20,8 @@ public: static void destroySuite(ProgressTest *suite) { delete suite; } void testBadParameters() { - TS_ASSERT_THROWS(Progress(nullptr, -1., 100., 42), std::invalid_argument); - TS_ASSERT_THROWS(Progress(nullptr, 1., .1, 42), std::invalid_argument); + TS_ASSERT_THROWS(Progress(nullptr, -1., 100., 42), const std::invalid_argument &); + TS_ASSERT_THROWS(Progress(nullptr, 1., .1, 42), const std::invalid_argument &); } }; diff --git a/Framework/API/test/RemoteJobManagerFactoryTest.h b/Framework/API/test/RemoteJobManagerFactoryTest.h index e764f506dc2..a8a339d050b 100644 --- a/Framework/API/test/RemoteJobManagerFactoryTest.h +++ b/Framework/API/test/RemoteJobManagerFactoryTest.h @@ -88,12 +88,12 @@ public: "create() with inexistent and unsubscribed class should " "throw", jobManager = RemoteJobManagerFactory::Instance().create("Inexistent"), - std::runtime_error); + const std::runtime_error &); TSM_ASSERT_THROWS("create() with unsubscribed class should throw", jobManager = RemoteJobManagerFactory::Instance().create("FakeJM"), - std::runtime_error); + const std::runtime_error &); } // minimal positive test @@ -104,7 +104,7 @@ public: "create() with class name that is not defined in facilities should " "throw", jm = Mantid::API::RemoteJobManagerFactory::Instance().create("FakeJM"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void test_exists() { @@ -123,7 +123,7 @@ public: TS_ASSERT_THROWS( Mantid::API::RemoteJobManagerFactory::Instance().subscribe<FakeJM>( "FakeJM"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS_NOTHING( Mantid::API::RemoteJobManagerFactory::Instance().unsubscribe("FakeJM")); TS_ASSERT_THROWS_NOTHING( @@ -147,11 +147,11 @@ public: // these are not in the facilities file TS_ASSERT_THROWS( jm = Mantid::API::RemoteJobManagerFactory::Instance().create("FakeJM"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( jm = Mantid::API::RemoteJobManagerFactory::Instance().create( "FakeJMDeriv"), - std::runtime_error); + const std::runtime_error &); keys = Mantid::API::RemoteJobManagerFactory::Instance().getKeys(); size_t after = keys.size(); @@ -184,7 +184,7 @@ public: "create() with " + FermiName + "in a facility other than " + SNSFac + " should fail", jm = Mantid::API::RemoteJobManagerFactory::Instance().create(FermiName), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); // restore facility, always do this at the end Mantid::Kernel::ConfigService::Instance().setFacility(prevFac.name()); @@ -208,7 +208,7 @@ public: " should throw because its job manager is not declared", Mantid::API::IRemoteJobManager_sptr jobManager = Mantid::API::RemoteJobManagerFactory::Instance().create("Fermi"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); // restore facility, always do this at the end Mantid::Kernel::ConfigService::Instance().setFacility(prevFac.name()); diff --git a/Framework/API/test/RunTest.h b/Framework/API/test/RunTest.h index a94079f1c57..46fb324b04a 100644 --- a/Framework/API/test/RunTest.h +++ b/Framework/API/test/RunTest.h @@ -89,7 +89,7 @@ public: TS_ASSERT(!pp->name().compare("Test")); TS_ASSERT(dynamic_cast<ConcreteProperty *>(pp)); TS_ASSERT_THROWS(pp = runInfo.getProperty("NotThere"), - Exception::NotFoundError); + const Exception::NotFoundError &); std::vector<Property *> props = runInfo.getProperties(); TS_ASSERT(!props.empty()); @@ -160,7 +160,7 @@ public: void test_GetTimeSeriesProperty_Throws_When_Log_Does_Not_Exist() { Run runInfo; TS_ASSERT_THROWS(runInfo.getTimeSeriesProperty<double>("not_a_log"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void @@ -170,13 +170,13 @@ public: runInfo.addProperty(name, 5.6); // Standard double property TS_ASSERT_THROWS(runInfo.getTimeSeriesProperty<double>(name), - std::invalid_argument); + const std::invalid_argument &); } void test_GetPropertyAsType_Throws_When_Property_Does_Not_Exist() { Run runInfo; TS_ASSERT_THROWS(runInfo.getPropertyValueAsType<double>("not_a_log"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void test_GetPropertyAsType_Returns_Expected_Value_When_Type_Is_Correct() { @@ -196,7 +196,7 @@ public: runInfo.addProperty("double_prop", 6.7); // Standard double property TS_ASSERT_THROWS(runInfo.getPropertyValueAsType<int>("double_prop"), - std::invalid_argument); + const std::invalid_argument &); } void @@ -206,7 +206,7 @@ public: runInfo.addProperty<std::string>(name, "string"); // Adds a string property TS_ASSERT_THROWS(runInfo.getPropertyAsSingleValue(name), - std::invalid_argument); + const std::invalid_argument &); } void test_GetPropertyAsSingleValue_Does_Not_Throw_If_Type_Is_Int() { @@ -282,10 +282,10 @@ public: std::vector<double> bins; TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::invalid_argument); + const std::invalid_argument &); bins.push_back(0.5); TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::invalid_argument); + const std::invalid_argument &); bins.push_back(1.5); TS_ASSERT_THROWS_NOTHING(runInfo.storeHistogramBinBoundaries(bins)); } @@ -296,27 +296,27 @@ public: std::vector<double> bins(2, 0.0); TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::out_of_range); + const std::out_of_range &); bins[0] = -1.5; bins[1] = -1.5; TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::out_of_range); + const std::out_of_range &); bins[0] = 2.1; bins[1] = 2.1; TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::out_of_range); + const std::out_of_range &); bins[0] = -1.5; bins[1] = -1.6; TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::out_of_range); + const std::out_of_range &); bins[0] = 2.1; bins[1] = 1.9; TS_ASSERT_THROWS(runInfo.storeHistogramBinBoundaries(bins), - std::out_of_range); + const std::out_of_range &); } void test_storeHistogramBinBoundaries_Succeeds_With_Valid_Bins() { @@ -331,7 +331,8 @@ public: void test_histogramBinBoundaries_Throws_RuntimeError_For_New_Run() { Run runInfo; - TS_ASSERT_THROWS(runInfo.histogramBinBoundaries(1.5), std::runtime_error); + TS_ASSERT_THROWS(runInfo.histogramBinBoundaries(1.5), + const std::runtime_error &); } void @@ -342,10 +343,10 @@ public: TS_ASSERT_THROWS( runInfo.histogramBinBoundaries(m_test_energy_bins.front() - 1.3), - std::out_of_range); + const std::out_of_range &); TS_ASSERT_THROWS( runInfo.histogramBinBoundaries(m_test_energy_bins.back() + 1.3), - std::out_of_range); + const std::out_of_range &); } void @@ -470,7 +471,8 @@ public: Goniometer gm; gm.makeUniversalGoniometer(); - TS_ASSERT_THROWS(runInfo.setGoniometer(gm, true), std::runtime_error); + TS_ASSERT_THROWS(runInfo.setGoniometer(gm, true), + const std::runtime_error &); } /** Setting up a goniometer and the angles to feed it diff --git a/Framework/API/test/SampleTest.h b/Framework/API/test/SampleTest.h index 0277dbe11f2..aa993fc44fd 100644 --- a/Framework/API/test/SampleTest.h +++ b/Framework/API/test/SampleTest.h @@ -55,7 +55,7 @@ public: void test_That_Requests_For_An_Undefined_Environment_Throw() { Sample sample; - TS_ASSERT_THROWS(sample.getEnvironment(), std::runtime_error); + TS_ASSERT_THROWS(sample.getEnvironment(), const std::runtime_error &); } void @@ -212,7 +212,7 @@ public: void test_setCrystalStructure() { Sample sample; TS_ASSERT(!sample.hasCrystalStructure()); - TS_ASSERT_THROWS(sample.getCrystalStructure(), std::runtime_error); + TS_ASSERT_THROWS(sample.getCrystalStructure(), const std::runtime_error &); CrystalStructure structure("3 4 5 90 90 90", "C m m m", "Fe 0.12 0.23 0.121"); @@ -228,7 +228,7 @@ public: void test_clearCrystalStructure() { Sample sample; TS_ASSERT(!sample.hasCrystalStructure()); - TS_ASSERT_THROWS(sample.getCrystalStructure(), std::runtime_error); + TS_ASSERT_THROWS(sample.getCrystalStructure(), const std::runtime_error &); CrystalStructure structure("3 4 5 90 90 90", "C m m m", "Fe 0.12 0.23 0.121"); diff --git a/Framework/API/test/ScopedWorkspaceTest.h b/Framework/API/test/ScopedWorkspaceTest.h index daab3013dc8..bfd0fe32223 100644 --- a/Framework/API/test/ScopedWorkspaceTest.h +++ b/Framework/API/test/ScopedWorkspaceTest.h @@ -182,7 +182,7 @@ public: ScopedWorkspace test(ws); - TS_ASSERT_THROWS(ScopedWorkspace test2(ws), std::invalid_argument); + TS_ASSERT_THROWS(ScopedWorkspace test2(ws), const std::invalid_argument &); } void test_boolConversion() { diff --git a/Framework/API/test/SpectraAxisTest.h b/Framework/API/test/SpectraAxisTest.h index f92abc8b34a..e8fe835ad36 100644 --- a/Framework/API/test/SpectraAxisTest.h +++ b/Framework/API/test/SpectraAxisTest.h @@ -82,13 +82,13 @@ public: void testIsText() { TS_ASSERT(!spectraAxis->isText()); } void testOperatorBrackets() { - TS_ASSERT_THROWS((*spectraAxis)(-1), Exception::IndexError); - TS_ASSERT_THROWS((*spectraAxis)(5), Exception::IndexError); + TS_ASSERT_THROWS((*spectraAxis)(-1), const Exception::IndexError &); + TS_ASSERT_THROWS((*spectraAxis)(5), const Exception::IndexError &); } void testSpectraNo() { - TS_ASSERT_THROWS(spectraAxis->spectraNo(-1), Exception::IndexError); - TS_ASSERT_THROWS(spectraAxis->spectraNo(5), Exception::IndexError); + TS_ASSERT_THROWS(spectraAxis->spectraNo(-1), const Exception::IndexError &); + TS_ASSERT_THROWS(spectraAxis->spectraNo(5), const Exception::IndexError &); for (int i = 0; i < 5; ++i) { TS_ASSERT_EQUALS(spectraAxis->spectraNo(i), i + 1); @@ -117,8 +117,9 @@ public: // --------------------------------------- Failure cases -------------------- void testIndexOfValue_Throws_out_of_range_error_If_Input_Not_In_Range() { - TS_ASSERT_THROWS(spectraAxis->indexOfValue(0.49), std::out_of_range); - TS_ASSERT_THROWS(spectraAxis->indexOfValue(20.), std::out_of_range); + TS_ASSERT_THROWS(spectraAxis->indexOfValue(0.49), + const std::out_of_range &); + TS_ASSERT_THROWS(spectraAxis->indexOfValue(20.), const std::out_of_range &); } private: diff --git a/Framework/API/test/SpectrumDetectorMappingTest.h b/Framework/API/test/SpectrumDetectorMappingTest.h index cc77820b621..b355f8e86c9 100644 --- a/Framework/API/test/SpectrumDetectorMappingTest.h +++ b/Framework/API/test/SpectrumDetectorMappingTest.h @@ -28,7 +28,7 @@ public: void test_workspace_constructor() { MatrixWorkspace_const_sptr ws; - TS_ASSERT_THROWS(SpectrumDetectorMapping map(ws), std::invalid_argument); + TS_ASSERT_THROWS(SpectrumDetectorMapping map(ws), const std::invalid_argument &); } void test_workspace_constructor_fills_map() { @@ -53,7 +53,7 @@ public: void test_vector_constructor_unequal_lengths() { TS_ASSERT_THROWS(SpectrumDetectorMapping(std::vector<specnum_t>(2), std::vector<detid_t>(1)), - std::invalid_argument); + const std::invalid_argument &); } void check_the_map(const SpectrumDetectorMapping &map) { @@ -123,9 +123,9 @@ public: specnum_t specs[2]; detid_t detids[2]; TS_ASSERT_THROWS(SpectrumDetectorMapping(nullptr, detids, 10), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(SpectrumDetectorMapping(specs, nullptr, 10), - std::invalid_argument); + const std::invalid_argument &); } void test_array_constructor() { @@ -155,9 +155,9 @@ public: SpectrumDetectorMapping map(ws); // The happy path is tested in the methods above. Just test invalid entry // here. - TS_ASSERT_THROWS(map.getDetectorIDsForSpectrumNo(1), std::out_of_range); - TS_ASSERT_THROWS(map.getDetectorIDsForSpectrumNo(0), std::out_of_range); - TS_ASSERT_THROWS(map.getDetectorIDsForSpectrumNo(-1), std::out_of_range); + TS_ASSERT_THROWS(map.getDetectorIDsForSpectrumNo(1), const std::out_of_range &); + TS_ASSERT_THROWS(map.getDetectorIDsForSpectrumNo(0), const std::out_of_range &); + TS_ASSERT_THROWS(map.getDetectorIDsForSpectrumNo(-1), const std::out_of_range &); } }; diff --git a/Framework/API/test/SpectrumInfoTest.h b/Framework/API/test/SpectrumInfoTest.h index a78911299f3..9c4de57211c 100644 --- a/Framework/API/test/SpectrumInfoTest.h +++ b/Framework/API/test/SpectrumInfoTest.h @@ -80,7 +80,7 @@ public: void test_l1_no_instrument() { TS_ASSERT_THROWS(m_workspaceNoInstrument.spectrumInfo().l1(), - std::runtime_error); + const std::runtime_error &); } void test_isMonitor() { @@ -169,8 +169,8 @@ public: TS_ASSERT_DELTA(spectrumInfo.twoTheta(1), 0.0, 1e-6); TS_ASSERT_DELTA(spectrumInfo.twoTheta(2), 0.0199973, 1e-6); // Monitors - TS_ASSERT_THROWS(spectrumInfo.twoTheta(3), std::logic_error); - TS_ASSERT_THROWS(spectrumInfo.twoTheta(4), std::logic_error); + TS_ASSERT_THROWS(spectrumInfo.twoTheta(3), const std::logic_error &); + TS_ASSERT_THROWS(spectrumInfo.twoTheta(4), const std::logic_error &); } void test_twoTheta_grouped() { @@ -220,8 +220,8 @@ public: TS_ASSERT_DELTA(spectrumInfo.signedTwoTheta(1), 0.0, 1e-6); TS_ASSERT_DELTA(spectrumInfo.signedTwoTheta(2), 0.0199973, 1e-6); // Monitors - TS_ASSERT_THROWS(spectrumInfo.signedTwoTheta(3), std::logic_error); - TS_ASSERT_THROWS(spectrumInfo.signedTwoTheta(4), std::logic_error); + TS_ASSERT_THROWS(spectrumInfo.signedTwoTheta(3), const std::logic_error &); + TS_ASSERT_THROWS(spectrumInfo.signedTwoTheta(4), const std::logic_error &); } void test_grouped_signedTwoTheta() { @@ -427,16 +427,16 @@ public: void test_no_detector() { const auto &spectrumInfo = m_workspaceNoInstrument.spectrumInfo(); TS_ASSERT_THROWS(spectrumInfo.detector(0), - Kernel::Exception::NotFoundError); + const Kernel::Exception::NotFoundError &); } void test_no_detector_twice() { // Regression test: Make sure that *repeated* access also fails. const auto &spectrumInfo = m_workspaceNoInstrument.spectrumInfo(); TS_ASSERT_THROWS(spectrumInfo.detector(0), - Kernel::Exception::NotFoundError); + const Kernel::Exception::NotFoundError &); TS_ASSERT_THROWS(spectrumInfo.detector(0), - Kernel::Exception::NotFoundError); + const Kernel::Exception::NotFoundError &); } void test_ExperimentInfo_basics() { @@ -487,7 +487,7 @@ public: // needs to be able to rely on this. det2group_map mapping{{1, {1, 2}}}; TS_ASSERT_THROWS(m_workspace.cacheDetectorGroupings(mapping), - std::runtime_error); + const std::runtime_error &); } /** diff --git a/Framework/API/test/TempFunctionTest.h b/Framework/API/test/TempFunctionTest.h index 5a2b7cb438b..8432d1c096c 100644 --- a/Framework/API/test/TempFunctionTest.h +++ b/Framework/API/test/TempFunctionTest.h @@ -75,8 +75,10 @@ public: } void test_domain_create() { - TS_ASSERT_THROWS(Mantid::API::FunctionDomain d(0), std::invalid_argument); - TS_ASSERT_THROWS(Mantid::API::FunctionDomain d(-10), std::length_error); + TS_ASSERT_THROWS(Mantid::API::FunctionDomain d(0), + const std::invalid_argument &); + TS_ASSERT_THROWS(Mantid::API::FunctionDomain d(-10), + const std::length_error &); TS_ASSERT_THROWS_NOTHING(Mantid::API::FunctionDomain d(1)); } }; diff --git a/Framework/API/test/TextAxisTest.h b/Framework/API/test/TextAxisTest.h index deeaf162fd4..b32810b03dd 100644 --- a/Framework/API/test/TextAxisTest.h +++ b/Framework/API/test/TextAxisTest.h @@ -28,7 +28,7 @@ public: TS_ASSERT_EQUALS(ta.length(), 3); TS_ASSERT(ta.unit()); TS_ASSERT_EQUALS(ta(0), Mantid::EMPTY_DBL()); - TS_ASSERT_THROWS(ta.setValue(0, 10.), std::domain_error); + TS_ASSERT_THROWS(ta.setValue(0, 10.), const std::domain_error &); TS_ASSERT(ta.isText()); } diff --git a/Framework/API/test/VectorParameterParserTest.h b/Framework/API/test/VectorParameterParserTest.h index 57d0d709edc..4add39bd70a 100644 --- a/Framework/API/test/VectorParameterParserTest.h +++ b/Framework/API/test/VectorParameterParserTest.h @@ -96,7 +96,7 @@ public: ConcreteVectorDblParamParser parser; TSM_ASSERT_THROWS("No successor, so should throw!", - parser.createParameter(pRootElem), std::runtime_error); + parser.createParameter(pRootElem), const std::runtime_error &); } DECLARE_VECTOR_PARAMETER(SucessorVectorParameter, double) @@ -161,7 +161,7 @@ public: ConcreteVectorBoolParamParser parser; TSM_ASSERT_THROWS("Should throw since delegation is not possible.", parser.createWithoutDelegation(pRootElem), - std::runtime_error); + const std::runtime_error &); } void testCreateWithoutDelegation() { diff --git a/Framework/API/test/VectorParameterTest.h b/Framework/API/test/VectorParameterTest.h index d2165ec7f0a..b237a50e207 100644 --- a/Framework/API/test/VectorParameterTest.h +++ b/Framework/API/test/VectorParameterTest.h @@ -89,7 +89,7 @@ public: void testToXMLStringThrows() { ConcreteVectorDblParam param; TSM_ASSERT_THROWS("Should throw if trying to serialize and invalid object", - param.toXMLString(), std::runtime_error); + param.toXMLString(), const std::runtime_error &); } void testToXMLString() { diff --git a/Framework/API/test/WorkspaceFactoryTest.h b/Framework/API/test/WorkspaceFactoryTest.h index 608bef6e126..5bf6bb37c2f 100644 --- a/Framework/API/test/WorkspaceFactoryTest.h +++ b/Framework/API/test/WorkspaceFactoryTest.h @@ -126,7 +126,7 @@ public: MatrixWorkspace_sptr nif(new NotInFactory); nif->initialize(1, 1, 1); TS_ASSERT_THROWS(child = WorkspaceFactory::Instance().create(nif), - std::runtime_error); + const std::runtime_error &); } void testAccordingToSize() { @@ -145,10 +145,10 @@ public: TS_ASSERT_THROWS( WorkspaceFactory::Instance().create("NotInFactory", 1, 1, 1), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( WorkspaceFactory::Instance().create("NotInFactory", 10, 10, 10), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/API/test/WorkspaceGroupTest.h b/Framework/API/test/WorkspaceGroupTest.h index 7ac691e210c..058a8062e1f 100644 --- a/Framework/API/test/WorkspaceGroupTest.h +++ b/Framework/API/test/WorkspaceGroupTest.h @@ -133,7 +133,7 @@ public: TS_ASSERT(group->contains("ws0")); // cannot add a workspace which doesn't exist TS_ASSERT_THROWS(group->add("noworkspace"), - Kernel::Exception::NotFoundError); + const Kernel::Exception::NotFoundError &); AnalysisDataService::Instance().clear(); } @@ -206,8 +206,8 @@ public: Workspace_sptr ws11 = group->getItem("ws1"); TS_ASSERT_EQUALS(ws1, ws11); // Test for failure too - TS_ASSERT_THROWS(group->getItem("non-existent"), std::out_of_range); - TS_ASSERT_THROWS(group->getItem(""), std::out_of_range); + TS_ASSERT_THROWS(group->getItem("non-existent"), const std::out_of_range &); + TS_ASSERT_THROWS(group->getItem(""), const std::out_of_range &); AnalysisDataService::Instance().clear(); } @@ -222,7 +222,7 @@ public: void test_removeItem() { WorkspaceGroup_sptr group1 = makeGroup(); - TS_ASSERT_THROWS(group1->removeItem(1), std::runtime_error); + TS_ASSERT_THROWS(group1->removeItem(1), const std::runtime_error &); WorkspaceGroup_sptr group(new WorkspaceGroup()); Workspace_sptr ws1(new WorkspaceTester()); @@ -373,7 +373,7 @@ public: // catch a cycle group1->addWorkspace(group); Workspace_sptr b = boost::make_shared<WorkspaceTester>(); - TS_ASSERT_THROWS(group->isInGroup(*b), std::runtime_error); + TS_ASSERT_THROWS(group->isInGroup(*b), const std::runtime_error &); group1->removeAll(); } diff --git a/Framework/API/test/WorkspaceHistoryTest.h b/Framework/API/test/WorkspaceHistoryTest.h index f56b2a1d376..1b7c732c753 100644 --- a/Framework/API/test/WorkspaceHistoryTest.h +++ b/Framework/API/test/WorkspaceHistoryTest.h @@ -133,8 +133,8 @@ public: void test_Empty_History_Throws_When_Retrieving_Attempting_To_Algorithms() { WorkspaceHistory emptyHistory; - TS_ASSERT_THROWS(emptyHistory.lastAlgorithm(), std::out_of_range); - TS_ASSERT_THROWS(emptyHistory.getAlgorithm(1), std::out_of_range); + TS_ASSERT_THROWS(emptyHistory.lastAlgorithm(), const std::out_of_range &); + TS_ASSERT_THROWS(emptyHistory.getAlgorithm(1), const std::out_of_range &); } }; diff --git a/Framework/API/test/WorkspaceOpOverloadsTest.h b/Framework/API/test/WorkspaceOpOverloadsTest.h index 23dfb89bb9c..da551009eb8 100644 --- a/Framework/API/test/WorkspaceOpOverloadsTest.h +++ b/Framework/API/test/WorkspaceOpOverloadsTest.h @@ -170,7 +170,7 @@ public: TS_ASSERT(!ws->isDistribution()); TS_ASSERT_THROWS(WorkspaceHelpers::makeDistribution(ws), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/API/test/WorkspacePropertyTest.h b/Framework/API/test/WorkspacePropertyTest.h index a14ec471370..5e53ae3b7c9 100644 --- a/Framework/API/test/WorkspacePropertyTest.h +++ b/Framework/API/test/WorkspacePropertyTest.h @@ -77,7 +77,7 @@ public: void testConstructor() { TS_ASSERT_THROWS(WorkspaceProperty<Workspace>("test", "", 3), - std::out_of_range) + const std::out_of_range &) } void testValue() { @@ -296,7 +296,7 @@ public: // Since no workspace has been assigned to this output property, it should // throw - TS_ASSERT_THROWS(wsp2->store(), std::runtime_error) + TS_ASSERT_THROWS(wsp2->store(), const std::runtime_error &) // So now create and assign the workspace and test again Workspace_sptr space; TS_ASSERT_THROWS_NOTHING(space = WorkspaceFactory::Instance().create( diff --git a/Framework/Algorithms/src/MergeRuns.cpp b/Framework/Algorithms/src/MergeRuns.cpp index 4c3d1183a4d..6930ab79403 100644 --- a/Framework/Algorithms/src/MergeRuns.cpp +++ b/Framework/Algorithms/src/MergeRuns.cpp @@ -612,7 +612,7 @@ void MergeRuns::intersectionParams(const HistogramX &X1, size_t &i, } auto const overlapbins2 = std::distance(X2.cbegin(), iterX2); // We want to use whichever one has the larger bins (on average) - if (static_cast<decltype(overlapbins2)>(overlapbins1) < overlapbins2) { + if (overlapbins1 < static_cast<size_t>(overlapbins2)) { // In this case we want the rest of the bins from the first workspace..... for (; i < X1.size(); ++i) { params.emplace_back(X1[i] - X1[i - 1]); diff --git a/Framework/Algorithms/src/RadiusSum.cpp b/Framework/Algorithms/src/RadiusSum.cpp index bee835c8e59..662f77a851c 100644 --- a/Framework/Algorithms/src/RadiusSum.cpp +++ b/Framework/Algorithms/src/RadiusSum.cpp @@ -291,8 +291,8 @@ std::vector<double> RadiusSum::getBoundariesOfInputWorkspace() { * * It is important that the input workspace must be a numeric image, and not an *instrument related workspace. - * The function will raise exception (std::invalid_argument) if an invalid - *input is give. + * The function will raise exception (std::const invalid_argument &) if an + *invalid input is give. * * @see RadiusSum::inputWorkspaceHasInstrumentAssociated for reference. * @@ -474,9 +474,8 @@ RadiusSum::getBoundariesOfInstrument(API::MatrixWorkspace_sptr inWS) { * * It will test that all the values of the centre is inside their respective *dominium. - * If the test fails, it will raise an exception (invalid_argument) to express - *that - * the given centre is not inside the boundaries. + * If the test fails, it will raise an exception (const invalid_argument &) to + *express that the given centre is not inside the boundaries. */ void RadiusSum::centerIsInsideLimits(const std::vector<double> ¢re, const std::vector<double> &boundaries) { diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp index 27a808ddc80..4532bca3e76 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp @@ -1117,7 +1117,7 @@ MatrixWorkspace_sptr ReflectometryReductionOneAuto2::getFloodWorkspace() { // If the first part is a number treat all parts as run numbers boost::lexical_cast<size_t>(parts.front()); fileName = instrument->getName() + Strings::toString(parts); - } catch (boost::bad_lexical_cast) { + } catch (const boost::bad_lexical_cast &) { // Do nothing fileName == floodRunParam } auto alg = createChildAlgorithm("CreateFloodWorkspace"); diff --git a/Framework/Algorithms/test/AddNoteTest.h b/Framework/Algorithms/test/AddNoteTest.h index 0dae3dddfdb..258f2bad304 100644 --- a/Framework/Algorithms/test/AddNoteTest.h +++ b/Framework/Algorithms/test/AddNoteTest.h @@ -55,14 +55,14 @@ public: Mantid::Algorithms::AddNote alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("Name", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("Name", ""), const std::invalid_argument &); } void test_empty_value_not_allowed() { Mantid::Algorithms::AddNote alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("Value", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("Value", ""), const std::invalid_argument &); } void test_empty_time_is_allowed() { @@ -77,7 +77,7 @@ public: run.addProperty<std::string>("Test Name", "Test"); TS_ASSERT_THROWS( executeAlgorithm(ws, "Test Name", "2010-09-14T04:20:12", "Test String"), - std::invalid_argument); + const std::invalid_argument &); } void test_Init() { diff --git a/Framework/Algorithms/test/AddTimeSeriesLogTest.h b/Framework/Algorithms/test/AddTimeSeriesLogTest.h index b166efd33f9..194e9feff6a 100644 --- a/Framework/Algorithms/test/AddTimeSeriesLogTest.h +++ b/Framework/Algorithms/test/AddTimeSeriesLogTest.h @@ -81,21 +81,21 @@ public: Mantid::Algorithms::AddTimeSeriesLog alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("Name", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("Name", ""), const std::invalid_argument &); } void test_empty_time_not_allowed() { Mantid::Algorithms::AddTimeSeriesLog alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("Time", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("Time", ""), const std::invalid_argument &); } void test_empty_value_not_allowed() { Mantid::Algorithms::AddTimeSeriesLog alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("Value", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("Value", ""), const std::invalid_argument &); } void test_time_as_non_iso_formatted_string_throws_invalid_argument() { @@ -103,11 +103,11 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("Time", "NotATime"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(alg.setPropertyValue("Time", "2014 03 31 09 30"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(alg.setPropertyValue("Time", "09:30:00"), - std::invalid_argument); + const std::invalid_argument &); } void test_algorithm_fails_if_log_exists_but_is_not_a_time_series() { @@ -116,7 +116,7 @@ public: run.addProperty<double>("Test Name", 1.0); TS_ASSERT_THROWS( executeAlgorithm(ws, "Test Name", "2010-09-14T04:20:12", 20.0), - std::invalid_argument); + const std::invalid_argument &); } void test_algorithm_fails_if_time_series_exists_but_it_is_incorrect_type() { @@ -128,7 +128,7 @@ public: run.addLogData(timeSeries); TS_ASSERT_THROWS( executeAlgorithm(ws, logName, "2010-09-14T04:20:30", 30, Integer), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/Algorithms/test/AlignDetectorsTest.h b/Framework/Algorithms/test/AlignDetectorsTest.h index c59a8bc8bd0..f99881cac50 100644 --- a/Framework/Algorithms/test/AlignDetectorsTest.h +++ b/Framework/Algorithms/test/AlignDetectorsTest.h @@ -58,7 +58,7 @@ public: if (!align.isInitialized()) align.initialize(); - TS_ASSERT_THROWS(align.execute(), std::runtime_error); + TS_ASSERT_THROWS(align.execute(), const std::runtime_error &); align.setPropertyValue("InputWorkspace", inputWS); const std::string outputWS = "aligned"; diff --git a/Framework/Algorithms/test/AnnularRingAbsorptionTest.h b/Framework/Algorithms/test/AnnularRingAbsorptionTest.h index dba06073027..e510cbe69a2 100644 --- a/Framework/Algorithms/test/AnnularRingAbsorptionTest.h +++ b/Framework/Algorithms/test/AnnularRingAbsorptionTest.h @@ -67,7 +67,7 @@ public: TS_ASSERT_THROWS( alg->setProperty<MatrixWorkspace_sptr>("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void test_Workspace_With_Units_Not_In_Wavelength_Is_Not_Accepted() { @@ -80,7 +80,7 @@ public: TS_ASSERT_THROWS( alg->setProperty<MatrixWorkspace_sptr>("InputWorkspace", inputWS), - std::invalid_argument); + const std::invalid_argument &); } void test_Invalid_Sample_Material_Throws_Error() { @@ -91,7 +91,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg->setProperty("InputWorkspace", inputWS)); TS_ASSERT_THROWS_NOTHING(alg->setProperty("SampleChemicalFormula", "A-lO")); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); TS_ASSERT(!alg->isExecuted()); } diff --git a/Framework/Algorithms/test/AnyShapeAbsorptionTest.h b/Framework/Algorithms/test/AnyShapeAbsorptionTest.h index 3dca7b1cc10..d6cc1e4fde5 100644 --- a/Framework/Algorithms/test/AnyShapeAbsorptionTest.h +++ b/Framework/Algorithms/test/AnyShapeAbsorptionTest.h @@ -245,7 +245,7 @@ public: TS_ASSERT_THROWS_NOTHING( atten.setPropertyValue("SampleNumberDensity", "0.07192")); atten.setRethrows(true); // needed for the next check to work - TS_ASSERT_THROWS(atten.execute(), std::runtime_error); + TS_ASSERT_THROWS(atten.execute(), const std::runtime_error &); TS_ASSERT(!atten.isExecuted()); AnalysisDataService::Instance().remove(flatWS); @@ -317,7 +317,7 @@ public: absAlg.setPropertyValue("OutputWorkspace", ENV_WS); absAlg.setProperty("ScatterFrom", "Environment"); absAlg.setProperty("EMode", "Elastic"); - TS_ASSERT_THROWS(absAlg.execute(), std::runtime_error); + TS_ASSERT_THROWS(absAlg.execute(), const std::runtime_error &); // verify the sample term is bigger than the container term because the // material contains Li7 diff --git a/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h b/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h index 4f643dcbf5b..953ecd5e73e 100644 --- a/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h +++ b/Framework/Algorithms/test/Bin2DPowderDiffractionTest.h @@ -229,7 +229,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("dPerpendicularBinning", "1,2,5")); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("NormalizeByBinArea", "0")); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/Algorithms/test/BinaryOperationTest.h b/Framework/Algorithms/test/BinaryOperationTest.h index 44a13b341f0..b9014a07ba9 100644 --- a/Framework/Algorithms/test/BinaryOperationTest.h +++ b/Framework/Algorithms/test/BinaryOperationTest.h @@ -306,7 +306,7 @@ public: if (expect_throw) { TS_ASSERT_THROWS( table = BinaryOperation::buildBinaryOperationTable(lhsWS, rhsWS), - std::runtime_error); + const std::runtime_error &); } else { TS_ASSERT_THROWS_NOTHING( table = BinaryOperation::buildBinaryOperationTable(lhsWS, rhsWS)); diff --git a/Framework/Algorithms/test/CalculateIqtTest.h b/Framework/Algorithms/test/CalculateIqtTest.h index 75c03b2a811..f4ff102d724 100644 --- a/Framework/Algorithms/test/CalculateIqtTest.h +++ b/Framework/Algorithms/test/CalculateIqtTest.h @@ -123,7 +123,7 @@ public: auto energyMax = -1; // invalid - less than energyMin auto algorithm = calculateIqtAlgorithm( m_sampleWorkspace, m_resolutionWorkspace, energyMin, energyMax); - TS_ASSERT_THROWS(algorithm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algorithm->execute(), const std::runtime_error &); TS_ASSERT(!algorithm->isExecuted()); } @@ -132,7 +132,7 @@ public: TS_ASSERT_THROWS(calculateIqtAlgorithm(m_sampleWorkspace, m_resolutionWorkspace, -0.5, 0.5, 0.1, nIterations), - std::invalid_argument); + const std::invalid_argument &); } void test_throws_if_number_of_iterations_is_zero() { @@ -140,7 +140,7 @@ public: TS_ASSERT_THROWS(calculateIqtAlgorithm(m_sampleWorkspace, m_resolutionWorkspace, -0.5, 0.5, 0.1, nIterations), - std::invalid_argument); + const std::invalid_argument &); } // void test_throws_if_number_of_iterations_is_not_an_integer() { @@ -148,7 +148,7 @@ public: // TS_ASSERT_THROWS(calculateIqtAlgorithm(m_sampleWorkspace, // m_resolutionWorkspace, -0.5, 0.5, // 0.1, nIterations), - // std::invalid_argument); + // const std::invalid_argument &); //} }; #endif diff --git a/Framework/Algorithms/test/ConjoinWorkspacesTest.h b/Framework/Algorithms/test/ConjoinWorkspacesTest.h index 50593ac02a5..0027cfd16fb 100644 --- a/Framework/Algorithms/test/ConjoinWorkspacesTest.h +++ b/Framework/Algorithms/test/ConjoinWorkspacesTest.h @@ -98,7 +98,7 @@ public: in2->mutableSpectrumInfo().setMasked(maskBottom, true); // Check it fails if properties haven't been set - TS_ASSERT_THROWS(conj.execute(), std::runtime_error); + TS_ASSERT_THROWS(conj.execute(), const std::runtime_error &); TS_ASSERT(!conj.isExecuted()); // Check it fails if input overlap @@ -136,7 +136,7 @@ public: // Check that 2nd input workspace no longer exists TS_ASSERT_THROWS(AnalysisDataService::Instance().retrieve("bottom"), - Exception::NotFoundError); + const Exception::NotFoundError &); // Check that th workspace has the correct number of history entries TS_ASSERT_EQUALS(output->getHistory().size(), 3); @@ -176,7 +176,7 @@ public: conj.setProperty("InputWorkspace1", "testMismatchedEventWorkspace1"); conj.setProperty("InputWorkspace2", "testMismatchedEventWorkspace2"); - TS_ASSERT_THROWS(conj.execute(), std::invalid_argument); + TS_ASSERT_THROWS(conj.execute(), const std::invalid_argument &); TS_ASSERT(!conj.isExecuted()); } diff --git a/Framework/Algorithms/test/ConjoinXRunsTest.h b/Framework/Algorithms/test/ConjoinXRunsTest.h index 836e6983168..bbb091e64a7 100644 --- a/Framework/Algorithms/test/ConjoinXRunsTest.h +++ b/Framework/Algorithms/test/ConjoinXRunsTest.h @@ -163,7 +163,7 @@ public: m_testee.setProperty("InputWorkspaces", std::vector<std::string>{"ws1", "ws5"}); - TS_ASSERT_THROWS(m_testee.execute(), std::runtime_error); + TS_ASSERT_THROWS(m_testee.execute(), const std::runtime_error &); } void testPassDifferentAxes() { @@ -220,7 +220,7 @@ public: m_testee.setProperty("SampleLogAsXAxis", "TestNumLog"); // blocksize must be one in case of scalar log, fail - TS_ASSERT_THROWS(m_testee.execute(), std::runtime_error); + TS_ASSERT_THROWS(m_testee.execute(), const std::runtime_error &); } void testPassWithNumLog() { @@ -275,7 +275,7 @@ public: m_testee.setProperty("SampleLogAsXAxis", "TestStrLog"); // string log not supported, fail - TS_ASSERT_THROWS(m_testee.execute(), std::runtime_error); + TS_ASSERT_THROWS(m_testee.execute(), const std::runtime_error &); } void testPassWithNumSeriesLog() { @@ -347,7 +347,7 @@ public: std::vector<std::string>{"ws1", "ws2"}); // ws1 has 3 bins, ws2 has 2, fail - TS_ASSERT_THROWS(m_testee.execute(), std::runtime_error); + TS_ASSERT_THROWS(m_testee.execute(), const std::runtime_error &); } void testMergeSampleLogFail() { @@ -371,7 +371,7 @@ public: m_testee.setProperty("InputWorkspaces", std::vector<std::string>{"ws1", "ws2"}); - TS_ASSERT_THROWS(m_testee.execute(), std::runtime_error); + TS_ASSERT_THROWS(m_testee.execute(), const std::runtime_error &); } private: diff --git a/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h b/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h index 1b51250300c..9c1fc1e696c 100644 --- a/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h +++ b/Framework/Algorithms/test/ConvertSpectrumAxis2Test.h @@ -59,7 +59,8 @@ private: TS_ASSERT(thetaAxis->isNumeric()); // Check axis is correct length for the workspaces. - TS_ASSERT_THROWS((*thetaAxis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*thetaAxis)(3), + const Mantid::Kernel::Exception::IndexError &); // Check the outputs for the workspaces are correct. TS_ASSERT_EQUALS(thetaAxis->unit()->caption(), "Scattering angle"); @@ -97,7 +98,8 @@ private: TS_ASSERT_EQUALS(input->e(1), output->e(1)); // Check workspace axes are of correct length. - TS_ASSERT_THROWS((*thetaAxis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*thetaAxis)(3), + const Mantid::Kernel::Exception::IndexError &); } void clean_up_workspaces(const std::string inputWS, @@ -195,7 +197,7 @@ public: conv.setPropertyValue("OutputWorkspace", outputWS)); TS_ASSERT_THROWS_NOTHING(conv.setPropertyValue("Target", target)); - TS_ASSERT_THROWS(conv.execute(), std::invalid_argument); + TS_ASSERT_THROWS(conv.execute(), const std::invalid_argument &); TS_ASSERT(!conv.isExecuted()); // Clean up workspaces. @@ -228,7 +230,8 @@ public: TS_ASSERT_DELTA((*qAxis)(2), 0.0878, 1.0000e-4); // Check axis is correct length - TS_ASSERT_THROWS((*qAxis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*qAxis)(3), + const Mantid::Kernel::Exception::IndexError &); TS_ASSERT_EQUALS(input->x(0), output->x(0)); TS_ASSERT_EQUALS(input->y(0), output->y(0)); @@ -270,7 +273,8 @@ public: TS_ASSERT_DELTA((*qAxis)(2), 2 * M_PI / DBL_MIN, 1e-10); // Check axis is correct length - TS_ASSERT_THROWS((*qAxis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*qAxis)(3), + const Mantid::Kernel::Exception::IndexError &); TS_ASSERT_EQUALS(input->x(0), output->x(0)); TS_ASSERT_EQUALS(input->y(0), output->y(0)); @@ -312,7 +316,8 @@ public: TS_ASSERT_DELTA((*q2Axis)(2), 0.00771, 1.0000e-5); // Check axis is correct length - TS_ASSERT_THROWS((*q2Axis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*q2Axis)(3), + const Mantid::Kernel::Exception::IndexError &); TS_ASSERT_EQUALS(input->x(0), output->x(0)); TS_ASSERT_EQUALS(input->y(0), output->y(0)); @@ -374,7 +379,8 @@ public: TS_ASSERT_DELTA((*qAxis)(2), 0.0439, 1.0000e-4); // Check axis is of correct length. - TS_ASSERT_THROWS((*qAxis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*qAxis)(3), + const Mantid::Kernel::Exception::IndexError &); // Clean up workspaces. clean_up_workspaces(inputWS, outputWS); @@ -428,7 +434,8 @@ public: TS_ASSERT_DELTA((*qAxis)(2), 0.004393, 1.0000e-6); // Check axis is of correct length. - TS_ASSERT_THROWS((*qAxis)(3), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*qAxis)(3), + const Mantid::Kernel::Exception::IndexError &); TS_ASSERT(conv.isExecuted()); diff --git a/Framework/Algorithms/test/ConvertSpectrumAxisTest.h b/Framework/Algorithms/test/ConvertSpectrumAxisTest.h index a0a8930891d..e948021f956 100644 --- a/Framework/Algorithms/test/ConvertSpectrumAxisTest.h +++ b/Framework/Algorithms/test/ConvertSpectrumAxisTest.h @@ -83,7 +83,8 @@ public: TS_ASSERT_DELTA((*thetaAxis)(0), 6.0883, 0.0001); TS_ASSERT_DELTA((*thetaAxis)(1), 180.0, 0.0001); // Check axis is correct length - TS_ASSERT_THROWS((*thetaAxis)(2), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*thetaAxis)(2), + const Mantid::Kernel::Exception::IndexError &); // Data should be swapped over TS_ASSERT_EQUALS(input->x(0), output->x(1)); @@ -142,7 +143,7 @@ public: TS_ASSERT_THROWS_NOTHING(conv.setPropertyValue("Target", "DeltaE")); TS_ASSERT_THROWS_NOTHING(conv.setPropertyValue("EMode", "Indirect")); conv.setRethrows(true); - TS_ASSERT_THROWS(conv.execute(), std::logic_error); + TS_ASSERT_THROWS(conv.execute(), const std::logic_error &); TS_ASSERT_THROWS_NOTHING(conv.setPropertyValue("Efixed", "1.845")); TS_ASSERT_THROWS_NOTHING(conv.execute()); @@ -166,7 +167,8 @@ public: TS_ASSERT_DELTA((*thetaAxis)(0), 0.00311225, 1e-08); TS_ASSERT_DELTA((*thetaAxis)(1), 0.00311225, 1e-08); // Check axis is correct length - TS_ASSERT_THROWS((*thetaAxis)(2), Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS((*thetaAxis)(2), + const Mantid::Kernel::Exception::IndexError &); AnalysisDataService::Instance().remove(inputWS); AnalysisDataService::Instance().remove(outputWS); diff --git a/Framework/Algorithms/test/ConvertTableToMatrixWorkspaceTest.h b/Framework/Algorithms/test/ConvertTableToMatrixWorkspaceTest.h index 685af86ab51..f8080359c44 100644 --- a/Framework/Algorithms/test/ConvertTableToMatrixWorkspaceTest.h +++ b/Framework/Algorithms/test/ConvertTableToMatrixWorkspaceTest.h @@ -127,7 +127,7 @@ public: } void test_fail_on_empty_table() { - TS_ASSERT_THROWS(m_converter->execute(), std::runtime_error); + TS_ASSERT_THROWS(m_converter->execute(), const std::runtime_error &); } void setUp() override { @@ -224,7 +224,7 @@ public: TS_ASSERT_THROWS_NOTHING(m_converter->setPropertyValue("ColumnY", "B")); TS_ASSERT_THROWS_NOTHING(m_converter->setPropertyValue("ColumnE", "C")); - TS_ASSERT_THROWS(m_converter->execute(), std::invalid_argument); + TS_ASSERT_THROWS(m_converter->execute(), const std::invalid_argument &); API::AnalysisDataService::Instance().remove("out"); } diff --git a/Framework/Algorithms/test/CopyDataRangeTest.h b/Framework/Algorithms/test/CopyDataRangeTest.h index 54eb36720df..4d9b1d221c5 100644 --- a/Framework/Algorithms/test/CopyDataRangeTest.h +++ b/Framework/Algorithms/test/CopyDataRangeTest.h @@ -221,35 +221,35 @@ public: test_that_the_algorithm_throws_when_provided_a_StartWorkspaceIndex_which_is_larger_than_the_EndWorkspaceIndex() { auto algorithm = setUpAlgorithm(INPUT_NAME, DESTINATION_NAME, 2, 1, 2.1, 2.4, 0, 0, OUTPUT_NAME); - TS_ASSERT_THROWS(algorithm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algorithm->execute(), const std::runtime_error &); } void test_that_the_algorithm_throws_when_provided_an_EndWorkspaceIndex_which_is_larger_than_the_number_of_histograms_in_the_input_workspace() { auto algorithm = setUpAlgorithm(INPUT_NAME, DESTINATION_NAME, 0, 5, 2.1, 2.4, 0, 0, OUTPUT_NAME); - TS_ASSERT_THROWS(algorithm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algorithm->execute(), const std::runtime_error &); } void test_that_the_algorithm_throws_when_provided_a_xMin_which_comes_later_on_than_larger_than_xMax() { auto algorithm = setUpAlgorithm(INPUT_NAME, DESTINATION_NAME, 0, 3, 2.4, 2.1, 0, 0, OUTPUT_NAME); - TS_ASSERT_THROWS(algorithm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algorithm->execute(), const std::runtime_error &); } void test_that_the_algorithm_throws_when_provided_a_block_of_data_which_will_not_fit_in_the_destination_workspace_in_the_y_direction() { auto algorithm = setUpAlgorithm(INPUT_NAME, DESTINATION_NAME, 0, 3, 2.1, 2.4, 4, 0, OUTPUT_NAME); - TS_ASSERT_THROWS(algorithm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algorithm->execute(), const std::runtime_error &); } void test_that_the_algorithm_throws_when_provided_a_block_of_data_which_will_not_fit_in_the_destination_workspace_in_the_x_direction() { auto algorithm = setUpAlgorithm(INPUT_NAME, DESTINATION_NAME, 0, 3, 2.1, 2.4, 0, 4, OUTPUT_NAME); - TS_ASSERT_THROWS(algorithm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algorithm->execute(), const std::runtime_error &); } private: diff --git a/Framework/Algorithms/test/CorrectToFileTest.h b/Framework/Algorithms/test/CorrectToFileTest.h index b4c79845846..bb0b845ed0b 100644 --- a/Framework/Algorithms/test/CorrectToFileTest.h +++ b/Framework/Algorithms/test/CorrectToFileTest.h @@ -152,7 +152,7 @@ public: correctToFile.initialize(); // Executing now should throw since none of the properties have been set - TS_ASSERT_THROWS(correctToFile.execute(), std::runtime_error); + TS_ASSERT_THROWS(correctToFile.execute(), const std::runtime_error &); // Register this with the service using namespace Mantid::API; diff --git a/Framework/Algorithms/test/CreateLogTimeCorrectionTest.h b/Framework/Algorithms/test/CreateLogTimeCorrectionTest.h index 5231504689c..8bd7cd90b2a 100644 --- a/Framework/Algorithms/test/CreateLogTimeCorrectionTest.h +++ b/Framework/Algorithms/test/CreateLogTimeCorrectionTest.h @@ -155,7 +155,7 @@ public: TS_ASSERT(alg.isInitialized()); TS_ASSERT_THROWS(alg.setProperty("InputWorkspace", inpws), - std::invalid_argument); + const std::invalid_argument &); } void test_not_allowed_output_workspace_same_as_input() { diff --git a/Framework/Algorithms/test/CreatePSDBleedMaskTest.h b/Framework/Algorithms/test/CreatePSDBleedMaskTest.h index 2ebd43335f5..0796f6d2302 100644 --- a/Framework/Algorithms/test/CreatePSDBleedMaskTest.h +++ b/Framework/Algorithms/test/CreatePSDBleedMaskTest.h @@ -58,7 +58,7 @@ public: // First test that a workspace not containing the number of good frames // fails - TS_ASSERT_THROWS(diagnostic.execute(), std::invalid_argument); + TS_ASSERT_THROWS(diagnostic.execute(), const std::invalid_argument &); // Set the number of frames testWS->mutableRun().addProperty("goodfrm", 10); diff --git a/Framework/Algorithms/test/CreateSingleValuedWorkspaceTest.h b/Framework/Algorithms/test/CreateSingleValuedWorkspaceTest.h index aab0bbfa263..dea56ace5cc 100644 --- a/Framework/Algorithms/test/CreateSingleValuedWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateSingleValuedWorkspaceTest.h @@ -26,7 +26,7 @@ public: // First with no Error // Running algorithm here should throw - TS_ASSERT_THROWS(algNoErr.execute(), std::runtime_error); + TS_ASSERT_THROWS(algNoErr.execute(), const std::runtime_error &); // Set some properties std::string outputSpace("NoError"); @@ -66,7 +66,7 @@ public: // First with no Error // Running algorithm here should throw - TS_ASSERT_THROWS(algWithErr.execute(), std::runtime_error); + TS_ASSERT_THROWS(algWithErr.execute(), const std::runtime_error &); // Set some properties std::string outputSpace("WithError"); diff --git a/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h b/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h index 570199c45d6..28045bbb762 100644 --- a/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateTransmissionWorkspaceTest.h @@ -95,13 +95,13 @@ public: void test_check_first_transmission_workspace_not_tof_or_wavelength_throws() { auto alg = construct_standard_algorithm(); TS_ASSERT_THROWS(alg->setProperty("FirstTransmissionRun", m_NotTOF), - std::invalid_argument); + const std::invalid_argument &); } void test_check_second_transmission_workspace_not_tof_throws() { auto alg = construct_standard_algorithm(); TS_ASSERT_THROWS(alg->setProperty("SecondTransmissionRun", m_NotTOF), - std::invalid_argument); + const std::invalid_argument &); } void test_end_overlap_must_be_greater_than_start_overlap_or_throw() { @@ -112,7 +112,7 @@ public: alg->setProperty("Params", params); alg->setProperty("StartOverlap", 0.6); alg->setProperty("EndOverlap", 0.4); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_must_provide_wavelengths() { @@ -124,20 +124,20 @@ public: alg->setProperty("SecondTransmissionRun", m_TOF); alg->setPropertyValue("OutputWorkspace", "demo_ws"); alg->setRethrows(true); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); alg->setProperty("FirstTransmissionRun", m_TOF); alg->setProperty("SecondTransmissionRun", m_TOF); alg->setProperty("WavelengthMin", 1.0); alg->setRethrows(true); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_wavelength_min_greater_wavelength_max_throws() { auto alg = construct_standard_algorithm(); alg->setProperty("WavelengthMin", 1.0); alg->setProperty("WavelengthMax", 0.0); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void @@ -145,7 +145,7 @@ public: auto alg = construct_standard_algorithm(); alg->setProperty("MonitorBackgroundWavelengthMin", 1.0); alg->setProperty("MonitorBackgroundWavelengthMax", 0.0); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void @@ -153,7 +153,7 @@ public: auto alg = construct_standard_algorithm(); alg->setProperty("MonitorIntegrationWavelengthMin", 1.0); alg->setProperty("MonitorIntegrationWavelengthMax", 0.0); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_execute_one_tranmission() { diff --git a/Framework/Algorithms/test/CreateWorkspaceTest.h b/Framework/Algorithms/test/CreateWorkspaceTest.h index 3aa804fd1b9..a52d8565ae7 100644 --- a/Framework/Algorithms/test/CreateWorkspaceTest.h +++ b/Framework/Algorithms/test/CreateWorkspaceTest.h @@ -218,7 +218,7 @@ public: alg.setProperty<std::vector<double>>("DataE", values); alg.setProperty<std::vector<double>>("Dx", xVals); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void testParenting() { diff --git a/Framework/Algorithms/test/CropToComponentTest.h b/Framework/Algorithms/test/CropToComponentTest.h index 1933f05d348..10e7e1afb94 100644 --- a/Framework/Algorithms/test/CropToComponentTest.h +++ b/Framework/Algorithms/test/CropToComponentTest.h @@ -161,7 +161,7 @@ public: crop.setProperty("OutputWorkspace", "dummy"); crop.setProperty("ComponentNames", componentNames); TSM_ASSERT_THROWS("Invalid detector names will throw.", crop.execute(), - std::runtime_error) + const std::runtime_error &) } void test_that_det_ids_are_ordered() { diff --git a/Framework/Algorithms/test/CropWorkspaceTest.h b/Framework/Algorithms/test/CropWorkspaceTest.h index 7c403f1a1bc..e0e1ffe7532 100644 --- a/Framework/Algorithms/test/CropWorkspaceTest.h +++ b/Framework/Algorithms/test/CropWorkspaceTest.h @@ -76,7 +76,7 @@ public: if (!crop.isInitialized()) crop.initialize(); - TS_ASSERT_THROWS(crop.execute(), std::runtime_error); + TS_ASSERT_THROWS(crop.execute(), const std::runtime_error &); TS_ASSERT(!crop.isExecuted()); TS_ASSERT_THROWS_NOTHING( crop.setPropertyValue("InputWorkspace", inputName)); diff --git a/Framework/Algorithms/test/CrossCorrelateTest.h b/Framework/Algorithms/test/CrossCorrelateTest.h index f6f479f4879..036b3aa85cf 100644 --- a/Framework/Algorithms/test/CrossCorrelateTest.h +++ b/Framework/Algorithms/test/CrossCorrelateTest.h @@ -178,7 +178,7 @@ private: // Run the algorithm with invalid input and check that it throws a runtime // error void runAlgorithmThrows(CrossCorrelate &alg) { - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } }; diff --git a/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h b/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h index eee67583082..83ae32a2b65 100644 --- a/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h +++ b/Framework/Algorithms/test/CuboidGaugeVolumeAbsorptionTest.h @@ -40,7 +40,7 @@ public: TS_ASSERT_THROWS( atten.setProperty<MatrixWorkspace_sptr>("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void testFailsIfNoSampleShape() { diff --git a/Framework/Algorithms/test/CylinderAbsorptionTest.h b/Framework/Algorithms/test/CylinderAbsorptionTest.h index 056a4965e43..01f68cfdca4 100644 --- a/Framework/Algorithms/test/CylinderAbsorptionTest.h +++ b/Framework/Algorithms/test/CylinderAbsorptionTest.h @@ -65,7 +65,7 @@ public: // intentionally skip the sample information configureAbsCommon(atten, testWS, "factors"); - TS_ASSERT_THROWS(atten.execute(), std::invalid_argument); + TS_ASSERT_THROWS(atten.execute(), const std::invalid_argument &); TS_ASSERT(!atten.isExecuted()); } diff --git a/Framework/Algorithms/test/DeleteLogTest.h b/Framework/Algorithms/test/DeleteLogTest.h index e38df87bab5..3b7337d6a78 100644 --- a/Framework/Algorithms/test/DeleteLogTest.h +++ b/Framework/Algorithms/test/DeleteLogTest.h @@ -79,7 +79,7 @@ public: void test_empty_log_name_throws_invalid_argument() { Mantid::Algorithms::DeleteLog alg; alg.initialize(); - TS_ASSERT_THROWS(alg.setProperty("Name", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("Name", ""), const std::invalid_argument &); } }; diff --git a/Framework/Algorithms/test/DetectorEfficiencyCorTest.h b/Framework/Algorithms/test/DetectorEfficiencyCorTest.h index 7d932a9c0e6..8558531cd33 100644 --- a/Framework/Algorithms/test/DetectorEfficiencyCorTest.h +++ b/Framework/Algorithms/test/DetectorEfficiencyCorTest.h @@ -53,7 +53,7 @@ public: corrector.setProperty("InputWorkspace", dummyWS); corrector.setPropertyValue("OutputWorkspace", "__unused"); - TS_ASSERT_THROWS(corrector.execute(), std::invalid_argument); + TS_ASSERT_THROWS(corrector.execute(), const std::invalid_argument &); } void testDataWithUngroupedDetectors() { diff --git a/Framework/Algorithms/test/ExponentialTest.h b/Framework/Algorithms/test/ExponentialTest.h index 1dc767aa8d0..00579d96b77 100644 --- a/Framework/Algorithms/test/ExponentialTest.h +++ b/Framework/Algorithms/test/ExponentialTest.h @@ -27,7 +27,7 @@ public: TS_ASSERT(alg.isInitialized()) // Setting properties to input workspaces that don't exist throws TS_ASSERT_THROWS(alg.setPropertyValue("InputWorkspace", "test_in21"), - std::invalid_argument) + const std::invalid_argument &) TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", "test_out2")) } diff --git a/Framework/Algorithms/test/ExtractFFTSpectrumTest.h b/Framework/Algorithms/test/ExtractFFTSpectrumTest.h index 66bdd6e3f52..be4ad96dd8c 100644 --- a/Framework/Algorithms/test/ExtractFFTSpectrumTest.h +++ b/Framework/Algorithms/test/ExtractFFTSpectrumTest.h @@ -62,7 +62,7 @@ public: alg.initialize(); TS_ASSERT_THROWS(alg.execute(), - std::runtime_error); // check it does output error + const std::runtime_error &); // check it does output error TS_ASSERT(!alg.isExecuted()); TS_ASSERT_THROWS_NOTHING( diff --git a/Framework/Algorithms/test/FFTTest.h b/Framework/Algorithms/test/FFTTest.h index 8a07e83cde7..85872624394 100644 --- a/Framework/Algorithms/test/FFTTest.h +++ b/Framework/Algorithms/test/FFTTest.h @@ -469,7 +469,7 @@ public: fft->setProperty("InputWorkspace", inputWS); fft->setPropertyValue("OutputWorkspace", "__NotUsed"); fft->setPropertyValue("Real", "0"); - TS_ASSERT_THROWS(fft->execute(), std::runtime_error); + TS_ASSERT_THROWS(fft->execute(), const std::runtime_error &); } // Test that unevenly spaced X values are accepted if the property is set to @@ -500,7 +500,7 @@ public: fft->setProperty("InputWorkspace", inputWS); fft->setPropertyValue("OutputWorkspace", "__NotUsed"); fft->setPropertyValue("Real", "0"); - TS_ASSERT_THROWS(fft->execute(), std::runtime_error); + TS_ASSERT_THROWS(fft->execute(), const std::runtime_error &); } void testRealOutOfRange_Throws() { @@ -511,7 +511,7 @@ public: fft->setProperty("InputWorkspace", inputWS); fft->setPropertyValue("OutputWorkspace", "__NotUsed"); fft->setPropertyValue("Real", "100"); - TS_ASSERT_THROWS(fft->execute(), std::runtime_error); + TS_ASSERT_THROWS(fft->execute(), const std::runtime_error &); } void testImaginaryOutOfRange_Throws() { @@ -523,7 +523,7 @@ public: fft->setPropertyValue("OutputWorkspace", "__NotUsed"); fft->setPropertyValue("Real", "0"); fft->setPropertyValue("Imaginary", "100"); - TS_ASSERT_THROWS(fft->execute(), std::runtime_error); + TS_ASSERT_THROWS(fft->execute(), const std::runtime_error &); } void testRealImaginarySizeMismatch_Throws() { @@ -537,7 +537,7 @@ public: fft->setPropertyValue("Real", "0"); fft->setPropertyValue("Imaginary", "0"); fft->setProperty("InputImagWorkspace", inImagWS); - TS_ASSERT_THROWS(fft->execute(), std::runtime_error); + TS_ASSERT_THROWS(fft->execute(), const std::runtime_error &); } /** diff --git a/Framework/Algorithms/test/FilterByLogValueTest.h b/Framework/Algorithms/test/FilterByLogValueTest.h index ac2c21df7c7..659a0d2b446 100644 --- a/Framework/Algorithms/test/FilterByLogValueTest.h +++ b/Framework/Algorithms/test/FilterByLogValueTest.h @@ -41,23 +41,23 @@ public: TS_ASSERT_THROWS( alg.setProperty("InputWorkspace", WorkspaceCreationHelper::create2DWorkspace(1, 1)), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.setProperty( "InputWorkspace", WorkspaceCreationHelper::createEventWorkspace())); // LogName must not be empty - TS_ASSERT_THROWS(alg.setProperty("LogName", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("LogName", ""), const std::invalid_argument &); // TimeTolerance cannot be negative TS_ASSERT_THROWS(alg.setProperty("TimeTolerance", -0.1), - std::invalid_argument); + const std::invalid_argument &); // ... but it can be zero TS_ASSERT_THROWS_NOTHING(alg.setProperty("TimeTolerance", 0.0)); // LogBoundary must be one of "Centre" and "Left" - TS_ASSERT_THROWS(alg.setProperty("LogBoundary", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("LogBoundary", ""), const std::invalid_argument &); TS_ASSERT_THROWS(alg.setProperty("LogBoundary", "Middle"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.setProperty("LogBoundary", "Left")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("LogBoundary", "Centre")); } diff --git a/Framework/Algorithms/test/FilterByXValueTest.h b/Framework/Algorithms/test/FilterByXValueTest.h index 06c6c430063..873fe854246 100644 --- a/Framework/Algorithms/test/FilterByXValueTest.h +++ b/Framework/Algorithms/test/FilterByXValueTest.h @@ -30,7 +30,7 @@ public: TS_ASSERT_THROWS( alg.setProperty("InputWorkspace", WorkspaceCreationHelper::create2DWorkspace(1, 1)), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.setProperty( "InputWorkspace", WorkspaceCreationHelper::createEventWorkspace())); diff --git a/Framework/Algorithms/test/GenerateEventsFilterTest.h b/Framework/Algorithms/test/GenerateEventsFilterTest.h index 5325e1ffee2..590be04d14f 100644 --- a/Framework/Algorithms/test/GenerateEventsFilterTest.h +++ b/Framework/Algorithms/test/GenerateEventsFilterTest.h @@ -1133,7 +1133,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("UnitOfTime", "Nanoseconds")); // Running and check this throws - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); TS_ASSERT(!alg.isExecuted()); // Clean diff --git a/Framework/Algorithms/test/GetAllEiTest.h b/Framework/Algorithms/test/GetAllEiTest.h index 131f6619a83..83871ee9b5d 100644 --- a/Framework/Algorithms/test/GetAllEiTest.h +++ b/Framework/Algorithms/test/GetAllEiTest.h @@ -182,7 +182,7 @@ public: m_getAllEi.setProperty("OutputWorkspace", "monitor_peaks"); TSM_ASSERT_THROWS( "should throw runtime error on as spectra ID should be positive", - m_getAllEi.setProperty("Monitor1SpecID", -1), std::invalid_argument); + m_getAllEi.setProperty("Monitor1SpecID", -1), const std::invalid_argument &); m_getAllEi.setProperty("Monitor1SpecID", 1); m_getAllEi.setProperty("Monitor2SpecID", 2); @@ -193,7 +193,7 @@ public: TSM_ASSERT_THROWS("should throw runtime error on validation as no " "appropriate logs are defined", - m_getAllEi.execute(), std::runtime_error); + m_getAllEi.execute(), const std::runtime_error &); auto log_messages = m_getAllEi.validateInputs(); TSM_ASSERT_EQUALS("Two logs should fail", log_messages.size(), 2); // add invalid property type @@ -257,7 +257,7 @@ public: // Test sort log by run time. TSM_ASSERT_THROWS( "Attempt to get log without start/stop time set should fail", - m_getAllEi.getAvrgLogValue(ws, "ChopperSpeedLog"), std::runtime_error); + m_getAllEi.getAvrgLogValue(ws, "ChopperSpeedLog"), const std::runtime_error &); ws->mutableRun().setStartAndEndTime(Types::Core::DateAndTime(90, 0), Types::Core::DateAndTime(10000, 0)); @@ -395,7 +395,7 @@ public: TSM_ASSERT_THROWS( "Should throw out of range", m_getAllEi.findGuessOpeningTimes(TOF_range, t0, Period, guess_tof), - std::runtime_error); + const std::runtime_error &); t0 = 1; guess_tof.resize(0); diff --git a/Framework/Algorithms/test/GetEiTest.h b/Framework/Algorithms/test/GetEiTest.h index 54ee6d8df7a..b66aade2897 100644 --- a/Framework/Algorithms/test/GetEiTest.h +++ b/Framework/Algorithms/test/GetEiTest.h @@ -244,7 +244,7 @@ public: alg->setProperty("FixEi", false); alg->setProperty("EnergyEstimate", 15.0); alg->setRethrows(true); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); AnalysisDataService::Instance().remove(outputName); } diff --git a/Framework/Algorithms/test/GetEiV1Test.h b/Framework/Algorithms/test/GetEiV1Test.h index a684ccdb238..c91bd98b2ec 100644 --- a/Framework/Algorithms/test/GetEiV1Test.h +++ b/Framework/Algorithms/test/GetEiV1Test.h @@ -152,7 +152,7 @@ public: alg->setProperty("Monitor2Spec", 2); alg->setProperty("EnergyEstimate", 15.0); alg->setRethrows(true); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); AnalysisDataService::Instance().remove(outputName); } diff --git a/Framework/Algorithms/test/He3TubeEfficiencyTest.h b/Framework/Algorithms/test/He3TubeEfficiencyTest.h index 4923ea183bf..fd00f4d52b7 100644 --- a/Framework/Algorithms/test/He3TubeEfficiencyTest.h +++ b/Framework/Algorithms/test/He3TubeEfficiencyTest.h @@ -27,8 +27,8 @@ using namespace Mantid::DataObjects; using namespace Mantid::DataHandling; using namespace std; using Mantid::HistogramData::BinEdges; -using Mantid::HistogramData::CountStandardDeviations; using Mantid::HistogramData::Counts; +using Mantid::HistogramData::CountStandardDeviations; namespace He3TubeEffeciencyHelper { void createWorkspace2DInADS(const std::string inputWS) { @@ -145,11 +145,11 @@ public: alg.initialize(); TS_ASSERT_THROWS(alg.setPropertyValue("TubePressure", "-10"), - invalid_argument); + const invalid_argument &); TS_ASSERT_THROWS(alg.setPropertyValue("TubeThickness", "-0.08"), - invalid_argument); + const invalid_argument &); TS_ASSERT_THROWS(alg.setPropertyValue("TubeTemperature", "-100"), - invalid_argument); + const invalid_argument &); AnalysisDataService::Instance().remove(inputWS); } diff --git a/Framework/Algorithms/test/IQTransformTest.h b/Framework/Algorithms/test/IQTransformTest.h index 4ba95d2ecaa..939b1129e71 100644 --- a/Framework/Algorithms/test/IQTransformTest.h +++ b/Framework/Algorithms/test/IQTransformTest.h @@ -200,7 +200,7 @@ public: TS_ASSERT_THROWS_NOTHING(iq.setPropertyValue("TransformType", "General")); // Check it fails if constants not set - TS_ASSERT_THROWS(iq.execute(), std::invalid_argument); + TS_ASSERT_THROWS(iq.execute(), const std::invalid_argument &); std::vector<double> constants(10, 2.0); TS_ASSERT_THROWS_NOTHING( diff --git a/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h b/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h index 66b308b3b6a..4709ee0807a 100644 --- a/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h +++ b/Framework/Algorithms/test/IndirectFitDataCreationHelperTest.h @@ -117,7 +117,7 @@ public: test_that_createWorkspaceWithTextAxis_throws_when_the_number_of_spectra_is_not_equal_to_the_number_of_labels() { auto const labels = std::vector<std::string>({"f0.Width", "f1.EISF"}); TS_ASSERT_THROWS(createWorkspaceWithTextAxis(6, labels), - std::runtime_error); + const std::runtime_error &); } void @@ -132,7 +132,7 @@ public: test_that_createWorkspaceWithBinValues_throws_when_the_number_of_bins_is_not_equal_to_the_number_of_labels() { auto const labels = getNumericAxisLabels(); TS_ASSERT_THROWS(createWorkspaceWithBinValues(3, labels, 2), - std::runtime_error); + const std::runtime_error &); } void diff --git a/Framework/Algorithms/test/IntegrationTest.h b/Framework/Algorithms/test/IntegrationTest.h index f79dc05b8e2..c5ba4acf6dc 100644 --- a/Framework/Algorithms/test/IntegrationTest.h +++ b/Framework/Algorithms/test/IntegrationTest.h @@ -130,7 +130,7 @@ public: // Check setting of invalid property value causes failure TS_ASSERT_THROWS(alg.setPropertyValue("StartWorkspaceIndex", "-1"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.execute()); TS_ASSERT(alg.isExecuted()); diff --git a/Framework/Algorithms/test/InterpolatingRebinTest.h b/Framework/Algorithms/test/InterpolatingRebinTest.h index a7ff49055ed..8fa03fc294b 100644 --- a/Framework/Algorithms/test/InterpolatingRebinTest.h +++ b/Framework/Algorithms/test/InterpolatingRebinTest.h @@ -34,7 +34,7 @@ public: rebin.setPropertyValue("InputWorkspace", "InterpolatingRebinTest_indist"); rebin.setPropertyValue("OutputWorkspace", "InterpolatingRebinTest_outdist"); // Check it fails if property not set - TS_ASSERT_THROWS(rebin.execute(), std::runtime_error) + TS_ASSERT_THROWS(rebin.execute(), const std::runtime_error &) TS_ASSERT(!rebin.isExecuted()) // the last bin would are too high to calculate, check it aborts diff --git a/Framework/Algorithms/test/InterpolationOptionTest.h b/Framework/Algorithms/test/InterpolationOptionTest.h index a0cab77e1b4..9f3b2c77fe7 100644 --- a/Framework/Algorithms/test/InterpolationOptionTest.h +++ b/Framework/Algorithms/test/InterpolationOptionTest.h @@ -87,12 +87,12 @@ public: //---------------------------------------------------------------------------- void test_set_From_String_Throws_With_Unknown_Type() { InterpolationOption interpolateOpt; - TS_ASSERT_THROWS(interpolateOpt.set("Unknown"), std::invalid_argument); + TS_ASSERT_THROWS(interpolateOpt.set("Unknown"), const std::invalid_argument &); } void test_set_From_String_Throws_With_Empty_String() { InterpolationOption interpolateOpt; - TS_ASSERT_THROWS(interpolateOpt.set(""), std::invalid_argument); + TS_ASSERT_THROWS(interpolateOpt.set(""), const std::invalid_argument &); } void test_validateInputSize() { diff --git a/Framework/Algorithms/test/MCAbsorptionStrategyTest.h b/Framework/Algorithms/test/MCAbsorptionStrategyTest.h index ecf01e9417a..c23ed83a607 100644 --- a/Framework/Algorithms/test/MCAbsorptionStrategyTest.h +++ b/Framework/Algorithms/test/MCAbsorptionStrategyTest.h @@ -86,7 +86,7 @@ public: const double lambdaBefore(2.5), lambdaAfter(3.5); const V3D endPos(0.7, 0.7, 1.4); TS_ASSERT_THROWS(mcabs.calculate(rng, endPos, lambdaBefore, lambdaAfter), - std::runtime_error) + const std::runtime_error &) } private: diff --git a/Framework/Algorithms/test/MCInteractionVolumeTest.h b/Framework/Algorithms/test/MCInteractionVolumeTest.h index 72c39644554..fc78ba3f16b 100644 --- a/Framework/Algorithms/test/MCInteractionVolumeTest.h +++ b/Framework/Algorithms/test/MCInteractionVolumeTest.h @@ -141,7 +141,7 @@ public: // nothing TS_ASSERT_THROWS( MCInteractionVolume mcv(sample, sample.getShape().getBoundingBox()), - std::invalid_argument); + const std::invalid_argument &); // valid shape sample.setShape(ComponentCreationHelper::createSphere(1)); TS_ASSERT_THROWS_NOTHING( @@ -165,7 +165,7 @@ public: maxTries); TS_ASSERT_THROWS(interactor.calculateAbsorption(rng, startPos, endPos, lambdaBefore, lambdaAfter), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/Algorithms/test/MagFormFactorCorrectionTest.h b/Framework/Algorithms/test/MagFormFactorCorrectionTest.h index fd2d673f923..0bc701f3e7c 100644 --- a/Framework/Algorithms/test/MagFormFactorCorrectionTest.h +++ b/Framework/Algorithms/test/MagFormFactorCorrectionTest.h @@ -52,7 +52,7 @@ public: // Test that no form factor work space is created TS_ASSERT_THROWS( outws = AnalysisDataService::Instance().retrieve(formFactorWSname), - Exception::NotFoundError); + const Exception::NotFoundError &); } void testExec() { diff --git a/Framework/Algorithms/test/MaskBinsTest.h b/Framework/Algorithms/test/MaskBinsTest.h index 442e46e9da8..2c56df79b0a 100644 --- a/Framework/Algorithms/test/MaskBinsTest.h +++ b/Framework/Algorithms/test/MaskBinsTest.h @@ -47,7 +47,7 @@ public: masker.setPropertyValue("OutputWorkspace", resultWorkspaceName)); // Check that execution fails if XMin & XMax not set - TS_ASSERT_THROWS(masker.execute(), std::runtime_error); + TS_ASSERT_THROWS(masker.execute(), const std::runtime_error &); TS_ASSERT(!masker.isExecuted()); TS_ASSERT_THROWS_NOTHING(masker.setPropertyValue("XMin", "20.0")); diff --git a/Framework/Algorithms/test/MaskInstrumentTest.h b/Framework/Algorithms/test/MaskInstrumentTest.h index 2aa6c49aa9c..afc48f1e4cd 100644 --- a/Framework/Algorithms/test/MaskInstrumentTest.h +++ b/Framework/Algorithms/test/MaskInstrumentTest.h @@ -119,8 +119,8 @@ public: void test_out_of_range() { const auto in = makeWorkspace(); - TS_ASSERT_THROWS(maskInstrumentInplace(in, {0}), std::out_of_range); - TS_ASSERT_THROWS(maskInstrumentInplace(in, {5}), std::out_of_range); + TS_ASSERT_THROWS(maskInstrumentInplace(in, {0}), const std::out_of_range &); + TS_ASSERT_THROWS(maskInstrumentInplace(in, {5}), const std::out_of_range &); } }; diff --git a/Framework/Algorithms/test/MaxEnt/MaxentCalculatorTest.h b/Framework/Algorithms/test/MaxEnt/MaxentCalculatorTest.h index c6ea6fb3e44..f69916ed458 100644 --- a/Framework/Algorithms/test/MaxEnt/MaxentCalculatorTest.h +++ b/Framework/Algorithms/test/MaxEnt/MaxentCalculatorTest.h @@ -63,25 +63,25 @@ public: // Empty image TS_ASSERT_THROWS( calculator.iterate(vec, vec, emptyVec, bkg, emptyVec, emptyVec), - std::invalid_argument); + const std::invalid_argument &); // Empty errors TS_ASSERT_THROWS( calculator.iterate(vec, emptyVec, vec, bkg, emptyVec, emptyVec), - std::invalid_argument); + const std::invalid_argument &); // Empty data TS_ASSERT_THROWS( calculator.iterate(emptyVec, vec, vec, bkg, emptyVec, emptyVec), - std::invalid_argument); + const std::invalid_argument &); // Bad background (should be positive) TS_ASSERT_THROWS(calculator.iterate(vec, vec, vec, 0, emptyVec, emptyVec), - std::invalid_argument); + const std::invalid_argument &); // Size mismatch between data and errors std::vector<double> vec2 = {0, 1, 1}; TS_ASSERT_THROWS( calculator.iterate(vec, vec2, vec, bkg, emptyVec, emptyVec), - std::invalid_argument); + const std::invalid_argument &); } void test_size_mismatch_data_image() { @@ -114,7 +114,7 @@ public: EXPECT_CALL(*entropy, secondDerivative(vec2, bkg)).Times(0); TS_ASSERT_THROWS( calculator.iterate(vec1, vec1, vec2, bkg, emptyVec, emptyVec), - std::runtime_error); + const std::runtime_error &); Mock::VerifyAndClearExpectations(entropy); Mock::VerifyAndClearExpectations(transform); @@ -213,7 +213,7 @@ public: // But this is not: N * data.size() = image.size() TS_ASSERT_THROWS( calculator.iterate(vec2, vec2, vec1, bkg, emptyVec, emptyVec), - std::runtime_error); + const std::runtime_error &); Mock::VerifyAndClearExpectations(entropy); Mock::VerifyAndClearExpectations(transform); @@ -228,12 +228,12 @@ public: boost::shared_ptr<MockTransform>(transform)); // When data were not loaded public methods should throw an exception - TS_ASSERT_THROWS(calculator.getReconstructedData(), std::runtime_error); - TS_ASSERT_THROWS(calculator.getImage(), std::runtime_error); - TS_ASSERT_THROWS(calculator.getSearchDirections(), std::runtime_error); - TS_ASSERT_THROWS(calculator.getQuadraticCoefficients(), std::runtime_error); - TS_ASSERT_THROWS(calculator.getAngle(), std::runtime_error); - TS_ASSERT_THROWS(calculator.getChisq(), std::runtime_error); + TS_ASSERT_THROWS(calculator.getReconstructedData(), const std::runtime_error &); + TS_ASSERT_THROWS(calculator.getImage(), const std::runtime_error &); + TS_ASSERT_THROWS(calculator.getSearchDirections(), const std::runtime_error &); + TS_ASSERT_THROWS(calculator.getQuadraticCoefficients(), const std::runtime_error &); + TS_ASSERT_THROWS(calculator.getAngle(), const std::runtime_error &); + TS_ASSERT_THROWS(calculator.getChisq(), const std::runtime_error &); } void test_chisq_angle() { diff --git a/Framework/Algorithms/test/MaxEnt/MaxentSpaceRealTest.h b/Framework/Algorithms/test/MaxEnt/MaxentSpaceRealTest.h index 3605fc503cb..b6de622c226 100644 --- a/Framework/Algorithms/test/MaxEnt/MaxentSpaceRealTest.h +++ b/Framework/Algorithms/test/MaxEnt/MaxentSpaceRealTest.h @@ -65,7 +65,7 @@ public: std::vector<double> values = {-1., 0., 1., 2., 3.}; // Odd number of elements, we can't convert to real vector - TS_ASSERT_THROWS(space.fromComplex(values), std::invalid_argument); + TS_ASSERT_THROWS(space.fromComplex(values), const std::invalid_argument &); } }; diff --git a/Framework/Algorithms/test/MaxEntTest.h b/Framework/Algorithms/test/MaxEntTest.h index 2d12e33ea19..3dd03cec31e 100644 --- a/Framework/Algorithms/test/MaxEntTest.h +++ b/Framework/Algorithms/test/MaxEntTest.h @@ -205,7 +205,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_bad_linear_adjustment() { @@ -224,7 +224,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_bad_const_adjustment() { @@ -243,7 +243,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_linear_adjustment_with_too_few_spectra() { @@ -262,7 +262,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_const_adjustment_with_too_few_spectra() { @@ -281,7 +281,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_adjustments_together_too_few_spectra() { @@ -305,7 +305,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_adjustments_together_real_data_not_supported() { @@ -327,7 +327,7 @@ public: alg->setPropertyValue("EvolChi", "evolChi"); alg->setPropertyValue("EvolAngle", "evolAngle"); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_adjustment_arithmetic() { @@ -1058,7 +1058,7 @@ public: alg->initialize(); alg->setChild(true); TS_ASSERT_THROWS(alg->setProperty("InputWorkspace", ws), - std::invalid_argument); + const std::invalid_argument &); } void test_histogram_workspace() { diff --git a/Framework/Algorithms/test/MayersSampleCorrectionStrategyTest.h b/Framework/Algorithms/test/MayersSampleCorrectionStrategyTest.h index a20a399988d..84820b8277d 100644 --- a/Framework/Algorithms/test/MayersSampleCorrectionStrategyTest.h +++ b/Framework/Algorithms/test/MayersSampleCorrectionStrategyTest.h @@ -199,7 +199,7 @@ public: TS_ASSERT_THROWS( MayersSampleCorrectionStrategy(createTestParameters(), histo), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/Algorithms/test/MayersSampleCorrectionTest.h b/Framework/Algorithms/test/MayersSampleCorrectionTest.h index 7461216184c..8515a8c867d 100644 --- a/Framework/Algorithms/test/MayersSampleCorrectionTest.h +++ b/Framework/Algorithms/test/MayersSampleCorrectionTest.h @@ -82,14 +82,14 @@ public: void test_Input_Workspace_With_No_Instrument_Throws_Error() { auto noInstWS = createTestWorkspaceWithNoInstrument(); - TS_ASSERT_THROWS(runAlgorithm(noInstWS, true), std::invalid_argument); + TS_ASSERT_THROWS(runAlgorithm(noInstWS, true), const std::invalid_argument &); } void test_InputWorkspace_With_No_Sample_Shape_Throws_Error() { auto noSampleShapeWS = createTestWorkspaceWithNoSampleShape(); TS_ASSERT_THROWS(runAlgorithm(noSampleShapeWS, true), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/Algorithms/test/MergeRunsTest.h b/Framework/Algorithms/test/MergeRunsTest.h index aeba7e6944f..518d0d2908b 100644 --- a/Framework/Algorithms/test/MergeRunsTest.h +++ b/Framework/Algorithms/test/MergeRunsTest.h @@ -778,7 +778,7 @@ public: MergeRuns merge2; TS_ASSERT_THROWS_NOTHING(merge2.initialize()); TS_ASSERT_THROWS_NOTHING(merge.setPropertyValue("OutputWorkspace", "null")); - TS_ASSERT_THROWS(merge2.execute(), std::runtime_error); + TS_ASSERT_THROWS(merge2.execute(), const std::runtime_error &); TS_ASSERT(!merge2.isExecuted()); MatrixWorkspace_sptr badIn = WorkspaceCreationHelper::create2DWorkspace123(3, 10, 1); @@ -1013,7 +1013,7 @@ public: if (noOutput) { TS_ASSERT_THROWS( AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("outWS"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); return; } else { TS_ASSERT_THROWS_NOTHING( @@ -1230,7 +1230,7 @@ public: // should get stuck when trying to get "prop1" as a time series TS_ASSERT_THROWS(do_test_mergeSampleLogs(ws, "prop1", mergeType, "2013-Jun-25 10:59:15 1\n", 2), - std::invalid_argument); + const std::invalid_argument &); } void test_mergeSampleLogs_with_additional_time_series_property() { diff --git a/Framework/Algorithms/test/ModeratorTzeroLinearTest.h b/Framework/Algorithms/test/ModeratorTzeroLinearTest.h index c51cbe871a1..6ca19113c05 100644 --- a/Framework/Algorithms/test/ModeratorTzeroLinearTest.h +++ b/Framework/Algorithms/test/ModeratorTzeroLinearTest.h @@ -84,7 +84,8 @@ public: alg.setProperty("OutputWorkspace", "testWS"); alg.setRethrows(true); // necessary, otherwise the algorithm will catch all // exceptions and not return them - TS_ASSERT_THROWS(alg.execute(), Exception::InstrumentDefinitionError); + TS_ASSERT_THROWS(alg.execute(), + const Exception::InstrumentDefinitionError &); AnalysisDataService::Instance().remove("testWS"); } @@ -99,7 +100,8 @@ public: alg.setProperty("OutputWorkspace", "testWS"); alg.setRethrows(true); // necessary, otherwise the algorithm will catch all // exceptions and not return them - TS_ASSERT_THROWS(alg.execute(), Exception::InstrumentDefinitionError); + TS_ASSERT_THROWS(alg.execute(), + const Exception::InstrumentDefinitionError &); AnalysisDataService::Instance().remove("testWS"); } diff --git a/Framework/Algorithms/test/MonteCarloAbsorptionTest.h b/Framework/Algorithms/test/MonteCarloAbsorptionTest.h index 6efb98cac22..6154b710edb 100644 --- a/Framework/Algorithms/test/MonteCarloAbsorptionTest.h +++ b/Framework/Algorithms/test/MonteCarloAbsorptionTest.h @@ -234,7 +234,7 @@ public: auto testWS = WorkspaceCreationHelper::create2DWorkspace(1, 1); TS_ASSERT_THROWS(mcAbsorb->setProperty("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void test_Workspace_With_An_Invalid_Sample_Shape_Is_Not_Accepted() { @@ -247,7 +247,7 @@ public: Mantid::Kernel::UnitFactory::Instance().create("Wavelength"); auto mcabs = createAlgorithm(); TS_ASSERT_THROWS_NOTHING(mcabs->setProperty("InputWorkspace", testWS)); - TS_ASSERT_THROWS(mcabs->execute(), std::invalid_argument); + TS_ASSERT_THROWS(mcabs->execute(), const std::invalid_argument &); } void test_Lower_Limit_for_Number_of_Wavelengths() { @@ -256,10 +256,10 @@ public: 1, 10, Environment::SampleOnly, DeltaEMode::Direct, -1, -1}; int nlambda{1}; TS_ASSERT_THROWS(runAlgorithm(wsProps, nlambda, "Linear"), - std::runtime_error) + const std::runtime_error &) nlambda = 2; TS_ASSERT_THROWS(runAlgorithm(wsProps, nlambda, "CSpline"), - std::runtime_error) + const std::runtime_error &) } void test_event_workspace() { diff --git a/Framework/Algorithms/test/MultiplyDivideTest.in.h b/Framework/Algorithms/test/MultiplyDivideTest.in.h index 48c658ccc51..e8b088ba772 100644 --- a/Framework/Algorithms/test/MultiplyDivideTest.in.h +++ b/Framework/Algorithms/test/MultiplyDivideTest.in.h @@ -71,8 +71,8 @@ public: TS_ASSERT_THROWS_NOTHING(alg->initialize()); TS_ASSERT(alg->isInitialized()); //Setting properties to input workspaces that don't exist throws - TS_ASSERT_THROWS( alg->setPropertyValue("LHSWorkspace","test_in21"), std::invalid_argument ); - TS_ASSERT_THROWS( alg->setPropertyValue("RHSWorkspace","test_in22"), std::invalid_argument ); + TS_ASSERT_THROWS( alg->setPropertyValue("LHSWorkspace","test_in21"), const std::invalid_argument &); + TS_ASSERT_THROWS( alg->setPropertyValue("RHSWorkspace","test_in22"), const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( alg->setPropertyValue("OutputWorkspace","test_out2") ); delete alg; } diff --git a/Framework/Algorithms/test/NormaliseByCurrentTest.h b/Framework/Algorithms/test/NormaliseByCurrentTest.h index 238b3d37119..81157387136 100644 --- a/Framework/Algorithms/test/NormaliseByCurrentTest.h +++ b/Framework/Algorithms/test/NormaliseByCurrentTest.h @@ -162,7 +162,7 @@ public: norm.initialize(); // Check it fails if properties haven't been set - TS_ASSERT_THROWS(norm.execute(), std::runtime_error); + TS_ASSERT_THROWS(norm.execute(), const std::runtime_error &); TS_ASSERT(!norm.isExecuted()); } diff --git a/Framework/Algorithms/test/NormaliseByDetectorTest.h b/Framework/Algorithms/test/NormaliseByDetectorTest.h index 66267aac20a..9273be61497 100644 --- a/Framework/Algorithms/test/NormaliseByDetectorTest.h +++ b/Framework/Algorithms/test/NormaliseByDetectorTest.h @@ -283,7 +283,7 @@ private: alg.initialize(); alg.setPropertyValue("OutputWorkspace", "out"); alg.setProperty("InputWorkspace", inputWS); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } public: diff --git a/Framework/Algorithms/test/NormaliseToMonitorTest.h b/Framework/Algorithms/test/NormaliseToMonitorTest.h index e937733ae95..d6dd8b5c675 100644 --- a/Framework/Algorithms/test/NormaliseToMonitorTest.h +++ b/Framework/Algorithms/test/NormaliseToMonitorTest.h @@ -93,7 +93,7 @@ void dotestExec(bool events, bool sameOutputWS, bool performance = false) { if (!norm.isInitialized()) norm.initialize(); // Check it fails if properties haven't been set - TS_ASSERT_THROWS(norm.execute(), std::runtime_error) + TS_ASSERT_THROWS(norm.execute(), const std::runtime_error &) TS_ASSERT(!norm.isExecuted()) TS_ASSERT_THROWS_NOTHING(norm.setPropertyValue("InputWorkspace", "normMon")) std::string outputWS("normMon"); diff --git a/Framework/Algorithms/test/PlusMinusTest.in.h b/Framework/Algorithms/test/PlusMinusTest.in.h index a2511aceacb..2d00aead47e 100644 --- a/Framework/Algorithms/test/PlusMinusTest.in.h +++ b/Framework/Algorithms/test/PlusMinusTest.in.h @@ -71,8 +71,8 @@ public: TS_ASSERT_THROWS_NOTHING(alg->initialize()); TS_ASSERT(alg->isInitialized()); //Setting properties to input workspaces that don't exist throws - TS_ASSERT_THROWS( alg->setPropertyValue("LHSWorkspace","test_in21"), std::invalid_argument ); - TS_ASSERT_THROWS( alg->setPropertyValue("RHSWorkspace","test_in22"), std::invalid_argument ); + TS_ASSERT_THROWS( alg->setPropertyValue("LHSWorkspace","test_in21"), const std::invalid_argument &); + TS_ASSERT_THROWS( alg->setPropertyValue("RHSWorkspace","test_in22"), const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( alg->setPropertyValue("OutputWorkspace","test_out2") ); delete alg; } diff --git a/Framework/Algorithms/test/PoissonErrorsTest.h b/Framework/Algorithms/test/PoissonErrorsTest.h index 2c4612eedef..13aba22ab69 100644 --- a/Framework/Algorithms/test/PoissonErrorsTest.h +++ b/Framework/Algorithms/test/PoissonErrorsTest.h @@ -41,9 +41,9 @@ public: TS_ASSERT(alg.isInitialized()); // Setting properties to input workspaces that don't exist throws TS_ASSERT_THROWS(alg.setPropertyValue(inputProp1, "test_in21"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(alg.setPropertyValue(inputProp2, "test_in22"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue(outputProp, "test_out2")); } diff --git a/Framework/Algorithms/test/PolarizationCorrectionWildesTest.h b/Framework/Algorithms/test/PolarizationCorrectionWildesTest.h index ab1ef6c3eaa..7f58bf7cbb9 100644 --- a/Framework/Algorithms/test/PolarizationCorrectionWildesTest.h +++ b/Framework/Algorithms/test/PolarizationCorrectionWildesTest.h @@ -630,7 +630,7 @@ public: alg.setPropertyValue("OutputWorkspace", m_outputWSName)) TS_ASSERT_THROWS_NOTHING(alg.setProperty("Efficiencies", effWS)) TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Flippers", "0")) - TS_ASSERT_THROWS(alg.execute(), std::runtime_error) + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &) TS_ASSERT(!alg.isExecuted()) } @@ -659,7 +659,7 @@ public: alg.setPropertyValue("OutputWorkspace", m_outputWSName)) TS_ASSERT_THROWS_NOTHING(alg.setProperty("Efficiencies", effWS)) TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Flippers", "0")) - TS_ASSERT_THROWS(alg.execute(), std::runtime_error) + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &) TS_ASSERT(!alg.isExecuted()) } @@ -692,7 +692,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", m_outputWSName)) TS_ASSERT_THROWS_NOTHING(alg.setProperty("Efficiencies", effWS)) - TS_ASSERT_THROWS(alg.execute(), std::runtime_error) + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &) TS_ASSERT(!alg.isExecuted()) } @@ -718,7 +718,7 @@ public: TS_ASSERT(alg.isInitialized()) TS_ASSERT_THROWS( alg.setPropertyValue("InputWorkspaces", "ws00, ws01, ws10, ws11"), - std::invalid_argument) + const std::invalid_argument &) } private: diff --git a/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h b/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h index 710bc96eb0d..850b945f1bd 100644 --- a/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h +++ b/Framework/Algorithms/test/PolarizationEfficiencyCorTest.h @@ -54,7 +54,7 @@ public: alg.setProperty("Efficiencies", createEfficiencies("Wildes")); // Error: Input workspaces are missing. Either a workspace group or a list // of workspace names must be given - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_input_ws_default_group() { PolarizationEfficiencyCor alg; @@ -103,7 +103,7 @@ public: alg.setProperty("CorrectionMethod", "Wildes"); alg.setProperty("Efficiencies", createEfficiencies("Wildes")); // Error: Some invalid Properties found - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_input_ws_fredrikze_wrong_input_size() { PolarizationEfficiencyCor alg; @@ -114,7 +114,7 @@ public: alg.setProperty("CorrectionMethod", "Fredrikze"); alg.setProperty("Efficiencies", createEfficiencies("Fredrikze")); // Error: For PA analysis, input group must have 4 periods - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_input_ws_wildes_list() { PolarizationEfficiencyCor alg; @@ -138,7 +138,7 @@ public: alg.setProperty("CorrectionMethod", "Fredrikze"); alg.setProperty("Efficiencies", createEfficiencies("Fredrikze")); // Error: Input workspaces are required to be in a workspace group - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_input_ws_cannot_be_both() { PolarizationEfficiencyCor alg; @@ -150,7 +150,7 @@ public: alg.setProperty("Efficiencies", createEfficiencies("Wildes")); // Error: Input workspaces must be given either as a workspace group or a // list of names - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_input_ws_wildes_wrong_size() { PolarizationEfficiencyCor alg; @@ -161,7 +161,7 @@ public: alg.setProperty("CorrectionMethod", "Wildes"); alg.setProperty("Efficiencies", createEfficiencies("Wildes")); // Error: Some invalid Properties found - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_efficiencies_fredrikze_wrong_efficiencies() { @@ -173,7 +173,7 @@ public: alg.setProperty("CorrectionMethod", "Fredrikze"); alg.setProperty("Efficiencies", createEfficiencies("Wildes")); // Error: Efficiencey property not found: Rho; - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_efficiencies_wildes_wrong_efficiencies() { PolarizationEfficiencyCor alg; @@ -184,7 +184,7 @@ public: alg.setProperty("CorrectionMethod", "Wildes"); alg.setProperty("Efficiencies", createEfficiencies("Fredrikze")); // Error: Some invalid Properties found - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_flippers_full() { PolarizationEfficiencyCor alg; @@ -280,7 +280,7 @@ public: alg.setProperty("Efficiencies", createEfficiencies("Wildes")); alg.setProperty("Flippers", "00, 10, 11"); // Error: Some invalid Properties found - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_flippers_wildes_no_pnr() { PolarizationEfficiencyCor alg; @@ -293,7 +293,7 @@ public: alg.setProperty("PolarizationAnalysis", "PNR"); // Error: Property PolarizationAnalysis canot be used with the Wildes // method - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_flippers_wildes_no_pa() { PolarizationEfficiencyCor alg; @@ -306,7 +306,7 @@ public: alg.setProperty("PolarizationAnalysis", "PA"); // Error: Property PolarizationAnalysis canot be used with the Wildes // method - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_polarization_analysis_pnr() { PolarizationEfficiencyCor alg; @@ -346,7 +346,7 @@ public: alg.setProperty("Efficiencies", createEfficiencies("Fredrikze")); alg.setProperty("PolarizationAnalysis", "PNR"); // Error: For PNR analysis, input group must have 2 periods - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_polarization_analysis_no_flippers() { PolarizationEfficiencyCor alg; @@ -358,7 +358,7 @@ public: alg.setProperty("Efficiencies", createEfficiencies("Fredrikze")); alg.setProperty("Flippers", "00, 01, 10, 11"); // Error: Property Flippers canot be used with the Fredrikze method - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_histo() { diff --git a/Framework/Algorithms/test/PowerTest.h b/Framework/Algorithms/test/PowerTest.h index c127785599a..205709a2d33 100644 --- a/Framework/Algorithms/test/PowerTest.h +++ b/Framework/Algorithms/test/PowerTest.h @@ -83,7 +83,7 @@ public: power.initialize(); TSM_ASSERT_THROWS("Exponent cannot be non-numeric", power.setPropertyValue("Exponent", "x"), - std::invalid_argument) + const std::invalid_argument &) } void testNegativeExponent() { diff --git a/Framework/Algorithms/test/RadiusSumTest.h b/Framework/Algorithms/test/RadiusSumTest.h index 2c370dd41b2..762305e816c 100644 --- a/Framework/Algorithms/test/RadiusSumTest.h +++ b/Framework/Algorithms/test/RadiusSumTest.h @@ -38,7 +38,7 @@ public: { // check numbins, min and max radius auto alg = algInstance(); // check numbins is only integer > 1 - TS_ASSERT_THROWS(alg->setProperty("NumBins", -3), std::invalid_argument); + TS_ASSERT_THROWS(alg->setProperty("NumBins", -3), const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg->setProperty("MinRadius", 1.0)); TS_ASSERT_THROWS_NOTHING(alg->setProperty("MaxRadius", 0.1)); MatrixWorkspace_sptr goodWS = RingProfileTest::create_2d_workspace(); @@ -58,11 +58,11 @@ public: std::vector<double> justOne(1); justOne[0] = -0.35; TS_ASSERT_THROWS(alg->setProperty("Centre", justOne), - std::invalid_argument); + const std::invalid_argument &); std::vector<double> fourInputs(4, -0.45); TS_ASSERT_THROWS(alg->setProperty("Centre", fourInputs), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( alg->setPropertyValue("OutputWorkspace", outWSName)); diff --git a/Framework/Algorithms/test/RebinTest.h b/Framework/Algorithms/test/RebinTest.h index 44e7ba7f4cc..ea59f5d85dd 100644 --- a/Framework/Algorithms/test/RebinTest.h +++ b/Framework/Algorithms/test/RebinTest.h @@ -111,7 +111,7 @@ public: rebin.setPropertyValue("InputWorkspace", "test_in1D"); rebin.setPropertyValue("OutputWorkspace", "test_out"); // Check it fails if "Params" property not set - TS_ASSERT_THROWS(rebin.execute(), std::runtime_error); + TS_ASSERT_THROWS(rebin.execute(), const std::runtime_error &); TS_ASSERT(!rebin.isExecuted()); // Now set the property rebin.setPropertyValue("Params", "1.5,2.0,20,-0.1,30,1.0,35"); @@ -183,7 +183,7 @@ public: rebin.setPropertyValue("InputWorkspace", "test_in1D"); rebin.setPropertyValue("OutputWorkspace", "test_out"); // Check it fails if "Params" property not set - TS_ASSERT_THROWS(rebin.execute(), std::runtime_error); + TS_ASSERT_THROWS(rebin.execute(), const std::runtime_error &); TS_ASSERT(!rebin.isExecuted()); // Now set the property rebin.setPropertyValue("Params", "1.0,-1.0,1000.0"); diff --git a/Framework/Algorithms/test/RebinToWorkspaceTest.h b/Framework/Algorithms/test/RebinToWorkspaceTest.h index 99131041a64..31b16023e65 100644 --- a/Framework/Algorithms/test/RebinToWorkspaceTest.h +++ b/Framework/Algorithms/test/RebinToWorkspaceTest.h @@ -55,7 +55,7 @@ public: rebinToWS.initialize(); // No properties have been set so should throw if executed - TS_ASSERT_THROWS(rebinToWS.execute(), std::runtime_error); + TS_ASSERT_THROWS(rebinToWS.execute(), const std::runtime_error &); // Need to input workspaces to test this using namespace Mantid::DataObjects; diff --git a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h index 02d462b4f22..eaaad3392e3 100644 --- a/Framework/Algorithms/test/ReflectometryReductionOne2Test.h +++ b/Framework/Algorithms/test/ReflectometryReductionOne2Test.h @@ -750,7 +750,7 @@ public: alg.setPropertyValue("OutputWorkspace", "IvsQ"); alg.setPropertyValue("OutputWorkspaceWavelength", "IvsLam"); alg.setProperty("ThetaIn", 22.0); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_debug_false() { diff --git a/Framework/Algorithms/test/RegroupTest.h b/Framework/Algorithms/test/RegroupTest.h index a58ef27bc1f..77dcba2da8a 100644 --- a/Framework/Algorithms/test/RegroupTest.h +++ b/Framework/Algorithms/test/RegroupTest.h @@ -38,12 +38,12 @@ public: regroup.setPropertyValue("InputWorkspace", "test_in1D"); regroup.setPropertyValue("OutputWorkspace", "test_out"); // Check it fails if "params" property not set - TS_ASSERT_THROWS(regroup.execute(), std::runtime_error) + TS_ASSERT_THROWS(regroup.execute(), const std::runtime_error &) TS_ASSERT(!regroup.isExecuted()) // Trying to set the property with an error fails TS_ASSERT_THROWS( regroup.setPropertyValue("Params", "1.5,2.0,20,-0.1,15,1.0,35"), - std::invalid_argument) + const std::invalid_argument &) // Now set the property TS_ASSERT_THROWS_NOTHING( regroup.setPropertyValue("Params", "1.5,1,19,-0.1,30,1,35")) diff --git a/Framework/Algorithms/test/RemoveBackgroundTest.h b/Framework/Algorithms/test/RemoveBackgroundTest.h index 3459df6695f..125aaf49ffa 100644 --- a/Framework/Algorithms/test/RemoveBackgroundTest.h +++ b/Framework/Algorithms/test/RemoveBackgroundTest.h @@ -96,12 +96,12 @@ public: std::vector<double>(1, 10.)); TSM_ASSERT_THROWS( "Should throw if background workspace is not in TOF units", - bgRemoval.initialize(bkgWS, SourceWS, 0), std::invalid_argument); + bgRemoval.initialize(bkgWS, SourceWS, 0), const std::invalid_argument &); bkgWS = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument(2, 15); TSM_ASSERT_THROWS("Should throw if background is not 1 or equal to source", bgRemoval.initialize(bkgWS, SourceWS, 0), - std::invalid_argument); + const std::invalid_argument &); } void testBackgroundHelper() { diff --git a/Framework/Algorithms/test/RenameWorkspaceTest.h b/Framework/Algorithms/test/RenameWorkspaceTest.h index 211c08455a6..bbb0cad0cac 100644 --- a/Framework/Algorithms/test/RenameWorkspaceTest.h +++ b/Framework/Algorithms/test/RenameWorkspaceTest.h @@ -82,7 +82,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg3.setPropertyValue("OutputWorkspace", "InputWS")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); Workspace_sptr result; @@ -116,7 +116,7 @@ public: // Try to rename it should throw exception renameAlgorithm.setRethrows(true); - TS_ASSERT_THROWS(renameAlgorithm.execute(), std::runtime_error); + TS_ASSERT_THROWS(renameAlgorithm.execute(), const std::runtime_error &); TS_ASSERT_EQUALS(renameAlgorithm.isExecuted(), false); TS_ASSERT_THROWS_NOTHING( @@ -172,11 +172,11 @@ public: // The old ones should not be in the ADS TS_ASSERT_THROWS(ads.retrieve("oldName"), - Mantid::Kernel::Exception::NotFoundError) + const Mantid::Kernel::Exception::NotFoundError &) TS_ASSERT_THROWS(ads.retrieve("oldName_1"), - Mantid::Kernel::Exception::NotFoundError) + const Mantid::Kernel::Exception::NotFoundError &) TS_ASSERT_THROWS(ads.retrieve("oldName_2"), - Mantid::Kernel::Exception::NotFoundError) + const Mantid::Kernel::Exception::NotFoundError &) // The new ones should be TS_ASSERT_THROWS_NOTHING(ads.retrieve("newName_1")) TS_ASSERT_THROWS_NOTHING(ads.retrieve("newName_1")) @@ -213,7 +213,7 @@ public: AnalysisDataService::Instance().remove("WS_monitors"); TS_ASSERT_THROWS( AnalysisDataService::Instance().retrieveWS<Workspace>("WS_monitors"), - Exception::NotFoundError); + const Exception::NotFoundError &); // monitors resurrected alg.setPropertyValue("InputWorkspace", "WS"); alg.setPropertyValue("OutputWorkspace", "WS1"); diff --git a/Framework/Algorithms/test/RenameWorkspacesTest.h b/Framework/Algorithms/test/RenameWorkspacesTest.h index 2f6893e28c4..411a8a7edd5 100644 --- a/Framework/Algorithms/test/RenameWorkspacesTest.h +++ b/Framework/Algorithms/test/RenameWorkspacesTest.h @@ -161,19 +161,19 @@ public: alg6.initialize(); alg6.setPropertyValue("InputWorkspaces", "InputWS1, InputWS2"); // Check throw if no workspace name set - TS_ASSERT_THROWS(alg6.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg6.execute(), const std::runtime_error &); // Check throw if conflicting workspace names are set alg6.setPropertyValue("WorkspaceNames", "NewName1, NewName2"); alg6.setPropertyValue("Prefix", "A_"); - TS_ASSERT_THROWS(alg6.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg6.execute(), const std::runtime_error &); alg6.setPropertyValue("Suffix", "_1"); - TS_ASSERT_THROWS(alg6.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg6.execute(), const std::runtime_error &); alg6.setPropertyValue("Prefix", ""); - TS_ASSERT_THROWS(alg6.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg6.execute(), const std::runtime_error &); // Check throw if duplicate workspace names are set alg6.setPropertyValue("Suffix", ""); alg6.setPropertyValue("WorkspaceNames", "NewName3, NewName3"); - TS_ASSERT_THROWS(alg6.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg6.execute(), const std::runtime_error &); AnalysisDataService::Instance().remove("InputWS7"); AnalysisDataService::Instance().remove("InputWS8"); @@ -238,7 +238,7 @@ public: // Try to rename it should throw exception renameAlgorithm.setRethrows(true); - TS_ASSERT_THROWS(renameAlgorithm.execute(), std::runtime_error); + TS_ASSERT_THROWS(renameAlgorithm.execute(), const std::runtime_error &); TS_ASSERT_EQUALS(renameAlgorithm.isExecuted(), false); TS_ASSERT_THROWS_NOTHING( diff --git a/Framework/Algorithms/test/RingProfileTest.h b/Framework/Algorithms/test/RingProfileTest.h index a36326247f0..ce17a91f2de 100644 --- a/Framework/Algorithms/test/RingProfileTest.h +++ b/Framework/Algorithms/test/RingProfileTest.h @@ -33,20 +33,20 @@ public: TS_ASSERT(alg.isInitialized()); // check numbins is only integer > 1 - TS_ASSERT_THROWS(alg.setProperty("NumBins", -3), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("NumBins", -3), const std::invalid_argument &); // ange between [-360, 360] TS_ASSERT_THROWS(alg.setProperty("StartAngle", 500.0), - std::invalid_argument); + const std::invalid_argument &); // centre must be 2 or 3 values (x,y) or (x,y,z) std::vector<double> justOne(1); justOne[0] = -0.35; // TS_ASSERT_THROWS(alg.setProperty("Centre",justOne), - // std::invalid_argument); + // const std::invalid_argument &); std::vector<double> fourInputs(4, -0.45); // TS_ASSERT_THROWS(alg.setProperty("Centre", fourInputs), - // std::invalid_argument); + // const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName)); diff --git a/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h b/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h index 4e0028ec60c..cbc4a6bc603 100644 --- a/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h +++ b/Framework/Algorithms/test/SANSCollimationLengthEstimatorTest.h @@ -241,7 +241,7 @@ public: "Should throw an exception since we don't have the requested method " "implemneted", collimationLengthEstimator.provideCollimationLength(testWorkspace), - std::invalid_argument); + const std::invalid_argument &); } void test_that_missing_guide_cutoff_produces_a_default_value() { diff --git a/Framework/Algorithms/test/ScaleXTest.h b/Framework/Algorithms/test/ScaleXTest.h index 7b16940ec57..ec692cab66a 100644 --- a/Framework/Algorithms/test/ScaleXTest.h +++ b/Framework/Algorithms/test/ScaleXTest.h @@ -250,7 +250,7 @@ public: TS_ASSERT_THROWS_NOTHING( scale.setPropertyValue("InstrumentParameter", "factor")); - TS_ASSERT_THROWS(scale.execute(), std::runtime_error); + TS_ASSERT_THROWS(scale.execute(), const std::runtime_error &); TS_ASSERT(!scale.isExecuted()); AnalysisDataService::Instance().remove("tomultiply"); @@ -274,7 +274,7 @@ public: scale.setPropertyValue("OutputWorkspace", "multiplied")); TS_ASSERT_THROWS_NOTHING(scale.setProperty("Combine", true)); - TS_ASSERT_THROWS(scale.execute(), std::invalid_argument); + TS_ASSERT_THROWS(scale.execute(), const std::invalid_argument &); TS_ASSERT(!scale.isExecuted()); AnalysisDataService::Instance().remove("tomultiply"); diff --git a/Framework/Algorithms/test/SmoothDataTest.h b/Framework/Algorithms/test/SmoothDataTest.h index e71f307cf3b..42d88fac5eb 100644 --- a/Framework/Algorithms/test/SmoothDataTest.h +++ b/Framework/Algorithms/test/SmoothDataTest.h @@ -62,10 +62,10 @@ public: void testInvalidInputs() { SmoothData smooth2; TS_ASSERT_THROWS_NOTHING(smooth2.initialize()); - TS_ASSERT_THROWS(smooth2.execute(), std::runtime_error); + TS_ASSERT_THROWS(smooth2.execute(), const std::runtime_error &); // Can't set Npoints to value less than 3 TS_ASSERT_THROWS(smooth2.setPropertyValue("NPoints", "1"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( smooth2.setPropertyValue("InputWorkspace", "noisy")); diff --git a/Framework/Algorithms/test/SmoothNeighboursTest.h b/Framework/Algorithms/test/SmoothNeighboursTest.h index 37b3253df7c..baf85df7d24 100644 --- a/Framework/Algorithms/test/SmoothNeighboursTest.h +++ b/Framework/Algorithms/test/SmoothNeighboursTest.h @@ -245,7 +245,7 @@ public: * Start test Radius Filter. */ void testRadiusThrowsIfNegativeCutoff() { - TS_ASSERT_THROWS(RadiusFilter(-1), std::invalid_argument); + TS_ASSERT_THROWS(RadiusFilter(-1), const std::invalid_argument &); } void testRadiusFiltering() { @@ -272,7 +272,7 @@ public: alg.initialize(); TSM_ASSERT_THROWS("Cannot have number of neighbours < 1", alg.setProperty("NumberOfNeighbours", -1), - std::invalid_argument); + const std::invalid_argument &); } void testWithNonIntegerNumberOfNeighbours() { @@ -280,7 +280,7 @@ public: alg.initialize(); TSM_ASSERT_THROWS("Cannot have non-integer number of neighbours", alg.setProperty("NumberOfNeighbours", 1.1), - std::invalid_argument); + const std::invalid_argument &); } void testWithValidNumberOfNeighbours() { diff --git a/Framework/Algorithms/test/SortEventsTest.h b/Framework/Algorithms/test/SortEventsTest.h index 0ae65be1cb0..829bf5533db 100644 --- a/Framework/Algorithms/test/SortEventsTest.h +++ b/Framework/Algorithms/test/SortEventsTest.h @@ -53,7 +53,7 @@ public: sort.initialize(); // Not an event workspace TS_ASSERT_THROWS(sort.setPropertyValue("InputWorkspace", "workspace2d"), - std::invalid_argument); + const std::invalid_argument &); // This one will be ok sort.setPropertyValue("InputWorkspace", wsName); sort.setPropertyValue("SortBy", "X Value"); diff --git a/Framework/Algorithms/test/Stitch1DManyTest.h b/Framework/Algorithms/test/Stitch1DManyTest.h index 56148a5e345..119a146f587 100644 --- a/Framework/Algorithms/test/Stitch1DManyTest.h +++ b/Framework/Algorithms/test/Stitch1DManyTest.h @@ -167,7 +167,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspaces", "ws1")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Params", "0.1, 0.1, 1.8")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("OutputWorkspace", "outws")); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -183,7 +183,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("StartOverlaps", "-0.5, -0.6")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("EndOverlaps", "0.5")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("OutputWorkspace", "outws")); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -198,7 +198,7 @@ public: alg.setProperty("StartOverlaps", "-0.5"); alg.setProperty("EndOverlaps", "0.5, 0.6"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -213,7 +213,7 @@ public: alg.setProperty("UseManualScaleFactors", "1"); alg.setProperty("ManualScaleFactors", "0.5, 0.7"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -228,7 +228,7 @@ public: alg.setProperty("InputWorkspaces", "ws1, ws2"); alg.setProperty("Params", "0.1"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -243,14 +243,14 @@ public: alg.setProperty("InputWorkspaces", "group1, ws1"); alg.setProperty("Params", "0.1"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); Stitch1DMany alg2; alg2.setChild(true); alg2.initialize(); alg2.setProperty("InputWorkspaces", "ws1, group1"); alg2.setProperty("Params", "0.1"); alg2.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -267,7 +267,7 @@ public: alg.setProperty("InputWorkspaces", "group1, group2"); alg.setProperty("Params", "0.1"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -284,7 +284,7 @@ public: alg.setProperty("InputWorkspaces", "group1, group2"); alg.setProperty("Params", "0.1, 0.1, 2.6"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -309,7 +309,7 @@ public: alg.setProperty("Params", "0.1, 0.1, 2.6"); alg.setProperty("ScaleFactorFromPeriod", 4); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -589,7 +589,7 @@ public: alg.setProperty("StartOverlaps", "0.8"); alg.setProperty("EndOverlaps", "1.1"); alg.setProperty("OutputWorkspace", "outws"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().clear(); } @@ -1106,7 +1106,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg0.setProperty("UseManualScaleFactors", "1")) TS_ASSERT_THROWS_NOTHING(alg0.setProperty("ScaleFactorFromPeriod", 2)) TS_ASSERT_THROWS_NOTHING(alg0.setProperty("OutputWorkspace", "outws")) - TS_ASSERT_THROWS(alg0.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg0.execute(), const std::runtime_error &); TS_ASSERT(!alg0.isExecuted()) // Will produce a group outws containing a single workspace named @@ -1346,7 +1346,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspaces", "ws1, ws2")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("UseManualScaleFactors", "1")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("OutputWorkspace", "ws")); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/Algorithms/test/Stitch1DTest.h b/Framework/Algorithms/test/Stitch1DTest.h index c877921861f..3adee91c26c 100644 --- a/Framework/Algorithms/test/Stitch1DTest.h +++ b/Framework/Algorithms/test/Stitch1DTest.h @@ -419,12 +419,12 @@ public: alg.setProperty("LHSWorkspace", make_arbitrary_point_ws()); alg.setProperty("RHSWorkspace", make_arbitrary_histogram_ws()); alg.setPropertyValue("OutputWorkspace", "dummy_value"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); alg.setProperty("LHSWorkspace", make_arbitrary_histogram_ws()); alg.setProperty("RHSWorkspace", make_arbitrary_point_ws()); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/Algorithms/test/SumEventsByLogValueTest.h b/Framework/Algorithms/test/SumEventsByLogValueTest.h index 7e51c56899d..e1f9ccffe1f 100644 --- a/Framework/Algorithms/test/SumEventsByLogValueTest.h +++ b/Framework/Algorithms/test/SumEventsByLogValueTest.h @@ -36,12 +36,12 @@ public: TS_ASSERT_THROWS( alg.setProperty("InputWorkspace", WorkspaceCreationHelper::create2DWorkspace(1, 1)), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.setProperty( "InputWorkspace", WorkspaceCreationHelper::createEventWorkspace())); // LogName must not be empty - TS_ASSERT_THROWS(alg.setProperty("LogName", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("LogName", ""), const std::invalid_argument &); } void test_validateInputs() { diff --git a/Framework/Algorithms/test/SumRowColumnTest.h b/Framework/Algorithms/test/SumRowColumnTest.h index 127a41f20b4..7a2cd804857 100644 --- a/Framework/Algorithms/test/SumRowColumnTest.h +++ b/Framework/Algorithms/test/SumRowColumnTest.h @@ -41,7 +41,7 @@ public: TS_ASSERT_THROWS_NOTHING(summer.setPropertyValue("InputWorkspace", inputWS)) TS_ASSERT_THROWS_NOTHING(summer.setPropertyValue("OutputWorkspace", "nowt")) - TS_ASSERT_THROWS(summer.execute(), std::runtime_error) + TS_ASSERT_THROWS(summer.execute(), const std::runtime_error &) TS_ASSERT(!summer.isExecuted()) } diff --git a/Framework/Algorithms/test/SumSpectraTest.h b/Framework/Algorithms/test/SumSpectraTest.h index 850d3ef4d9e..9b788614fb3 100644 --- a/Framework/Algorithms/test/SumSpectraTest.h +++ b/Framework/Algorithms/test/SumSpectraTest.h @@ -202,7 +202,7 @@ public: // Check setting of invalid property value causes failure TS_ASSERT_THROWS(alg2.setPropertyValue("StartWorkspaceIndex", "-1"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg2.execute()); TS_ASSERT(alg2.isExecuted()); @@ -270,12 +270,12 @@ public: void testExecEvent_going_too_far() { TS_ASSERT_THROWS( dotestExecEvent("testEvent", "testEvent2", "5,10-15, 500-600"), - std::runtime_error); + const std::runtime_error &); } void testExecEvent_negative_indices() { TS_ASSERT_THROWS(dotestExecEvent("testEvent", "testEvent2", "5-10,-10"), - std::runtime_error); + const std::runtime_error &); } void dotestExecEvent(std::string inName, std::string outName, diff --git a/Framework/Algorithms/test/TransposeTest.h b/Framework/Algorithms/test/TransposeTest.h index 76a8d6c05dd..90acab2414b 100644 --- a/Framework/Algorithms/test/TransposeTest.h +++ b/Framework/Algorithms/test/TransposeTest.h @@ -73,7 +73,7 @@ public: const size_t nHist = inputWS->getNumberHistograms(); const size_t nBins = inputWS->blocksize(); - TS_ASSERT_THROWS(transpose->execute(), std::runtime_error); + TS_ASSERT_THROWS(transpose->execute(), const std::runtime_error &); TS_ASSERT(!transpose->isExecuted()); TS_ASSERT_THROWS_NOTHING( diff --git a/Framework/Algorithms/test/UnGroupWorkspaceTest.h b/Framework/Algorithms/test/UnGroupWorkspaceTest.h index ac652c2107a..d269e91691c 100644 --- a/Framework/Algorithms/test/UnGroupWorkspaceTest.h +++ b/Framework/Algorithms/test/UnGroupWorkspaceTest.h @@ -97,7 +97,7 @@ public: Mantid::Algorithms::UnGroupWorkspace alg; alg.initialize(); TS_ASSERT_THROWS(alg.setProperty("InputWorkspace", wsName), - std::invalid_argument); + const std::invalid_argument &); removeFromADS(std::vector<std::string>(1, wsName)); } diff --git a/Framework/Algorithms/test/UnwrapMonitorsInTOFTest.h b/Framework/Algorithms/test/UnwrapMonitorsInTOFTest.h index c0c79338e11..c5c096f497e 100644 --- a/Framework/Algorithms/test/UnwrapMonitorsInTOFTest.h +++ b/Framework/Algorithms/test/UnwrapMonitorsInTOFTest.h @@ -214,7 +214,7 @@ public: alg.setProperty("WavelengthMin", wavelengthMin); alg.setProperty("WavelengthMax", wavelengthMax); TSM_ASSERT_THROWS("Negative wavelength cutoffs are not allowed.", - alg.execute(), std::runtime_error); + alg.execute(), const std::runtime_error &); } private: diff --git a/Framework/Algorithms/test/WeightingStrategyTest.h b/Framework/Algorithms/test/WeightingStrategyTest.h index 8411a1452c3..cdc4fdda436 100644 --- a/Framework/Algorithms/test/WeightingStrategyTest.h +++ b/Framework/Algorithms/test/WeightingStrategyTest.h @@ -30,7 +30,7 @@ public: NullWeighting strategy; V3D distance; TSM_ASSERT_THROWS("NullWeighting should always throw in usage", - strategy.weightAt(distance), std::runtime_error); + strategy.weightAt(distance), const std::runtime_error &); } void testNullWeightingStrategyRectangularThrows() { @@ -41,7 +41,7 @@ public: int iy = 0; TSM_ASSERT_THROWS("NullWeighting should always throw in usage", strategy.weightAt(adjX, adjY, ix, iy), - std::runtime_error); + const std::runtime_error &); } void testFlatWeightingStrategyAtRadius() { @@ -161,9 +161,9 @@ public: void testGaussiannDConstructor() { TSM_ASSERT_THROWS("GaussianWeighting2D should not allow unsigned cuttoff", - GaussianWeightingnD(-1, 1), std::invalid_argument); + GaussianWeightingnD(-1, 1), const std::invalid_argument &); TSM_ASSERT_THROWS("GaussianWeighting2D should not allow unsigned sigma", - GaussianWeightingnD(1, -1), std::invalid_argument); + GaussianWeightingnD(1, -1), const std::invalid_argument &); TSM_ASSERT_THROWS_NOTHING("GaussianWeighting2D should have constructed " "with the valid provided arguments", GaussianWeightingnD(1, 1)); diff --git a/Framework/Beamline/test/DetectorInfoTest.h b/Framework/Beamline/test/DetectorInfoTest.h index 562e00c102a..fbe9209762a 100644 --- a/Framework/Beamline/test/DetectorInfoTest.h +++ b/Framework/Beamline/test/DetectorInfoTest.h @@ -51,11 +51,11 @@ public: TS_ASSERT_THROWS_NOTHING(DetectorInfo(PosVec(3), RotVec(3), {0, 1, 2})); TS_ASSERT_THROWS_NOTHING(DetectorInfo(PosVec(3), RotVec(3), {0, 0, 0})); TS_ASSERT_THROWS(DetectorInfo(PosVec(3), RotVec(3), {3}), - std::out_of_range); + const std::out_of_range &); } void test_constructor_length_mismatch() { - TS_ASSERT_THROWS(DetectorInfo(PosVec(3), RotVec(2)), std::runtime_error); + TS_ASSERT_THROWS(DetectorInfo(PosVec(3), RotVec(2)), const std::runtime_error &); } void test_assign_componentInfo() { diff --git a/Framework/Catalog/test/ONCatEntityTest.h b/Framework/Catalog/test/ONCatEntityTest.h index 265cba94f48..ccb2b3dd12b 100644 --- a/Framework/Catalog/test/ONCatEntityTest.h +++ b/Framework/Catalog/test/ONCatEntityTest.h @@ -77,7 +77,7 @@ public: ss << malformedRepresentation; TS_ASSERT_THROWS(ONCatEntity::fromJSONStream(ss), - MalformedRepresentationError); + const MalformedRepresentationError &); } void test_throws_on_malformed_representation() { @@ -90,7 +90,7 @@ public: ss << missingTypeRepresentation; TS_ASSERT_THROWS(ONCatEntity::fromJSONStream(ss), - MalformedRepresentationError); + const MalformedRepresentationError &); } void test_nested_values_with_various_types() { diff --git a/Framework/Catalog/test/ONCatTest.h b/Framework/Catalog/test/ONCatTest.h index 9de6c40e4e9..c79bc844721 100644 --- a/Framework/Catalog/test/ONCatTest.h +++ b/Framework/Catalog/test/ONCatTest.h @@ -77,7 +77,7 @@ public: oncat.setInternetHelper(mock_oncat_api); TS_ASSERT_THROWS(oncat.login("user", "does_not_exist"), - InvalidCredentialsError); + const InvalidCredentialsError &); TS_ASSERT(!oncat.isUserLoggedIn()); TS_ASSERT(mock_oncat_api->allResponsesCalledOnce()); @@ -183,7 +183,7 @@ public: TS_ASSERT_THROWS( oncat.refreshTokenIfNeeded(DateAndTime::getCurrentTime() + 3601.0), - InvalidRefreshTokenError); + const InvalidRefreshTokenError &); TS_ASSERT(!oncat.isUserLoggedIn()); @@ -287,7 +287,7 @@ public: oncat.setInternetHelper(mock_oncat_api); TS_ASSERT_THROWS(oncat.list("api", "instruments", {{"facility", "HFIR"}}), - TokenRejectedError); + const TokenRejectedError &); TS_ASSERT(!oncat.isUserLoggedIn()); TS_ASSERT(mock_oncat_api->allResponsesCalledOnce()); diff --git a/Framework/Crystal/test/CalibrationHelpersTest.h b/Framework/Crystal/test/CalibrationHelpersTest.h index daa58099c4e..9259d9096b9 100644 --- a/Framework/Crystal/test/CalibrationHelpersTest.h +++ b/Framework/Crystal/test/CalibrationHelpersTest.h @@ -52,7 +52,7 @@ public: // Check what happens if l1 is negative TS_ASSERT_THROWS(CalibrationHelpers::adjustUpSampleAndSourcePositions( -l1, positionSampleNew, wsNew->mutableComponentInfo()), - std::runtime_error); + const std::runtime_error &); CalibrationHelpers::adjustUpSampleAndSourcePositions( l1, positionSampleNew, wsNew->mutableComponentInfo()); diff --git a/Framework/Crystal/test/CombinePeaksWorkspacesTest.h b/Framework/Crystal/test/CombinePeaksWorkspacesTest.h index 67ee71d71cf..afa1a125623 100644 --- a/Framework/Crystal/test/CombinePeaksWorkspacesTest.h +++ b/Framework/Crystal/test/CombinePeaksWorkspacesTest.h @@ -34,7 +34,7 @@ public: CombinePeaksWorkspaces alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) // Tolerance has to be positive. Even if CombineMatchingPeaks is false! - TS_ASSERT_THROWS(alg.setProperty("Tolerance", -1.0), std::invalid_argument) + TS_ASSERT_THROWS(alg.setProperty("Tolerance", -1.0), const std::invalid_argument &) } void test_keep_all_peaks() { diff --git a/Framework/Crystal/test/DiffPeaksWorkspacesTest.h b/Framework/Crystal/test/DiffPeaksWorkspacesTest.h index e2eec746b67..6b65a9b1803 100644 --- a/Framework/Crystal/test/DiffPeaksWorkspacesTest.h +++ b/Framework/Crystal/test/DiffPeaksWorkspacesTest.h @@ -34,7 +34,7 @@ public: DiffPeaksWorkspaces alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()) // Tolerance has to be positive. - TS_ASSERT_THROWS(alg.setProperty("Tolerance", -1.0), std::invalid_argument) + TS_ASSERT_THROWS(alg.setProperty("Tolerance", -1.0), const std::invalid_argument &) } // It shouldn't be a problem to subtract identical workspaces. You just get an diff --git a/Framework/Crystal/test/FindSXPeaksHelperTest.h b/Framework/Crystal/test/FindSXPeaksHelperTest.h index 38da7fdfe5b..0615055e5be 100644 --- a/Framework/Crystal/test/FindSXPeaksHelperTest.h +++ b/Framework/Crystal/test/FindSXPeaksHelperTest.h @@ -55,7 +55,7 @@ public: std::vector<int> spectra(1, 1); TSM_ASSERT_THROWS("SXPeak: Should not construct with a negative intensity", SXPeak(0.001, 0.02, intensity, spectra, 0, spectrumInfo), - std::invalid_argument); + const std::invalid_argument &); } // Test out of bounds construction arguments. @@ -68,7 +68,7 @@ public: TSM_ASSERT_THROWS( "SXPeak: Should not construct with a zero size specral list", SXPeak(0.001, 0.02, intensity, spectra, 0, spectrumInfo), - std::invalid_argument); + const std::invalid_argument &); } void testSXPeakGetters() { @@ -183,7 +183,7 @@ public: "strategy is not AbsoluteBackgroundStrategy", Mantid::Kernel::make_unique<AllPeaksStrategy>( backgroundStrategy.get(), spectrumInfo); - , std::invalid_argument); + , const std::invalid_argument &); } void testThatCanReduceWithSimpleReduceStrategy() { diff --git a/Framework/Crystal/test/FindSXPeaksTest.h b/Framework/Crystal/test/FindSXPeaksTest.h index cd0f489ba50..c1222d76e8f 100644 --- a/Framework/Crystal/test/FindSXPeaksTest.h +++ b/Framework/Crystal/test/FindSXPeaksTest.h @@ -78,7 +78,7 @@ public: alg->setProperty("StartWorkspaceIndex", 3); alg->setProperty("EndWorkspaceIndex", 2); TSM_ASSERT_THROWS("Cannot have start index > end index", alg->execute(), - std::invalid_argument); + const std::invalid_argument &); } void testFindNoPeaks() { diff --git a/Framework/Crystal/test/IndexSXPeaksTest.h b/Framework/Crystal/test/IndexSXPeaksTest.h index e8a0fe617a1..482e82fe00b 100644 --- a/Framework/Crystal/test/IndexSXPeaksTest.h +++ b/Framework/Crystal/test/IndexSXPeaksTest.h @@ -112,13 +112,13 @@ public: void test_lessThanTwoPeaksThrows() { TS_ASSERT_THROWS(doTest(1, "1", 14.131, 19.247, 8.606, 90.0, 105.071, 90.0), - std::runtime_error); + const std::runtime_error &); } void test_zeroBasedIndexingThrows() { TS_ASSERT_THROWS( doTest(1, "0, 1, 2", 14.131, 19.247, 8.606, 90.0, 105.071, 90.0), - std::runtime_error); + const std::runtime_error &); } void test_colinearPeaksThrows() { @@ -134,7 +134,7 @@ public: TS_ASSERT_THROWS(doTest(6, "1, 2, 3, 4, 5, 6", 14.131, 19.247, 8.606, 90.0, 105.071, 90.0), - std::runtime_error); + const std::runtime_error &); // Restore master. peaks workspace. m_masterPeaks = temp; diff --git a/Framework/Crystal/test/PeakStatisticsToolsTest.h b/Framework/Crystal/test/PeakStatisticsToolsTest.h index 6948369a3ea..b5cc0b7b879 100644 --- a/Framework/Crystal/test/PeakStatisticsToolsTest.h +++ b/Framework/Crystal/test/PeakStatisticsToolsTest.h @@ -134,8 +134,8 @@ public: void test_UniqueReflectionRemoveOutliersSigmaCrit() { UniqueReflection reflection(V3D(2, 3, 4)); TS_ASSERT_THROWS_NOTHING(reflection.removeOutliers(3.0)); - TS_ASSERT_THROWS(reflection.removeOutliers(0.0), std::invalid_argument); - TS_ASSERT_THROWS(reflection.removeOutliers(-10.0), std::invalid_argument); + TS_ASSERT_THROWS(reflection.removeOutliers(0.0), const std::invalid_argument &); + TS_ASSERT_THROWS(reflection.removeOutliers(-10.0), const std::invalid_argument &); } void test_UniqueReflectionRemoveOutliersFewPeaks() { diff --git a/Framework/Crystal/test/SetUBTest.h b/Framework/Crystal/test/SetUBTest.h index adf0470801e..5d81f1a62b6 100644 --- a/Framework/Crystal/test/SetUBTest.h +++ b/Framework/Crystal/test/SetUBTest.h @@ -94,7 +94,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Workspace", wsName)); TS_ASSERT_THROWS(alg.setPropertyValue("UB", "1,1"), - std::invalid_argument); // should fail to initialize UB, + const std::invalid_argument &); // should fail to initialize UB, // since 9 elements are required TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("UB", "0,0,2,0,4,0,-8,0,0")); TS_ASSERT_THROWS_NOTHING(alg.execute();); @@ -141,7 +141,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Workspace", wsName)); TS_ASSERT_THROWS(alg.setPropertyValue("UB", "1,1"), - std::invalid_argument); // should fail to initialize UB, + const std::invalid_argument &); // should fail to initialize UB, // since 9 elements are required TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("UB", "1,1,1,1,1,1,1,1,1")); TS_ASSERT_THROWS_NOTHING(alg.execute();); @@ -211,12 +211,12 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Workspace", wsName)); TS_ASSERT_THROWS(alg.setPropertyValue("alpha", "1"), - std::invalid_argument); // should fail to initialize alpha, + const std::invalid_argument &); // should fail to initialize alpha, // since angle is too small TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("alpha", "90.")); TS_ASSERT_THROWS( alg.setPropertyValue("u", "0,0,2,0,4,0,-8,0,0"), - std::invalid_argument); // should fail, only 3 numbers allowed + const std::invalid_argument &); // should fail, only 3 numbers allowed TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("u", "0,2,0")); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("v", "2,0,0")); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("a", "4")); diff --git a/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h index 8f5aa245cd5..70bc9cab1f2 100644 --- a/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvertToYSpaceTest.h @@ -118,9 +118,9 @@ public: auto alg = createAlgorithm(); // Zero - TS_ASSERT_THROWS(alg->setProperty("Mass", 0.0), std::invalid_argument); + TS_ASSERT_THROWS(alg->setProperty("Mass", 0.0), const std::invalid_argument &); // Negative - TS_ASSERT_THROWS(alg->setProperty("Mass", -0.1), std::invalid_argument); + TS_ASSERT_THROWS(alg->setProperty("Mass", -0.1), const std::invalid_argument &); } void test_Input_Workspace_Not_In_TOF_Throws_Error() { @@ -129,7 +129,7 @@ public: testWS->getAxis(0)->setUnit("Wavelength"); TS_ASSERT_THROWS(alg->setProperty("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void test_Input_Workspace_In_TOF_Without_Instrument_Throws_Error() { @@ -138,7 +138,7 @@ public: testWS->getAxis(0)->setUnit("TOF"); TS_ASSERT_THROWS(alg->setProperty("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void @@ -152,7 +152,7 @@ public: alg->setProperty("Mass", 1.0097); alg->setRethrows(true); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } }; diff --git a/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h b/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h index 77b3c816b73..c77bdd6be47 100644 --- a/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h +++ b/Framework/CurveFitting/test/Algorithms/ConvolutionFitSequentialTest.h @@ -64,21 +64,21 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("Function", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_startX_is_not_allowed() { ConvolutionFitSequential alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("StartX", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("StartX", ""), const std::invalid_argument &); } void test_empty_endX_is_not_allowed() { ConvolutionFitSequential alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); - TS_ASSERT_THROWS(alg.setPropertyValue("EndX", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg.setPropertyValue("EndX", ""), const std::invalid_argument &); } void test_empty_specMin_is_not_allowed() { @@ -86,7 +86,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("SpecMin", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_specMax_is_not_allowed() { @@ -94,7 +94,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("SpecMax", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_maxIterations_is_not_allowed() { @@ -102,23 +102,23 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("MaxIterations", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_spectra_min_or_max_number_can_not_be_negative() { ConvolutionFitSequential alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("SpecMin", "-1"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(alg.setPropertyValue("SpecMax", "-1"), - std::invalid_argument); + const std::invalid_argument &); } void test_max_iterations_can_not_be_a_negative_number() { ConvolutionFitSequential alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("MaxIterations", "-1"), - std::invalid_argument); + const std::invalid_argument &); } void test_fit_function_that_does_not_contain_resolution_is_not_allowed() { @@ -126,7 +126,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS( alg.setProperty("Function", "function=test,name=Convolution"), - std::invalid_argument); + const std::invalid_argument &); } void test_fit_function_that_does_not_contain_convolution_is_not_allowed() { @@ -134,7 +134,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS( alg.setProperty("Function", "function=test,name=Resolution"), - std::invalid_argument); + const std::invalid_argument &); } //------------------------- Execution cases --------------------------- diff --git a/Framework/CurveFitting/test/Algorithms/EstimateFitParametersTest.h b/Framework/CurveFitting/test/Algorithms/EstimateFitParametersTest.h index 6e05a3e4000..e0aa41d53ec 100644 --- a/Framework/CurveFitting/test/Algorithms/EstimateFitParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/EstimateFitParametersTest.h @@ -48,7 +48,7 @@ public: alg.setPropertyValue("Function", "name=UserFunction,Formula=a*x+b,a=1,ties=(b=0)"); alg.setProperty("InputWorkspace", ws); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_no_lower_bound() { @@ -61,7 +61,7 @@ public: alg.setPropertyValue( "Function", "name=UserFunction,Formula=a*x+b,constraints=(a<4, b<4)"); alg.setProperty("InputWorkspace", ws); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_no_upper_bound() { @@ -74,7 +74,7 @@ public: alg.setPropertyValue( "Function", "name=UserFunction,Formula=a*x+b,constraints=(a>4, b>4)"); alg.setProperty("InputWorkspace", ws); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_all_free() { diff --git a/Framework/CurveFitting/test/Algorithms/FitTest.h b/Framework/CurveFitting/test/Algorithms/FitTest.h index a3442a3d158..4f4f2b92b45 100644 --- a/Framework/CurveFitting/test/Algorithms/FitTest.h +++ b/Framework/CurveFitting/test/Algorithms/FitTest.h @@ -102,14 +102,14 @@ public: TS_ASSERT_THROWS( alg->setProperty("Function", boost::dynamic_pointer_cast<IFunction>(multi)), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_function_str() { auto alg = Mantid::API::AlgorithmManager::Instance().create("Fit"); alg->initialize(); TS_ASSERT_THROWS(alg->setPropertyValue("Function", ""), - std::invalid_argument); + const std::invalid_argument &); } // Test that Fit copies minimizer's output properties to Fit diff --git a/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h b/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h index 3573807441c..253411f91f0 100644 --- a/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h +++ b/Framework/CurveFitting/test/Algorithms/QENSFitSequentialTest.h @@ -53,7 +53,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("Function", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_convolution_fit() { diff --git a/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h b/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h index 85624e3ffc1..a0ff60d70b3 100644 --- a/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h +++ b/Framework/CurveFitting/test/Algorithms/QENSFitSimultaneousTest.h @@ -55,7 +55,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("Function", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_single_dataset_fit() { diff --git a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h index 09ff13fb140..3e1710dad3d 100644 --- a/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h +++ b/Framework/CurveFitting/test/Algorithms/RefinePowderInstrumentParametersTest.h @@ -482,7 +482,7 @@ public: mcpars.push_back(parmax); mcpars.push_back(parstepsize); parametermcs.emplace(parname, mcpars); - } catch (runtime_error err) { + } catch (const std::runtime_error &err) { ; } } diff --git a/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h index afd7ac3b728..b89f0bf5de1 100644 --- a/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h +++ b/Framework/CurveFitting/test/Algorithms/SeqDomainSpectrumCreatorTest.h @@ -61,7 +61,7 @@ public: TS_ASSERT_EQUALS(creator.m_matrixWorkspace->getNumberHistograms(), 5); TS_ASSERT_THROWS(creator.setMatrixWorkspace(MatrixWorkspace_sptr()), - std::invalid_argument); + const std::invalid_argument &); } void testGetDomainSize() { @@ -85,7 +85,7 @@ public: void testHistogramIsUsable() { TestableSeqDomainSpectrumCreator creator(nullptr, ""); - TS_ASSERT_THROWS(creator.histogramIsUsable(0), std::invalid_argument); + TS_ASSERT_THROWS(creator.histogramIsUsable(0), const std::invalid_argument &); // Workspace with 2 histograms, one of which is masked (No. 0) std::set<int64_t> masked; diff --git a/Framework/CurveFitting/test/Algorithms/VesuvioCalculateGammaBackgroundTest.h b/Framework/CurveFitting/test/Algorithms/VesuvioCalculateGammaBackgroundTest.h index b0cb4fc02af..3a61f2724f5 100644 --- a/Framework/CurveFitting/test/Algorithms/VesuvioCalculateGammaBackgroundTest.h +++ b/Framework/CurveFitting/test/Algorithms/VesuvioCalculateGammaBackgroundTest.h @@ -184,7 +184,7 @@ public: alg->setRethrows(true); alg->setProperty("InputWorkspace", createTestWorkspaceWithFoilChanger()); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); TS_ASSERT(!alg->isExecuted()); } @@ -194,7 +194,7 @@ public: alg->setProperty("InputWorkspace", createTestWorkspaceWithFoilChanger()); alg->setPropertyValue("ComptonFunction", "name=Gaussian"); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); TS_ASSERT(!alg->isExecuted()); } @@ -205,7 +205,7 @@ public: alg->setProperty("InputWorkspace", createTestWorkspaceWithFoilChanger()); alg->setPropertyValue("ComptonFunction", "name=GaussianComptonProfile;name=Gaussian"); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); TS_ASSERT(!alg->isExecuted()); } diff --git a/Framework/CurveFitting/test/Algorithms/VesuvioCalculateMSTest.h b/Framework/CurveFitting/test/Algorithms/VesuvioCalculateMSTest.h index c89e2e2db69..8e57f384ee9 100644 --- a/Framework/CurveFitting/test/Algorithms/VesuvioCalculateMSTest.h +++ b/Framework/CurveFitting/test/Algorithms/VesuvioCalculateMSTest.h @@ -200,7 +200,7 @@ public: auto testWS = WorkspaceCreationHelper::create2DWorkspace(1, 1); TS_ASSERT_THROWS(alg.setProperty("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void test_setting_workspace_with_no_sample_shape_throws_invalid_argument() { @@ -210,15 +210,15 @@ public: auto testWS = WorkspaceCreationHelper::create2DWorkspace(1, 1); testWS->getAxis(0)->setUnit("TOF"); TS_ASSERT_THROWS(alg.setProperty("InputWorkspace", testWS), - std::invalid_argument); + const std::invalid_argument &); } void test_setting_nmasses_zero_or_negative_throws_invalid_argument() { VesuvioCalculateMS alg; alg.initialize(); - TS_ASSERT_THROWS(alg.setProperty("NoOfMasses", -1), std::invalid_argument); - TS_ASSERT_THROWS(alg.setProperty("NoOfMasses", 0), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("NoOfMasses", -1), const std::invalid_argument &); + TS_ASSERT_THROWS(alg.setProperty("NoOfMasses", 0), const std::invalid_argument &); } void test_setting_sampledensity_zero_or_negative_throws_invalid_argument() { @@ -226,9 +226,9 @@ public: alg.initialize(); TS_ASSERT_THROWS(alg.setProperty("SampleDensity", -1), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(alg.setProperty("SampleDensity", 0), - std::invalid_argument); + const std::invalid_argument &); } void @@ -241,7 +241,7 @@ public: alg->setProperty("AtomicProperties", std::vector<double>(sampleProps, sampleProps + 5)); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void @@ -250,14 +250,14 @@ public: alg.initialize(); TS_ASSERT_THROWS(alg.setProperty("BeamRadius", -1.5), - std::invalid_argument); - TS_ASSERT_THROWS(alg.setProperty("BeamRadius", 0.0), std::invalid_argument); + const std::invalid_argument &); + TS_ASSERT_THROWS(alg.setProperty("BeamRadius", 0.0), const std::invalid_argument &); } void test_input_workspace_with_detector_that_has_no_shape_throws_exception() { auto alg = createTestAlgorithm(createFlatPlateSampleWS(false)); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } }; class VesuvioCalculateMSTestPerformance : public CxxTest::TestSuite { diff --git a/Framework/CurveFitting/test/AugmentedLagrangianOptimizerTest.h b/Framework/CurveFitting/test/AugmentedLagrangianOptimizerTest.h index a87d9c8b22c..627d83ab81e 100644 --- a/Framework/CurveFitting/test/AugmentedLagrangianOptimizerTest.h +++ b/Framework/CurveFitting/test/AugmentedLagrangianOptimizerTest.h @@ -48,12 +48,12 @@ public: AugmentedLagrangianOptimizer::ObjFunction userFunc; TS_ASSERT_THROWS( AugmentedLagrangianOptimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); equality = DblMatrix(1, nparams - 1); // cols < number parameters TS_ASSERT_THROWS( AugmentedLagrangianOptimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); } void @@ -68,12 +68,12 @@ public: AugmentedLagrangianOptimizer::ObjFunction userFunc; TS_ASSERT_THROWS( AugmentedLagrangianOptimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); inequality = DblMatrix(1, nparams - 1); // cols < number parameters TS_ASSERT_THROWS( AugmentedLagrangianOptimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); } void test_minimizer_calls_user_function() { diff --git a/Framework/CurveFitting/test/ComplexMatrixTest.h b/Framework/CurveFitting/test/ComplexMatrixTest.h index 080a5ff945f..6bfe2098169 100644 --- a/Framework/CurveFitting/test/ComplexMatrixTest.h +++ b/Framework/CurveFitting/test/ComplexMatrixTest.h @@ -315,14 +315,14 @@ public: m.set(3, 2, 32); m.set(3, 3, 33); - TS_ASSERT_THROWS(ComplexMatrix subm(m, 2, 2, 3, 3), std::runtime_error); + TS_ASSERT_THROWS(ComplexMatrix subm(m, 2, 2, 3, 3), const std::runtime_error &); } void test_eigenSystem_rectangular_throw() { ComplexMatrix M(3, 4); GSLVector v; ComplexMatrix Q; - TS_ASSERT_THROWS(M.eigenSystemHermitian(v, Q), std::runtime_error); + TS_ASSERT_THROWS(M.eigenSystemHermitian(v, Q), const std::runtime_error &); } void test_small_real_eigenSystem() { diff --git a/Framework/CurveFitting/test/ComplexVectorTest.h b/Framework/CurveFitting/test/ComplexVectorTest.h index 2aebae920ec..84ab1932c80 100644 --- a/Framework/CurveFitting/test/ComplexVectorTest.h +++ b/Framework/CurveFitting/test/ComplexVectorTest.h @@ -182,7 +182,7 @@ public: TS_ASSERT_DELTA(v1.get(2).real(), 888.0, 1e-10); TS_ASSERT_DELTA(v1.get(2).imag(), 0.888, 1e-10); - TS_ASSERT_THROWS(v1 += makeVector3(), std::runtime_error); + TS_ASSERT_THROWS(v1 += makeVector3(), const std::runtime_error &); } void test_minus_operator() { @@ -195,7 +195,7 @@ public: TS_ASSERT_DELTA(v1.get(1).imag(), 0.22, 1e-10); TS_ASSERT_DELTA(v1.get(2).real(), 222.0, 1e-10); TS_ASSERT_DELTA(v1.get(2).imag(), 0.222, 1e-10); - TS_ASSERT_THROWS(v1 -= makeVector3(), std::runtime_error); + TS_ASSERT_THROWS(v1 -= makeVector3(), const std::runtime_error &); } void test_times_operator() { diff --git a/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h index 207cd137df0..420959d6acc 100644 --- a/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h +++ b/Framework/CurveFitting/test/Constraints/BoundaryConstraintTest.h @@ -85,7 +85,7 @@ public: BoundaryConstraint bc; Expression expr; expr.parse("Sigma==20"); - TS_ASSERT_THROWS(bc.initialize(&gaus, expr, false), std::invalid_argument); + TS_ASSERT_THROWS(bc.initialize(&gaus, expr, false), const std::invalid_argument &); } void testInitialize6() { @@ -94,7 +94,7 @@ public: BoundaryConstraint bc; Expression expr; expr.parse("a<Sigma<b"); - TS_ASSERT_THROWS(bc.initialize(&gaus, expr, false), std::invalid_argument); + TS_ASSERT_THROWS(bc.initialize(&gaus, expr, false), const std::invalid_argument &); } // test constructor with lower boundary only diff --git a/Framework/CurveFitting/test/FitMWTest.h b/Framework/CurveFitting/test/FitMWTest.h index 7976f82e357..8cb556c2c3a 100644 --- a/Framework/CurveFitting/test/FitMWTest.h +++ b/Framework/CurveFitting/test/FitMWTest.h @@ -1035,7 +1035,7 @@ public: fit.setProperty("Function", "name=FlatBackground"); fit.setProperty("InputWorkspace", ws); TS_ASSERT_THROWS(fit.setProperty("Exclude", exclude), - std::invalid_argument); + const std::invalid_argument &); } void test_exclude_unordered() { @@ -1048,7 +1048,7 @@ public: fit.setProperty("Function", "name=FlatBackground"); fit.setProperty("InputWorkspace", ws); TS_ASSERT_THROWS(fit.setProperty("Exclude", exclude), - std::invalid_argument); + const std::invalid_argument &); } void test_exclude_overlapped() { diff --git a/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h index b58729baeb0..07564948458 100644 --- a/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h +++ b/Framework/CurveFitting/test/FuncMinimizers/FABADAMinimizerTest.h @@ -288,7 +288,7 @@ public: fit.setProperty("Minimizer", "FABADA,ChainLength=5000,StepsBetweenValues=" "10,ConvergenceCriteria = 0.01"); - TS_ASSERT_THROWS(fit.execute(), std::length_error); + TS_ASSERT_THROWS(fit.execute(), const std::length_error &); TS_ASSERT(!fit.isExecuted()); } diff --git a/Framework/CurveFitting/test/FunctionDomain1DSpectrumCreatorTest.h b/Framework/CurveFitting/test/FunctionDomain1DSpectrumCreatorTest.h index 7c24114819c..6cabd2b9991 100644 --- a/Framework/CurveFitting/test/FunctionDomain1DSpectrumCreatorTest.h +++ b/Framework/CurveFitting/test/FunctionDomain1DSpectrumCreatorTest.h @@ -39,12 +39,12 @@ public: TS_ASSERT_EQUALS(creator.m_workspaceIndexIsSet, false); TS_ASSERT(!creator.m_matrixWorkspace); - TS_ASSERT_THROWS(creator.getDomainSize(), std::invalid_argument); + TS_ASSERT_THROWS(creator.getDomainSize(), const std::invalid_argument &); FunctionDomain_sptr domain; FunctionValues_sptr values; TS_ASSERT_THROWS(creator.createDomain(domain, values), - std::invalid_argument); + const std::invalid_argument &); } void testSetWorkspaceIndex() { @@ -73,19 +73,19 @@ public: TestableFunctionDomain1DSpectrumCreator creator; // throws, because workspace and index are not set. - TS_ASSERT_THROWS(creator.throwIfWorkspaceInvalid(), std::invalid_argument); + TS_ASSERT_THROWS(creator.throwIfWorkspaceInvalid(), const std::invalid_argument &); creator.setMatrixWorkspace( WorkspaceCreationHelper::create2DWorkspace123(10, 15)); // still throws, since workspace index has not been set explicitly. - TS_ASSERT_THROWS(creator.throwIfWorkspaceInvalid(), std::invalid_argument); + TS_ASSERT_THROWS(creator.throwIfWorkspaceInvalid(), const std::invalid_argument &); creator.setWorkspaceIndex(4); TS_ASSERT_THROWS_NOTHING(creator.throwIfWorkspaceInvalid()); creator.setWorkspaceIndex(34); // throws also, because index is invalid - TS_ASSERT_THROWS(creator.throwIfWorkspaceInvalid(), std::invalid_argument); + TS_ASSERT_THROWS(creator.throwIfWorkspaceInvalid(), const std::invalid_argument &); } void testGetDomainSize() { diff --git a/Framework/CurveFitting/test/Functions/BSplineTest.h b/Framework/CurveFitting/test/Functions/BSplineTest.h index 15d86d5ab2e..cbf00ef1b48 100644 --- a/Framework/CurveFitting/test/Functions/BSplineTest.h +++ b/Framework/CurveFitting/test/Functions/BSplineTest.h @@ -50,16 +50,16 @@ public: void test_nonpositive_order() { BSpline bsp; - TS_ASSERT_THROWS(bsp.setAttributeValue("Order", -3), std::invalid_argument); - TS_ASSERT_THROWS(bsp.setAttributeValue("Order", 0), std::invalid_argument); + TS_ASSERT_THROWS(bsp.setAttributeValue("Order", -3), const std::invalid_argument &); + TS_ASSERT_THROWS(bsp.setAttributeValue("Order", 0), const std::invalid_argument &); } void test_nbreak_too_small() { BSpline bsp; - TS_ASSERT_THROWS(bsp.setAttributeValue("NBreak", 1), std::invalid_argument); - TS_ASSERT_THROWS(bsp.setAttributeValue("NBreak", 0), std::invalid_argument); + TS_ASSERT_THROWS(bsp.setAttributeValue("NBreak", 1), const std::invalid_argument &); + TS_ASSERT_THROWS(bsp.setAttributeValue("NBreak", 0), const std::invalid_argument &); TS_ASSERT_THROWS(bsp.setAttributeValue("NBreak", -3), - std::invalid_argument); + const std::invalid_argument &); } void test_set_uniform_break_points() { @@ -124,7 +124,7 @@ public: inputBreaks[6] = 18.0; inputBreaks[7] = 30.0; TS_ASSERT_THROWS(bsp.setAttributeValue("BreakPoints", inputBreaks), - std::invalid_argument); + const std::invalid_argument &); } void test_set_wrong_startx_endx() { @@ -145,7 +145,7 @@ public: FunctionDomain1DVector x(startx, endx, 100); FunctionValues y(x); - TS_ASSERT_THROWS(bsp.function(x, y), std::invalid_argument); + TS_ASSERT_THROWS(bsp.function(x, y), const std::invalid_argument &); startx = 10.0; endx = startx; @@ -159,7 +159,7 @@ public: FunctionDomain1DVector x1(startx, endx, 100); FunctionValues y1(x1); - TS_ASSERT_THROWS(bsp.function(x1, y1), std::invalid_argument); + TS_ASSERT_THROWS(bsp.function(x1, y1), const std::invalid_argument &); } void test_create_with_function_factory_uniform() { diff --git a/Framework/CurveFitting/test/Functions/ChebyshevTest.h b/Framework/CurveFitting/test/Functions/ChebyshevTest.h index 93c2ac39996..4a4729fff34 100644 --- a/Framework/CurveFitting/test/Functions/ChebyshevTest.h +++ b/Framework/CurveFitting/test/Functions/ChebyshevTest.h @@ -41,22 +41,22 @@ public: Chebyshev cheb; cheb.initialize(); - TS_ASSERT_THROWS(cheb.setAttributeValue("A0", 3.3), std::invalid_argument); - TS_ASSERT_THROWS(cheb.setAttributeValue("n", -1), std::invalid_argument); + TS_ASSERT_THROWS(cheb.setAttributeValue("A0", 3.3), const std::invalid_argument &); + TS_ASSERT_THROWS(cheb.setAttributeValue("n", -1), const std::invalid_argument &); } void testZero() { Chebyshev cheb; cheb.initialize(); - TS_ASSERT_THROWS(cheb.setAttributeValue("A1", 3.3), std::invalid_argument); + TS_ASSERT_THROWS(cheb.setAttributeValue("A1", 3.3), const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(cheb.setAttributeValue("n", 0)); } void test_wrongStartEnd() { Chebyshev cheb; cheb.initialize(); - TS_ASSERT_THROWS(cheb.getAttribute("AX"), std::invalid_argument); + TS_ASSERT_THROWS(cheb.getAttribute("AX"), const std::invalid_argument &); TS_ASSERT_EQUALS(cheb.getAttribute("StartX").asDouble(), -1.0); TS_ASSERT_EQUALS(cheb.getAttribute("EndX").asDouble(), 1.0); @@ -71,7 +71,7 @@ public: FunctionDomain1DVector x(startx, endx, 10); FunctionValues y(x); - TS_ASSERT_THROWS(cheb.function(x, y), std::runtime_error); + TS_ASSERT_THROWS(cheb.function(x, y), const std::runtime_error &); startx = 10.0; endx = startx; @@ -85,7 +85,7 @@ public: FunctionDomain1DVector x1(startx, endx, 100); FunctionValues y1(x1); - TS_ASSERT_THROWS(cheb.function(x1, y1), std::runtime_error); + TS_ASSERT_THROWS(cheb.function(x1, y1), const std::runtime_error &); } void testValuesWorkspace() { diff --git a/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h index 4ffb5b7142b..7b1dc1176cb 100644 --- a/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h +++ b/Framework/CurveFitting/test/Functions/ComptonScatteringCountRateTest.h @@ -37,7 +37,7 @@ public: auto countRate = createFunction(); TS_ASSERT_THROWS(countRate->setAttributeValue("IntensityConstraints", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_Incorrect_String_For_Intensity_Attribute_Throws_Error() { @@ -45,7 +45,7 @@ public: TS_ASSERT_THROWS( countRate->setAttributeValue("IntensityConstraints", "Matrix"), - std::invalid_argument); + const std::invalid_argument &); } void test_Single_Row_In_Intensity_Attribute_Does_Not_Throw() { diff --git a/Framework/CurveFitting/test/Functions/CrystalFieldControlTest.h b/Framework/CurveFitting/test/Functions/CrystalFieldControlTest.h index afaf054d59d..156c3bb71b0 100644 --- a/Framework/CurveFitting/test/Functions/CrystalFieldControlTest.h +++ b/Framework/CurveFitting/test/Functions/CrystalFieldControlTest.h @@ -162,7 +162,7 @@ public: // error: Vector of FWHMs must either have same size as Temperatures (1) // or have size 1. std::runtime_error - TS_ASSERT_THROWS(cf.buildSource(), std::runtime_error); + TS_ASSERT_THROWS(cf.buildSource(), const std::runtime_error &); } void xtest_build_7() { diff --git a/Framework/CurveFitting/test/Functions/CrystalFieldMultiSpectrumTest.h b/Framework/CurveFitting/test/Functions/CrystalFieldMultiSpectrumTest.h index 7bf47a0ac53..3be7df19929 100644 --- a/Framework/CurveFitting/test/Functions/CrystalFieldMultiSpectrumTest.h +++ b/Framework/CurveFitting/test/Functions/CrystalFieldMultiSpectrumTest.h @@ -419,7 +419,7 @@ public: auto alg = AlgorithmFactory::Instance().create("EvaluateFunction", -1); alg->initialize(); TS_ASSERT_THROWS(alg->setPropertyValue("Function", fun), - std::invalid_argument); + const std::invalid_argument &); } void test_underdefinded() { diff --git a/Framework/CurveFitting/test/Functions/CrystalFieldPeaksTest.h b/Framework/CurveFitting/test/Functions/CrystalFieldPeaksTest.h index b70905717ac..e2d17e8c22c 100644 --- a/Framework/CurveFitting/test/Functions/CrystalFieldPeaksTest.h +++ b/Framework/CurveFitting/test/Functions/CrystalFieldPeaksTest.h @@ -114,10 +114,10 @@ public: peaks.setAttributeValue("ToleranceIntensity", 0.001 * c_mbsr); peaks.setAttributeValue("Ion", "something"); TS_ASSERT_THROWS(peaks.calculateEigenSystem(en, wf, nre), - std::runtime_error); + const std::runtime_error &); peaks.setAttributeValue("Ion", "S2.4"); TS_ASSERT_THROWS(peaks.calculateEigenSystem(en, wf, nre), - std::runtime_error); + const std::runtime_error &); peaks.setAttributeValue("Ion", "S2.5"); TS_ASSERT_THROWS_NOTHING(peaks.calculateEigenSystem(en, wf, nre)); TS_ASSERT_EQUALS(nre, -5); diff --git a/Framework/CurveFitting/test/Functions/CrystalFieldSpectrumTest.h b/Framework/CurveFitting/test/Functions/CrystalFieldSpectrumTest.h index ddfc6cdd126..ae124318725 100644 --- a/Framework/CurveFitting/test/Functions/CrystalFieldSpectrumTest.h +++ b/Framework/CurveFitting/test/Functions/CrystalFieldSpectrumTest.h @@ -337,28 +337,28 @@ public: std::vector<double> y{1.0, 2.0}; fun.setAttributeValue("FWHMX", x); fun.setAttributeValue("FWHMY", y); - TS_ASSERT_THROWS(fun.buildTargetFunction(), std::runtime_error); + TS_ASSERT_THROWS(fun.buildTargetFunction(), const std::runtime_error &); } { std::vector<double> x{0.0, 50.0}; std::vector<double> y{1.0, 2.0, 3.0}; fun.setAttributeValue("FWHMX", x); fun.setAttributeValue("FWHMY", y); - TS_ASSERT_THROWS(fun.buildTargetFunction(), std::runtime_error); + TS_ASSERT_THROWS(fun.buildTargetFunction(), const std::runtime_error &); } { std::vector<double> x; std::vector<double> y{1.0, 2.0}; fun.setAttributeValue("FWHMX", x); fun.setAttributeValue("FWHMY", y); - TS_ASSERT_THROWS(fun.buildTargetFunction(), std::runtime_error); + TS_ASSERT_THROWS(fun.buildTargetFunction(), const std::runtime_error &); } { std::vector<double> x{0.0, 10.0, 50.0}; std::vector<double> y; fun.setAttributeValue("FWHMX", x); fun.setAttributeValue("FWHMY", y); - TS_ASSERT_THROWS(fun.buildTargetFunction(), std::runtime_error); + TS_ASSERT_THROWS(fun.buildTargetFunction(), const std::runtime_error &); } } diff --git a/Framework/CurveFitting/test/Functions/CubicSplineTest.h b/Framework/CurveFitting/test/Functions/CubicSplineTest.h index b520d980d52..5145c4e8afc 100644 --- a/Framework/CurveFitting/test/Functions/CubicSplineTest.h +++ b/Framework/CurveFitting/test/Functions/CubicSplineTest.h @@ -61,13 +61,15 @@ public: CubicSpline cspline; // cubic splines must have at least 3 points - TS_ASSERT_THROWS(cspline.setAttributeValue("n", 2), std::invalid_argument); + TS_ASSERT_THROWS(cspline.setAttributeValue("n", 2), + const std::invalid_argument &); // set the number of points to something sensible cspline.setAttributeValue("n", 5); // attempt to make it smaller than it already is - TS_ASSERT_THROWS(cspline.setAttributeValue("n", 4), std::invalid_argument); + TS_ASSERT_THROWS(cspline.setAttributeValue("n", 4), + const std::invalid_argument &); size_t oldAttrN = cspline.nAttributes(); @@ -99,9 +101,9 @@ public: CubicSpline cspline; // check that an invalid index throws errors - TS_ASSERT_THROWS(cspline.setXAttribute(4, 0), std::range_error); + TS_ASSERT_THROWS(cspline.setXAttribute(4, 0), const std::range_error &); - TS_ASSERT_THROWS(cspline.setXAttribute(-1, 4), std::range_error); + TS_ASSERT_THROWS(cspline.setXAttribute(-1, 4), const std::range_error &); } void testKnownInterpolationValues() { diff --git a/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h index 5ec97da21a6..8ed1dae82fb 100644 --- a/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h +++ b/Framework/CurveFitting/test/Functions/FullprofPolynomialTest.h @@ -40,13 +40,13 @@ public: void test_negative() { FullprofPolynomial tofbkgd; tofbkgd.initialize(); - TS_ASSERT_THROWS(tofbkgd.setAttributeValue("n", -3), std::invalid_argument); + TS_ASSERT_THROWS(tofbkgd.setAttributeValue("n", -3), const std::invalid_argument &); } void test_zero() { FullprofPolynomial tofbkgd; tofbkgd.initialize(); - TS_ASSERT_THROWS(tofbkgd.setAttributeValue("n", 0), std::runtime_error); + TS_ASSERT_THROWS(tofbkgd.setAttributeValue("n", 0), const std::runtime_error &); } void test_calculate() { diff --git a/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h index dc507ca2178..0af361f3683 100644 --- a/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h +++ b/Framework/CurveFitting/test/Functions/GramCharlierComptonProfileTest.h @@ -57,7 +57,7 @@ public: TSM_ASSERT_THROWS_NOTHING("Function should have a C_0 parameter", profile->getParameter("C_0")); TSM_ASSERT_THROWS("Function should not have a C_2 parameter", - profile->getParameter("C_2"), std::invalid_argument); + profile->getParameter("C_2"), const std::invalid_argument &); TSM_ASSERT_THROWS_NOTHING("Function should have a C_4 parameter", profile->getParameter("C_4")); } diff --git a/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h index 4bfb3193caa..45203365910 100644 --- a/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h +++ b/Framework/CurveFitting/test/Functions/LinearBackgroundTest.h @@ -43,8 +43,8 @@ public: LinearBackground lin; lin.initialize(); // set up fitting function - TS_ASSERT_THROWS(lin.setParameter("X", 1.0), std::invalid_argument); - TS_ASSERT_THROWS(lin.setParameter("A9", 1.0), std::invalid_argument); + TS_ASSERT_THROWS(lin.setParameter("X", 1.0), const std::invalid_argument &); + TS_ASSERT_THROWS(lin.setParameter("A9", 1.0), const std::invalid_argument &); const double a1 = 2; const double a0 = 0.3; diff --git a/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h index 4290ca8c611..cf3eaf84cdc 100644 --- a/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PawleyFunctionTest.h @@ -114,7 +114,7 @@ public: // invalid string TS_ASSERT_THROWS(fn.setAttributeValue("LatticeSystem", "invalid"), - std::invalid_argument); + const std::invalid_argument &); } void testLatticeSystemConstraintsCubic() { @@ -128,11 +128,11 @@ public: fn.setParameter("a", 3.0); TS_ASSERT_EQUALS(fn.getParameter("a"), 3.0); - TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("c"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("b"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("c"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Beta"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), const std::invalid_argument &); UnitCell cell = fn.getUnitCellFromParameters(); cellParametersAre(cell, 3.0, 3.0, 3.0, 90.0, 90.0, 90.0); @@ -151,10 +151,10 @@ public: fn.setParameter("c", 5.0); TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); - TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("b"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Beta"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), const std::invalid_argument &); UnitCell cell = fn.getUnitCellFromParameters(); cellParametersAre(cell, 3.0, 3.0, 5.0, 90.0, 90.0, 90.0); @@ -173,10 +173,10 @@ public: fn.setParameter("c", 5.0); TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); - TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("b"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Beta"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), const std::invalid_argument &); UnitCell cell = fn.getUnitCellFromParameters(); cellParametersAre(cell, 3.0, 3.0, 5.0, 90.0, 90.0, 120.0); @@ -195,10 +195,10 @@ public: fn.setParameter("Alpha", 101.0); TS_ASSERT_EQUALS(fn.getParameter("Alpha"), 101.0); - TS_ASSERT_THROWS(fn.getParameter("b"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("c"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("b"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("c"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Beta"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), const std::invalid_argument &); UnitCell cell = fn.getUnitCellFromParameters(); cellParametersAre(cell, 3.0, 3.0, 3.0, 101.0, 101.0, 101.0); @@ -219,9 +219,9 @@ public: fn.setParameter("c", 5.0); TS_ASSERT_EQUALS(fn.getParameter("c"), 5.0); - TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Beta"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Beta"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), const std::invalid_argument &); UnitCell cell = fn.getUnitCellFromParameters(); cellParametersAre(cell, 3.0, 4.0, 5.0, 90.0, 90.0, 90.0); @@ -244,8 +244,8 @@ public: fn.setParameter("Beta", 101.0); TS_ASSERT_EQUALS(fn.getParameter("Beta"), 101.0); - TS_ASSERT_THROWS(fn.getParameter("Alpha"), std::invalid_argument); - TS_ASSERT_THROWS(fn.getParameter("Gamma"), std::invalid_argument); + TS_ASSERT_THROWS(fn.getParameter("Alpha"), const std::invalid_argument &); + TS_ASSERT_THROWS(fn.getParameter("Gamma"), const std::invalid_argument &); UnitCell cell = fn.getUnitCellFromParameters(); cellParametersAre(cell, 3.0, 4.0, 5.0, 90.0, 101.0, 90.0); @@ -311,10 +311,10 @@ public: // works only with IPeakFunctions TS_ASSERT_THROWS(fn.setAttributeValue("ProfileFunction", "Chebyshev"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(fn.setAttributeValue("ProfileFunction", "DoesNotExist"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void testPawleyFunctionInitialization() { diff --git a/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h index aabf2d71216..0ec249d4e06 100644 --- a/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/PeakParameterFunctionTest.h @@ -101,9 +101,9 @@ public: FunctionValues values(domain); Mantid::CurveFitting::Jacobian jacobian(domain.size(), 3); - TS_ASSERT_THROWS(fn->function(domain, values), std::invalid_argument); + TS_ASSERT_THROWS(fn->function(domain, values), const std::invalid_argument &); TS_ASSERT_THROWS(fn->functionDeriv(domain, jacobian), - std::invalid_argument); + const std::invalid_argument &); } void testNoFunctionSet() { @@ -118,8 +118,8 @@ public: FunctionValues values(domain); Mantid::CurveFitting::Jacobian jacobian(domain.size(), 3); - TS_ASSERT_THROWS(fn->function(domain, values), std::runtime_error); - TS_ASSERT_THROWS(fn->functionDeriv(domain, jacobian), std::runtime_error); + TS_ASSERT_THROWS(fn->function(domain, values), const std::runtime_error &); + TS_ASSERT_THROWS(fn->functionDeriv(domain, jacobian), const std::runtime_error &); } void testBeforeDecoratedFunctionSet() { @@ -132,7 +132,7 @@ public: TS_ASSERT_THROWS_NOTHING(fn->setDecoratedFunction("Gaussian")); TS_ASSERT_THROWS(fn->setDecoratedFunction("Chebyshev"), - std::invalid_argument); + const std::invalid_argument &); } }; diff --git a/Framework/CurveFitting/test/Functions/PolynomialTest.h b/Framework/CurveFitting/test/Functions/PolynomialTest.h index 837e3b934bd..c1ceb3789fa 100644 --- a/Framework/CurveFitting/test/Functions/PolynomialTest.h +++ b/Framework/CurveFitting/test/Functions/PolynomialTest.h @@ -39,13 +39,13 @@ public: Polynomial pol; pol.initialize(); - TS_ASSERT_THROWS(pol.setParameter("X", 1.0), std::invalid_argument); + TS_ASSERT_THROWS(pol.setParameter("X", 1.0), const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(pol.setAttributeValue("n", 3)); - TS_ASSERT_THROWS(pol.setParameter("A99", 0.0), std::invalid_argument); + TS_ASSERT_THROWS(pol.setParameter("A99", 0.0), const std::invalid_argument &); Polynomial pol2; pol2.initialize(); - TS_ASSERT_THROWS(pol2.setAttributeValue("n", -1), std::invalid_argument); + TS_ASSERT_THROWS(pol2.setAttributeValue("n", -1), const std::invalid_argument &); Polynomial pol3; pol3.initialize(); diff --git a/Framework/CurveFitting/test/Functions/QuadraticTest.h b/Framework/CurveFitting/test/Functions/QuadraticTest.h index fa88536d1a9..52647767f66 100644 --- a/Framework/CurveFitting/test/Functions/QuadraticTest.h +++ b/Framework/CurveFitting/test/Functions/QuadraticTest.h @@ -39,9 +39,9 @@ public: Quadratic quad; quad.initialize(); - TS_ASSERT_THROWS(quad.setParameter("X", 1.0), std::invalid_argument); - TS_ASSERT_THROWS(quad.setAttributeValue("n", 3), std::invalid_argument); - TS_ASSERT_THROWS(quad.setParameter("A99", 0.0), std::invalid_argument); + TS_ASSERT_THROWS(quad.setParameter("X", 1.0), const std::invalid_argument &); + TS_ASSERT_THROWS(quad.setAttributeValue("n", 3), const std::invalid_argument &); + TS_ASSERT_THROWS(quad.setParameter("A99", 0.0), const std::invalid_argument &); } void test_calculate() { diff --git a/Framework/CurveFitting/test/Functions/StretchExpTest.h b/Framework/CurveFitting/test/Functions/StretchExpTest.h index 09263fe1a82..fb2f11a2147 100644 --- a/Framework/CurveFitting/test/Functions/StretchExpTest.h +++ b/Framework/CurveFitting/test/Functions/StretchExpTest.h @@ -56,7 +56,7 @@ public: fn.setParameter("Height", 1.5); fn.setParameter("Lifetime", 5.0); fn.setParameter("Stretching", 0.4); - TS_ASSERT_THROWS(fn.function(x, y), std::runtime_error); + TS_ASSERT_THROWS(fn.function(x, y), const std::runtime_error &); } }; diff --git a/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h index 7cea9892a64..b869fe0a4cf 100644 --- a/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h +++ b/Framework/CurveFitting/test/Functions/TabulatedFunctionTest.h @@ -186,14 +186,14 @@ public: fun.setAttributeValue("WorkspaceIndex", 20); FunctionDomain1DVector x(-5.0, 5.0, 83); FunctionValues y(x); - TS_ASSERT_THROWS(fun.function(x, y), std::range_error); + TS_ASSERT_THROWS(fun.function(x, y), const std::range_error &); AnalysisDataService::Instance().clear(); } void test_loadWorkspaceWhichDoesNotExist() { TabulatedFunction fun; TS_ASSERT_THROWS(fun.setAttributeValue("Workspace", "SomeWorkspace"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void test_Derivatives() { diff --git a/Framework/CurveFitting/test/GSLMatrixTest.h b/Framework/CurveFitting/test/GSLMatrixTest.h index 53255227efd..e3fcfc8af24 100644 --- a/Framework/CurveFitting/test/GSLMatrixTest.h +++ b/Framework/CurveFitting/test/GSLMatrixTest.h @@ -220,14 +220,14 @@ public: m.set(3, 2, 32); m.set(3, 3, 33); - TS_ASSERT_THROWS(GSLMatrix subm(m, 2, 2, 3, 3), std::runtime_error); + TS_ASSERT_THROWS(GSLMatrix subm(m, 2, 2, 3, 3), const std::runtime_error &); } void test_eigenSystem_rectangular_throw() { GSLMatrix M(3, 4); GSLVector v; GSLMatrix Q; - TS_ASSERT_THROWS(M.eigenSystem(v, Q), std::runtime_error); + TS_ASSERT_THROWS(M.eigenSystem(v, Q), const std::runtime_error &); } void test_eigenSystem() { @@ -382,7 +382,7 @@ public: TS_ASSERT_EQUALS(m(2, 1), -3.0); TS_ASSERT_THROWS(GSLMatrix({{1.0, 2.0}, {4.0, 2.0, 0.0}, {-1.0, -3.0}}), - std::runtime_error); + const std::runtime_error &); } void test_vector_mul() { @@ -401,7 +401,7 @@ public: GSLMatrix m({{0.0, 0.0}, {0.0, 0.0}}); GSLVector b({1.0, 2.0}); GSLVector x; - TS_ASSERT_THROWS(m.solve(b, x), std::runtime_error); + TS_ASSERT_THROWS(m.solve(b, x), const std::runtime_error &); } void test_solve_singular_1() { @@ -409,7 +409,7 @@ public: GSLMatrix m({{1.0, 2.0}, {2.0, 4.0}}); GSLVector b({1.0, 2.0}); GSLVector x; - TS_ASSERT_THROWS(m.solve(b, x), std::runtime_error); + TS_ASSERT_THROWS(m.solve(b, x), const std::runtime_error &); } void test_solve() { diff --git a/Framework/CurveFitting/test/GSLVectorTest.h b/Framework/CurveFitting/test/GSLVectorTest.h index 4bf7a35957e..b55bb47c3fc 100644 --- a/Framework/CurveFitting/test/GSLVectorTest.h +++ b/Framework/CurveFitting/test/GSLVectorTest.h @@ -175,7 +175,7 @@ public: TS_ASSERT_EQUALS(v1[1], 88); TS_ASSERT_EQUALS(v1[2], 888); - TS_ASSERT_THROWS(v1 += makeVector3(), std::runtime_error); + TS_ASSERT_THROWS(v1 += makeVector3(), const std::runtime_error &); } void test_minus_operator() { @@ -187,7 +187,7 @@ public: TS_ASSERT_EQUALS(v1[1], 22); TS_ASSERT_EQUALS(v1[2], 222); - TS_ASSERT_THROWS(v1 -= makeVector3(), std::runtime_error); + TS_ASSERT_THROWS(v1 -= makeVector3(), const std::runtime_error &); } void test_times_operator() { @@ -212,7 +212,7 @@ public: auto v1 = makeVector1(); auto v2 = makeVector2(); TS_ASSERT_DELTA(v1.dot(v2), 3.0 * 5.0 + 33.0 * 55.0 + 333.0 * 555.0, 1e-10); - TS_ASSERT_THROWS(v1.dot(makeVector3()), std::runtime_error); + TS_ASSERT_THROWS(v1.dot(makeVector3()), const std::runtime_error &); } void test_find_min_element() { diff --git a/Framework/CurveFitting/test/HistogramDomainCreatorTest.h b/Framework/CurveFitting/test/HistogramDomainCreatorTest.h index 2eebe835c18..67490806d4a 100644 --- a/Framework/CurveFitting/test/HistogramDomainCreatorTest.h +++ b/Framework/CurveFitting/test/HistogramDomainCreatorTest.h @@ -69,7 +69,7 @@ public: manager.setProperty("InputWorkspace", ws); FunctionDomain_sptr domain; FunctionValues_sptr values; - TS_ASSERT_THROWS(creator.createDomain(domain, values), std::runtime_error); + TS_ASSERT_THROWS(creator.createDomain(domain, values), const std::runtime_error &); } void test_domain_values() { diff --git a/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h b/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h index fe7ff4d0100..943a1e2886b 100644 --- a/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h +++ b/Framework/CurveFitting/test/IPeakFunctionIntensityTest.h @@ -124,7 +124,7 @@ private: // for Ikeda-Carpenter it's not allowed to set Fwhm try { peak->setFwhm(parameters.fwhm); - } catch (std::invalid_argument) { + } catch (const std::invalid_argument &) { } peak->setHeight(parameters.height); @@ -132,7 +132,7 @@ private: // PeudoVoigt requires an explicit set for mixing parameters try { peak->setParameter("Mixing", 0.5); - } catch (std::invalid_argument) { + } catch (const std::invalid_argument &) { } } } diff --git a/Framework/CurveFitting/test/LatticeDomainCreatorTest.h b/Framework/CurveFitting/test/LatticeDomainCreatorTest.h index 7a0cb74339a..d6efd2bb2fe 100644 --- a/Framework/CurveFitting/test/LatticeDomainCreatorTest.h +++ b/Framework/CurveFitting/test/LatticeDomainCreatorTest.h @@ -111,10 +111,10 @@ public: FunctionValues_sptr values; TS_ASSERT_THROWS(dc.createDomainFromPeakTable(invalid, domain, values, 0), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(dc.createDomainFromPeakTable(empty, domain, values, 0), - std::range_error); + const std::range_error &); } void testCreateDomainPeaksWorkspace() { diff --git a/Framework/CurveFitting/test/LatticeFunctionTest.h b/Framework/CurveFitting/test/LatticeFunctionTest.h index 6b9399a3893..e6114da7c11 100644 --- a/Framework/CurveFitting/test/LatticeFunctionTest.h +++ b/Framework/CurveFitting/test/LatticeFunctionTest.h @@ -37,7 +37,7 @@ public: TS_ASSERT_THROWS_NOTHING(fn.setLatticeSystem("triclinic")); TS_ASSERT_THROWS(fn.setLatticeSystem("DoesNotExist"), - std::invalid_argument); + const std::invalid_argument &); fn.setLatticeSystem("Cubic"); // a and ZeroShift diff --git a/Framework/DataHandling/src/AsciiPointBase.cpp b/Framework/DataHandling/src/AsciiPointBase.cpp index 0dd0dbda1fe..b393938bc10 100644 --- a/Framework/DataHandling/src/AsciiPointBase.cpp +++ b/Framework/DataHandling/src/AsciiPointBase.cpp @@ -72,7 +72,7 @@ void AsciiPointBase::exec() { throw std::runtime_error("Cannot treat InputWorkspace"); try { m_length = m_ws->y(0).size(); - } catch (std::range_error) { + } catch (const std::range_error &) { g_log.error("InputWorkspace does not contain data"); } extraHeaders(file); diff --git a/Framework/DataHandling/src/LoadBBY.cpp b/Framework/DataHandling/src/LoadBBY.cpp index 78af3f5f348..fa5f58d4d5d 100644 --- a/Framework/DataHandling/src/LoadBBY.cpp +++ b/Framework/DataHandling/src/LoadBBY.cpp @@ -308,7 +308,7 @@ void LoadBBY::exec() { auto getParam = [&allParams](std::string tag, double defValue) { try { return std::stod(allParams[tag]); - } catch (std::invalid_argument) { + } catch (const std::invalid_argument &) { return defValue; } }; @@ -512,7 +512,7 @@ void LoadBBY::loadInstrumentParameters( << hdfTag << ", using default.\n"; } - } catch (std::invalid_argument) { + } catch (const std::invalid_argument &) { g_log.warning() << "Invalid format for BILBY parameter " << x.first << std::endl; } @@ -613,7 +613,7 @@ void LoadBBY::createInstrument(ANSTO::Tar::File &tarFile, try { logParams["L1_chopper_value"] = logParams["Ltof_det_value"] - logParams["L2_det_value"]; - } catch (std::invalid_argument) { + } catch (const std::invalid_argument &) { logParams["L1_chopper_value"] = 18.47258984375; g_log.warning() << "Cannot find parameter 'L1_chopper_value'" << ", using default.\n"; diff --git a/Framework/DataHandling/src/LoadILLSANS.cpp b/Framework/DataHandling/src/LoadILLSANS.cpp index 4763862e6f6..434ed8c454b 100644 --- a/Framework/DataHandling/src/LoadILLSANS.cpp +++ b/Framework/DataHandling/src/LoadILLSANS.cpp @@ -316,7 +316,7 @@ void LoadILLSANS::initWorkSpaceD33(NeXus::NXEntry &firstEntry, channelWidthSum, channelWidthTimes); binningUp = getVariableTimeBinning(firstEntry, distancePrefix + "5", channelWidthSum, channelWidthTimes); - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { vtof = false; } if (!vtof) { @@ -632,10 +632,10 @@ void LoadILLSANS::loadMetaData(const NeXus::NXEntry &entry, const std::string entryResolution = instrumentNamePath + "/selector/"; try { wavelengthRes = entry.getFloat(entryResolution + "wavelength_res"); - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { try { wavelengthRes = entry.getFloat(entryResolution + "wave_length_res"); - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { g_log.warning("Could not find wavelength resolution, assuming 10%"); } } diff --git a/Framework/DataHandling/src/LoadMuonNexus1.cpp b/Framework/DataHandling/src/LoadMuonNexus1.cpp index c7fc6b900a2..d70c5fe0253 100644 --- a/Framework/DataHandling/src/LoadMuonNexus1.cpp +++ b/Framework/DataHandling/src/LoadMuonNexus1.cpp @@ -671,7 +671,7 @@ void LoadMuonNexus1::loadData(size_t hist, specnum_t &i, specnum_t specNo, // Create and fill another vector for the X axis auto timeChannels = new float[lengthIn + 1](); - nxload.getTimeChannels(timeChannels, static_cast<const int>(lengthIn + 1)); + nxload.getTimeChannels(timeChannels, static_cast<int>(lengthIn + 1)); // Put the read in array into a vector (inside a shared pointer) localWorkspace->setHistogram( diff --git a/Framework/DataHandling/src/LoadNexusLogs.cpp b/Framework/DataHandling/src/LoadNexusLogs.cpp index 15b7a7fd935..17a6176c1c9 100644 --- a/Framework/DataHandling/src/LoadNexusLogs.cpp +++ b/Framework/DataHandling/src/LoadNexusLogs.cpp @@ -32,8 +32,8 @@ using API::FileProperty; using API::MatrixWorkspace; using API::MatrixWorkspace_sptr; using API::WorkspaceProperty; -using Types::Core::DateAndTime; using std::size_t; +using Types::Core::DateAndTime; // Anonymous namespace namespace { @@ -156,9 +156,9 @@ void appendEndTimeLog(Kernel::Property *prop, const API::Run &run) { return; tsLog->addValue(endTime, tsLog->lastValue()); - } catch (Exception::NotFoundError) { + } catch (const Exception::NotFoundError &) { // pass - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { // pass } } diff --git a/Framework/DataHandling/test/CompressEventsTest.h b/Framework/DataHandling/test/CompressEventsTest.h index 64c8568bfb1..eb1997ec3a3 100644 --- a/Framework/DataHandling/test/CompressEventsTest.h +++ b/Framework/DataHandling/test/CompressEventsTest.h @@ -34,7 +34,7 @@ public: CompressEvents alg; TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("Tolerance", "-1.0"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Tolerance", "0.0")); } diff --git a/Framework/DataHandling/test/CreateChopperModelTest.h b/Framework/DataHandling/test/CreateChopperModelTest.h index 7ac1082b888..1faefbeece8 100644 --- a/Framework/DataHandling/test/CreateChopperModelTest.h +++ b/Framework/DataHandling/test/CreateChopperModelTest.h @@ -46,14 +46,14 @@ public: void test_ModelType_Is_Not_Valid_By_Default() { Mantid::API::IAlgorithm_sptr alg = createAlgorithm(m_inputName); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_Algorithm_Throws_If_Chopper_Model_Is_Unknown() { Mantid::API::IAlgorithm_sptr alg = createAlgorithm(m_inputName); TS_ASSERT_THROWS(alg->setPropertyValue("ModelType", "gibberish"), - std::invalid_argument); + const std::invalid_argument &); } void test_Setting_Parameter_String_Throws_If_It_Is_Empty() { @@ -61,7 +61,7 @@ public: createAlgorithm(m_inputName, "FermiChopperModel"); TS_ASSERT_THROWS(alg->setPropertyValue("Parameters", ""), - std::invalid_argument); + const std::invalid_argument &); } void diff --git a/Framework/DataHandling/test/CreateModeratorModelTest.h b/Framework/DataHandling/test/CreateModeratorModelTest.h index f6e7ebf393d..172b3e366cc 100644 --- a/Framework/DataHandling/test/CreateModeratorModelTest.h +++ b/Framework/DataHandling/test/CreateModeratorModelTest.h @@ -46,14 +46,14 @@ public: void test_ModelType_Is_Not_Valid_By_Default() { IAlgorithm_sptr alg = createAlgorithm(m_inputName); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_Algorithm_Throws_If_Moderator_Model_Is_Unknown() { IAlgorithm_sptr alg = createAlgorithm(m_inputName); TS_ASSERT_THROWS(alg->setPropertyValue("ModelType", "gibberish"), - std::invalid_argument); + const std::invalid_argument &); } void test_Setting_Parameter_String_Throws_If_It_Is_Empty() { @@ -61,7 +61,7 @@ public: createAlgorithm(m_inputName, "IkedaCarpenterModerator"); TS_ASSERT_THROWS(alg->setPropertyValue("Parameters", ""), - std::invalid_argument); + const std::invalid_argument &); } void diff --git a/Framework/DataHandling/test/CreatePolarizationEfficienciesTest.h b/Framework/DataHandling/test/CreatePolarizationEfficienciesTest.h index 880b248c316..845f039267c 100644 --- a/Framework/DataHandling/test/CreatePolarizationEfficienciesTest.h +++ b/Framework/DataHandling/test/CreatePolarizationEfficienciesTest.h @@ -48,7 +48,7 @@ public: alg.initialize(); alg.setProperty("InputWorkspace", inWS); alg.setPropertyValue("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_mixed_input() { @@ -64,7 +64,7 @@ public: alg.setPropertyValue("Ap", "0,1,0,0"); alg.setPropertyValue("F1", "0,0,1,0"); alg.setPropertyValue("F2", "0,0,0,1"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_histo() { diff --git a/Framework/DataHandling/test/CreateSimulationWorkspaceTest.h b/Framework/DataHandling/test/CreateSimulationWorkspaceTest.h index e217105430c..64a86634f7d 100644 --- a/Framework/DataHandling/test/CreateSimulationWorkspaceTest.h +++ b/Framework/DataHandling/test/CreateSimulationWorkspaceTest.h @@ -50,7 +50,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg->setPropertyValue("Instrument", "__NOT_AN_INSTRUMENT__")); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -142,7 +142,7 @@ public: alg->initialize(); TS_ASSERT_THROWS(alg->setPropertyValue("UnitX", "NOT_A_UNIT"), - std::invalid_argument); + const std::invalid_argument &); } void test_UnitX_Parameter_Is_DeltaE_By_Default() { diff --git a/Framework/DataHandling/test/ExtractPolarizationEfficienciesTest.h b/Framework/DataHandling/test/ExtractPolarizationEfficienciesTest.h index b7e5087e1d0..651ee47b3d8 100644 --- a/Framework/DataHandling/test/ExtractPolarizationEfficienciesTest.h +++ b/Framework/DataHandling/test/ExtractPolarizationEfficienciesTest.h @@ -55,7 +55,7 @@ public: alg.setRethrows(true); alg.setProperty("InputWorkspace", workspace); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_wrong_method() { @@ -66,7 +66,7 @@ public: alg.setRethrows(true); alg.setProperty("InputWorkspace", workspace); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_no_lambda() { @@ -78,7 +78,7 @@ public: alg.setRethrows(true); alg.setProperty("InputWorkspace", workspace); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_space_sep() { @@ -132,7 +132,7 @@ public: alg.setRethrows(true); alg.setProperty("InputWorkspace", workspace); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_non_number() { @@ -144,7 +144,7 @@ public: alg.setRethrows(true); alg.setProperty("InputWorkspace", workspace); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_new_line_sep() { @@ -178,7 +178,7 @@ public: alg.setRethrows(true); alg.setProperty("InputWorkspace", workspace); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_Fredrikze() { diff --git a/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h b/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h index 7520e65258e..99d7f8a9dc5 100644 --- a/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h +++ b/Framework/DataHandling/test/FilterEventsByLogValuePreNexusTest.h @@ -44,7 +44,7 @@ public: filteralg.initialize(); TS_ASSERT_THROWS(filteralg.setProperty( "EventFilename", "this_file_doesnt_exist.blabla.data"), - std::invalid_argument); + const std::invalid_argument &); } void test_setProperty() { diff --git a/Framework/DataHandling/test/GroupDetectors2Test.h b/Framework/DataHandling/test/GroupDetectors2Test.h index e21a3322a72..35169f94ad3 100644 --- a/Framework/DataHandling/test/GroupDetectors2Test.h +++ b/Framework/DataHandling/test/GroupDetectors2Test.h @@ -938,7 +938,7 @@ public: // Check that the GroupingPattern was recognised as invalid TS_ASSERT(!groupAlg.validateInputs()["GroupingPattern"].empty()); // And that we're not allowed to run - TS_ASSERT_THROWS(groupAlg.execute(), std::runtime_error); + TS_ASSERT_THROWS(groupAlg.execute(), const std::runtime_error &); } void test_grouping_with_time_indexes() { diff --git a/Framework/DataHandling/test/JoinISISPolarizationEfficienciesTest.h b/Framework/DataHandling/test/JoinISISPolarizationEfficienciesTest.h index f132d04b0c0..a3348a991d8 100644 --- a/Framework/DataHandling/test/JoinISISPolarizationEfficienciesTest.h +++ b/Framework/DataHandling/test/JoinISISPolarizationEfficienciesTest.h @@ -53,7 +53,7 @@ public: alg.setRethrows(true); alg.setPropertyValue("OutputWorkspace", "dummy"); // Error: At least one of the efficiency file names must be set. - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_mixed_input() { @@ -72,7 +72,7 @@ public: alg.setProperty("P2", ws4); alg.setPropertyValue("OutputWorkspace", "dummy"); // Error: Efficiencies belonging to different methods cannot mix. - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_fredrikze() { @@ -349,7 +349,7 @@ public: alg.setProperty("F2", ws4); alg.setPropertyValue("OutputWorkspace", "dummy"); // Error: Cannot mix histograms and point data. - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } void test_ragged() { diff --git a/Framework/DataHandling/test/LoadBBYTest.h b/Framework/DataHandling/test/LoadBBYTest.h index eee09a3b903..f5e04d40e1d 100644 --- a/Framework/DataHandling/test/LoadBBYTest.h +++ b/Framework/DataHandling/test/LoadBBYTest.h @@ -45,7 +45,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); // should succeed now std::string inputFile = "BBY0000014.tar"; diff --git a/Framework/DataHandling/test/LoadCanSAS1dTest.h b/Framework/DataHandling/test/LoadCanSAS1dTest.h index e086146ea88..0597730ec96 100644 --- a/Framework/DataHandling/test/LoadCanSAS1dTest.h +++ b/Framework/DataHandling/test/LoadCanSAS1dTest.h @@ -32,7 +32,7 @@ public: cansas1d.initialize(); // No parameters have been set yet, so it should throw - TS_ASSERT_THROWS(cansas1d.execute(), std::runtime_error); + TS_ASSERT_THROWS(cansas1d.execute(), const std::runtime_error &); // Set the file name cansas1d.setPropertyValue("Filename", inputFile); diff --git a/Framework/DataHandling/test/LoadDetectorInfoTest.h b/Framework/DataHandling/test/LoadDetectorInfoTest.h index fa22d07192c..d14fd686e4f 100644 --- a/Framework/DataHandling/test/LoadDetectorInfoTest.h +++ b/Framework/DataHandling/test/LoadDetectorInfoTest.h @@ -275,7 +275,7 @@ public: makeTestWorkspace(SmallTestDatFile::NDETECTS, NBINS, m_InoutWS); loadDetInfo.setPropertyValue("Workspace", m_InoutWS); loadDetInfo.setPropertyValue("DataFilename", "argus0026287.nxs"); - TS_ASSERT_THROWS(loadDetInfo.execute(), std::invalid_argument); + TS_ASSERT_THROWS(loadDetInfo.execute(), const std::invalid_argument &); AnalysisDataService::Instance().remove(m_InoutWS); } diff --git a/Framework/DataHandling/test/LoadEMUauTest.h b/Framework/DataHandling/test/LoadEMUauTest.h index 78d7661a5bf..86c16e69bec 100644 --- a/Framework/DataHandling/test/LoadEMUauTest.h +++ b/Framework/DataHandling/test/LoadEMUauTest.h @@ -45,7 +45,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); // should succeed now std::string inputFile = "EMU0006330.tar"; diff --git a/Framework/DataHandling/test/LoadEventNexusIndexSetupTest.h b/Framework/DataHandling/test/LoadEventNexusIndexSetupTest.h index d9c39d2076a..89b791b43a1 100644 --- a/Framework/DataHandling/test/LoadEventNexusIndexSetupTest.h +++ b/Framework/DataHandling/test/LoadEventNexusIndexSetupTest.h @@ -73,27 +73,27 @@ public: void test_makeIndexInfo_min_out_of_range() { for (const auto min : {0, 3, 13}) { LoadEventNexusIndexSetup indexSetup(m_ws, min, EMPTY_INT(), {}); - TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), std::out_of_range); + TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), const std::out_of_range &); } } void test_makeIndexInfo_max_out_of_range() { for (const auto max : {0, 3, 13}) { LoadEventNexusIndexSetup indexSetup(m_ws, EMPTY_INT(), max, {}); - TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), std::out_of_range); + TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), const std::out_of_range &); } } void test_makeIndexInfo_range_out_of_range() { for (const auto i : {0, 3, 13}) { LoadEventNexusIndexSetup indexSetup(m_ws, EMPTY_INT(), EMPTY_INT(), {i}); - TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), std::out_of_range); + TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), const std::out_of_range &); } } void test_makeIndexInfo_range_includes_monitor() { LoadEventNexusIndexSetup indexSetup(m_ws, EMPTY_INT(), EMPTY_INT(), {666}); - TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), std::out_of_range); + TS_ASSERT_THROWS(indexSetup.makeIndexInfo(), const std::out_of_range &); } void test_makeIndexInfo_min() { @@ -335,7 +335,7 @@ public: auto spec = {1}; auto udet = {666}; TS_ASSERT_THROWS(indexSetup.makeIndexInfo({spec, udet}, false), - std::out_of_range); + const std::out_of_range &); } void test_makeIndexInfo_from_isis_spec_udet_monitors() { diff --git a/Framework/DataHandling/test/LoadEventNexusTest.h b/Framework/DataHandling/test/LoadEventNexusTest.h index 2d83e6f3a53..fca76fd3906 100644 --- a/Framework/DataHandling/test/LoadEventNexusTest.h +++ b/Framework/DataHandling/test/LoadEventNexusTest.h @@ -349,7 +349,7 @@ public: // Test that asking not to load the logs did what it should // Make sure that we throw if we try to read a log (that shouldn't be there) - TS_ASSERT_THROWS(WS->getLog("proton_charge"), std::invalid_argument); + TS_ASSERT_THROWS(WS->getLog("proton_charge"), const std::invalid_argument &); //----- Now we re-load with precounting and compare memory use ---- LoadEventNexus ld2; diff --git a/Framework/DataHandling/test/LoadEventPreNexus2Test.h b/Framework/DataHandling/test/LoadEventPreNexus2Test.h index 6c347bf2090..30f8d8c70ea 100644 --- a/Framework/DataHandling/test/LoadEventPreNexus2Test.h +++ b/Framework/DataHandling/test/LoadEventPreNexus2Test.h @@ -66,9 +66,9 @@ public: void test_file_not_found() { TS_ASSERT_THROWS(eventLoader->setPropertyValue( "EventFilename", "this_file_doesnt_exist.blabla.data"), - std::invalid_argument); + const std::invalid_argument &); // Execute fails since the properties aren't set correctly. - TS_ASSERT_THROWS(eventLoader->execute(), std::runtime_error); + TS_ASSERT_THROWS(eventLoader->execute(), const std::runtime_error &); } void test_data_sizes() { @@ -267,7 +267,7 @@ public: "CNCS_7860_neutron_event.dat"); eventLoader->setPropertyValue("ChunkNumber", "3"); eventLoader->setPropertyValue("TotalChunks", "2"); - TS_ASSERT_THROWS(eventLoader->execute(), std::runtime_error); + TS_ASSERT_THROWS(eventLoader->execute(), const std::runtime_error &); } void test_loading_chunks() { diff --git a/Framework/DataHandling/test/LoadFITSTest.h b/Framework/DataHandling/test/LoadFITSTest.h index ee560e15022..f4ead90ee3e 100644 --- a/Framework/DataHandling/test/LoadFITSTest.h +++ b/Framework/DataHandling/test/LoadFITSTest.h @@ -77,14 +77,14 @@ public: LoadFITS lf; TS_ASSERT_THROWS_NOTHING(lf.initialize()); TS_ASSERT_THROWS_NOTHING(lf.setPropertyValue("Filename", g_smallFname1)); - TS_ASSERT_THROWS(lf.execute(), std::runtime_error); + TS_ASSERT_THROWS(lf.execute(), const std::runtime_error &); TS_ASSERT(!lf.isExecuted()); LoadFITS lf2; TS_ASSERT_THROWS_NOTHING(lf2.initialize()); TS_ASSERT_THROWS_NOTHING( lf2.setPropertyValue("OutputWorkspace", "out_ws_name")); - TS_ASSERT_THROWS(lf2.execute(), std::runtime_error); + TS_ASSERT_THROWS(lf2.execute(), const std::runtime_error &); TS_ASSERT(!lf2.isExecuted()); } @@ -92,28 +92,28 @@ public: LoadFITS lf; TS_ASSERT_THROWS_NOTHING(lf.initialize()); TS_ASSERT_THROWS(lf.setPropertyValue("file", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(lf.setPropertyValue("output", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(lf.setPropertyValue("FITS", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(lf.setPropertyValue("BinSize", "-1"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(lf.setPropertyValue("BinSize", "0"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(lf.setPropertyValue("FilterNoiseLevel", "-10"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(lf.setPropertyValue("FilterNoiseLevel", "0")); TS_ASSERT_THROWS(lf.setPropertyValue("ImageKey", "anything"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); TS_ASSERT_THROWS(lf.setPropertyValue("BITPIX", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(lf.setPropertyValue("NAXIS", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(lf.setPropertyValue("NAXIS1", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_initGood() { @@ -127,7 +127,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); inputFile = g_smallFname1 + ", " + g_smallFname2; algToBeTested.setPropertyValue("Filename", inputFile); @@ -135,7 +135,7 @@ public: // Set the ImageKey to be 0 (this used to be required, but the key // should not be there any longer); TS_ASSERT_THROWS(algToBeTested.setProperty<int>("ImageKey", 0), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void test_performAssertions() { diff --git a/Framework/DataHandling/test/LoadGSSTest.h b/Framework/DataHandling/test/LoadGSSTest.h index 124a4db8efe..4c844d16823 100644 --- a/Framework/DataHandling/test/LoadGSSTest.h +++ b/Framework/DataHandling/test/LoadGSSTest.h @@ -148,15 +148,15 @@ public: API::IAlgorithm_sptr loader2 = createAlgorithm(); loader2->setPropertyValue("Filename", "AsciiExample.txt"); - TS_ASSERT_THROWS(loader2->execute(), std::out_of_range) + TS_ASSERT_THROWS(loader2->execute(), const std::out_of_range &) API::IAlgorithm_sptr loader3 = createAlgorithm(); loader3->setPropertyValue("Filename", "CSP79590.raw"); - TS_ASSERT_THROWS(loader3->execute(), std::out_of_range) + TS_ASSERT_THROWS(loader3->execute(), const std::out_of_range &) API::IAlgorithm_sptr loader4 = createAlgorithm(); loader4->setPropertyValue("Filename", "VULCAN_2916_neutron0_event.dat"); - TS_ASSERT_THROWS(loader4->execute(), std::out_of_range) + TS_ASSERT_THROWS(loader4->execute(), const std::out_of_range &) } private: diff --git a/Framework/DataHandling/test/LoadIDFFromNexusTest.h b/Framework/DataHandling/test/LoadIDFFromNexusTest.h index b1b0abbd1a3..8d50824272c 100644 --- a/Framework/DataHandling/test/LoadIDFFromNexusTest.h +++ b/Framework/DataHandling/test/LoadIDFFromNexusTest.h @@ -116,7 +116,7 @@ public: // Test a non-existant detector TS_ASSERT_THROWS(detectorInfo.detector(detectorInfo.indexOf(16735)), - std::out_of_range); + const std::out_of_range &); // Check the monitors are correctly marked const auto &detInfo = output->detectorInfo(); diff --git a/Framework/DataHandling/test/LoadISISNexusTest.h b/Framework/DataHandling/test/LoadISISNexusTest.h index 1306b867c25..605cfae3892 100644 --- a/Framework/DataHandling/test/LoadISISNexusTest.h +++ b/Framework/DataHandling/test/LoadISISNexusTest.h @@ -54,10 +54,10 @@ private: TS_ASSERT(p != nullptr) TSM_ASSERT_THROWS("Shouldn't have a period less than the expected entry", fetchPeriodLog(workspace, expectedPeriodNumber - 1), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); TSM_ASSERT_THROWS("Shouldn't have a period greater than the expected entry", fetchPeriodLog(workspace, expectedPeriodNumber + 1), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); Mantid::Kernel::TimeSeriesProperty<bool> *period_property = dynamic_cast<Mantid::Kernel::TimeSeriesProperty<bool> *>(p); TS_ASSERT(period_property); @@ -1608,7 +1608,7 @@ public: // Act + Assert TSM_ASSERT_THROWS("Should throw, since it does not makes sense to only " "select monitors, but to also exclude them", - ld.execute(), std::invalid_argument); + ld.execute(), const std::invalid_argument &); } void @@ -1629,7 +1629,7 @@ public: // Act + Assert TSM_ASSERT_THROWS("Should throw, since it does not makes sense to only " "select monitors, but to also exclude them", - ld.execute(), std::invalid_argument); + ld.execute(), const std::invalid_argument &); } void @@ -1647,7 +1647,7 @@ public: // Act + Assert TSM_ASSERT_THROWS("Should throw, since it does not makes sense to only " "select monitors, but to also exclude them", - ld.execute(), std::invalid_argument); + ld.execute(), const std::invalid_argument &); } }; diff --git a/Framework/DataHandling/test/LoadISISPolarizationEfficienciesTest.h b/Framework/DataHandling/test/LoadISISPolarizationEfficienciesTest.h index d13bdc2cb29..40292126ff9 100644 --- a/Framework/DataHandling/test/LoadISISPolarizationEfficienciesTest.h +++ b/Framework/DataHandling/test/LoadISISPolarizationEfficienciesTest.h @@ -150,7 +150,7 @@ public: alg.setProperty("P1", f1.getFileName()); alg.setProperty("Pp", f1.getFileName()); alg.setProperty("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } private: diff --git a/Framework/DataHandling/test/LoadInstrumentFromRawTest.h b/Framework/DataHandling/test/LoadInstrumentFromRawTest.h index ce8b24d264f..4e88eabb87f 100644 --- a/Framework/DataHandling/test/LoadInstrumentFromRawTest.h +++ b/Framework/DataHandling/test/LoadInstrumentFromRawTest.h @@ -97,7 +97,7 @@ public: // last const auto &ptrDetLast = detectorInfo.detector(detectorInfo.indexOf(8)); TS_ASSERT_EQUALS(ptrDetLast.getID(), 8); - TS_ASSERT_THROWS(detectorInfo.indexOf(9), std::out_of_range); + TS_ASSERT_THROWS(detectorInfo.indexOf(9), const std::out_of_range &); // Check the monitors are correctly marked const auto &detInfo = output->detectorInfo(); diff --git a/Framework/DataHandling/test/LoadInstrumentTest.h b/Framework/DataHandling/test/LoadInstrumentTest.h index 7602edf6454..f41aaeb271b 100644 --- a/Framework/DataHandling/test/LoadInstrumentTest.h +++ b/Framework/DataHandling/test/LoadInstrumentTest.h @@ -140,7 +140,7 @@ public: detectorInfo.detector(detectorInfo.indexOf(413256)); TS_ASSERT_EQUALS(ptrDetLast.getID(), 413256); TS_ASSERT_EQUALS(ptrDetLast.getName(), "pixel"); - TS_ASSERT_THROWS(detectorInfo.indexOf(413257), std::out_of_range); + TS_ASSERT_THROWS(detectorInfo.indexOf(413257), const std::out_of_range &); // Test input data is unchanged Workspace2D_sptr output2DInst = @@ -387,7 +387,7 @@ public: TS_ASSERT_EQUALS(1, detectorInfo.detectorIDs()[0]); TS_ASSERT_EQUALS(2, detectorInfo.detectorIDs()[1]); TS_ASSERT_EQUALS(10707511, detectorInfo.detectorIDs()[778244]); - TS_ASSERT_THROWS(detectorInfo.indexOf(778245), std::out_of_range); + TS_ASSERT_THROWS(detectorInfo.indexOf(778245), const std::out_of_range &); } /// Test the Nexus geometry loader from LOKI name @@ -544,7 +544,7 @@ public: V3D(3, 3, 0)); // Note that one of the physical pixels doesn't exist in the neutronic // space - TS_ASSERT_THROWS(detectorInfo.indexOf(1004), std::out_of_range); + TS_ASSERT_THROWS(detectorInfo.indexOf(1004), const std::out_of_range &); TS_ASSERT_EQUALS(detectorInfo.position(detectorInfo.indexOf(1005)), V3D(4, 3, 0)); diff --git a/Framework/DataHandling/test/LoadLogTest.h b/Framework/DataHandling/test/LoadLogTest.h index 86bc55a0a65..2a3935a1c7f 100644 --- a/Framework/DataHandling/test/LoadLogTest.h +++ b/Framework/DataHandling/test/LoadLogTest.h @@ -55,7 +55,7 @@ public: outputSpace = "LoadLogTest-threeColumnFile"; TS_ASSERT_THROWS(loader.setPropertyValue("Workspace", outputSpace), - std::invalid_argument) + const std::invalid_argument &) Workspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1); @@ -106,7 +106,7 @@ public: outputSpace = "LoadLogTest-singleLogFile"; TS_ASSERT_THROWS(loader.setPropertyValue("Workspace", outputSpace), - std::invalid_argument) + const std::invalid_argument &) // Create an empty workspace and put it in the AnalysisDataService Workspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1); diff --git a/Framework/DataHandling/test/LoadMappingTableTest.h b/Framework/DataHandling/test/LoadMappingTableTest.h index 8919199ce76..3709ace829a 100644 --- a/Framework/DataHandling/test/LoadMappingTableTest.h +++ b/Framework/DataHandling/test/LoadMappingTableTest.h @@ -60,7 +60,7 @@ public: if (!loader.isInitialized()) loader.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(loader.execute(), std::runtime_error); + TS_ASSERT_THROWS(loader.execute(), const std::runtime_error &); // Now set it... loader.setPropertyValue("Filename", inputFile); loader.setPropertyValue("Workspace", outputSpace); diff --git a/Framework/DataHandling/test/LoadMcStasNexusTest.h b/Framework/DataHandling/test/LoadMcStasNexusTest.h index 6ec8c9214d1..fdf8a151d96 100644 --- a/Framework/DataHandling/test/LoadMcStasNexusTest.h +++ b/Framework/DataHandling/test/LoadMcStasNexusTest.h @@ -44,7 +44,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); // Now set it... // specify name of file to load workspace from diff --git a/Framework/DataHandling/test/LoadMcStasTest.h b/Framework/DataHandling/test/LoadMcStasTest.h index f5851d1ee9a..9d1cfc97033 100644 --- a/Framework/DataHandling/test/LoadMcStasTest.h +++ b/Framework/DataHandling/test/LoadMcStasTest.h @@ -45,7 +45,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); load_test("mcstas_event_hist.h5", outputSpace); diff --git a/Framework/DataHandling/test/LoadMuonLogTest.h b/Framework/DataHandling/test/LoadMuonLogTest.h index 07307d782df..7a837547e68 100644 --- a/Framework/DataHandling/test/LoadMuonLogTest.h +++ b/Framework/DataHandling/test/LoadMuonLogTest.h @@ -54,7 +54,7 @@ public: outputSpace = "LoadMuonLogTest-nexusdatafile"; TS_ASSERT_THROWS(loaderNexusFile.setPropertyValue("Workspace", outputSpace), - std::invalid_argument) + const std::invalid_argument &) // Create an empty workspace and put it in the AnalysisDataService MatrixWorkspace_sptr ws = WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1); diff --git a/Framework/DataHandling/test/LoadMuonNexus1Test.h b/Framework/DataHandling/test/LoadMuonNexus1Test.h index 26607ce9b89..92ebd9b254b 100644 --- a/Framework/DataHandling/test/LoadMuonNexus1Test.h +++ b/Framework/DataHandling/test/LoadMuonNexus1Test.h @@ -48,7 +48,7 @@ public: if (!nxLoad.isInitialized()) nxLoad.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(nxLoad.execute(), std::runtime_error); + TS_ASSERT_THROWS(nxLoad.execute(), const std::runtime_error &); // Now set required filename and output workspace name inputFile = "emu00006473.nxs"; diff --git a/Framework/DataHandling/test/LoadNexusProcessedTest.h b/Framework/DataHandling/test/LoadNexusProcessedTest.h index 73c2e68fcb9..c468fde1d8a 100644 --- a/Framework/DataHandling/test/LoadNexusProcessedTest.h +++ b/Framework/DataHandling/test/LoadNexusProcessedTest.h @@ -625,7 +625,7 @@ public: { TS_ASSERT_THROWS(ConstColumnVector<int64_t> column = ws->getVector("Integer"), - std::runtime_error); + const std::runtime_error &); ConstColumnVector<int> column = ws->getVector("Integer"); TS_ASSERT_EQUALS(column[0], 5); TS_ASSERT_EQUALS(column[1], 3); diff --git a/Framework/DataHandling/test/LoadNexusTest.h b/Framework/DataHandling/test/LoadNexusTest.h index 09a77a63f74..5a75fce8a23 100644 --- a/Framework/DataHandling/test/LoadNexusTest.h +++ b/Framework/DataHandling/test/LoadNexusTest.h @@ -48,7 +48,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); // Now set it... // specify name of file to load workspace from diff --git a/Framework/DataHandling/test/LoadPLNTest.h b/Framework/DataHandling/test/LoadPLNTest.h index e8fe3f97087..3f15f517f0f 100644 --- a/Framework/DataHandling/test/LoadPLNTest.h +++ b/Framework/DataHandling/test/LoadPLNTest.h @@ -31,7 +31,7 @@ public: algToBeTested.setPropertyValue("OutputWorkspace", outputSpace); // should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); // missing event file - should fail execution std::string inputFile = "PLN0044464.hdf"; diff --git a/Framework/DataHandling/test/LoadRKHTest.h b/Framework/DataHandling/test/LoadRKHTest.h index 9535a6c7e6d..e7ea85e46eb 100644 --- a/Framework/DataHandling/test/LoadRKHTest.h +++ b/Framework/DataHandling/test/LoadRKHTest.h @@ -54,7 +54,7 @@ public: loadrkh.initialize(); // No parameters have been set yet, so it should throw - TS_ASSERT_THROWS(loadrkh.execute(), std::runtime_error); + TS_ASSERT_THROWS(loadrkh.execute(), const std::runtime_error &); // Set the file name loadrkh.setPropertyValue("Filename", dataFile); diff --git a/Framework/DataHandling/test/LoadRaw3Test.h b/Framework/DataHandling/test/LoadRaw3Test.h index 3f694216f93..9b0032e63db 100644 --- a/Framework/DataHandling/test/LoadRaw3Test.h +++ b/Framework/DataHandling/test/LoadRaw3Test.h @@ -60,7 +60,7 @@ public: loader.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(loader.execute(), std::runtime_error); + TS_ASSERT_THROWS(loader.execute(), const std::runtime_error &); // Now set it... loader.setPropertyValue("Filename", inputFile); @@ -313,38 +313,38 @@ public: Workspace_sptr output; // test that there is no workspace as it should have failed TS_ASSERT_THROWS(output = AnalysisDataService::Instance().retrieve(outWS), - std::runtime_error); + const std::runtime_error &); loader3.setPropertyValue("SpectrumMin", "5"); loader3.setPropertyValue("SpectrumMax", "1"); loader3.execute(); TS_ASSERT_THROWS(output = AnalysisDataService::Instance().retrieve(outWS), - std::runtime_error); + const std::runtime_error &); loader3.setPropertyValue("SpectrumMin", "5"); loader3.setPropertyValue("SpectrumMax", "3"); loader3.execute(); TS_ASSERT_THROWS(output = AnalysisDataService::Instance().retrieve(outWS), - std::runtime_error); + const std::runtime_error &); loader3.setPropertyValue("SpectrumMin", "5"); loader3.setPropertyValue("SpectrumMax", "5"); loader3.execute(); TS_ASSERT_THROWS(output = AnalysisDataService::Instance().retrieve(outWS), - std::runtime_error); + const std::runtime_error &); loader3.setPropertyValue("SpectrumMin", "5"); loader3.setPropertyValue("SpectrumMax", "3000"); loader3.execute(); TS_ASSERT_THROWS(output = AnalysisDataService::Instance().retrieve(outWS), - std::runtime_error); + const std::runtime_error &); loader3.setPropertyValue("SpectrumMin", "5"); loader3.setPropertyValue("SpectrumMax", "10"); loader3.setPropertyValue("SpectrumList", "999,3000"); loader3.execute(); TS_ASSERT_THROWS(output = AnalysisDataService::Instance().retrieve(outWS), - std::runtime_error); + const std::runtime_error &); loader3.setPropertyValue("SpectrumList", "999,2000"); loader3.execute(); @@ -474,7 +474,7 @@ public: loader6.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(loader6.execute(), std::runtime_error); + TS_ASSERT_THROWS(loader6.execute(), const std::runtime_error &); // Now set it... loader6.setPropertyValue("Filename", inputFile); diff --git a/Framework/DataHandling/test/LoadRawBin0Test.h b/Framework/DataHandling/test/LoadRawBin0Test.h index de4c5a01e5e..65b913b3645 100644 --- a/Framework/DataHandling/test/LoadRawBin0Test.h +++ b/Framework/DataHandling/test/LoadRawBin0Test.h @@ -47,7 +47,7 @@ public: loader.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(loader.execute(), std::runtime_error); + TS_ASSERT_THROWS(loader.execute(), const std::runtime_error &); // Now set it... loader.setPropertyValue("Filename", inputFile); diff --git a/Framework/DataHandling/test/LoadRawSpectrum0Test.h b/Framework/DataHandling/test/LoadRawSpectrum0Test.h index be2715bc804..fae42744e5f 100644 --- a/Framework/DataHandling/test/LoadRawSpectrum0Test.h +++ b/Framework/DataHandling/test/LoadRawSpectrum0Test.h @@ -51,7 +51,7 @@ public: loader.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(loader.execute(), std::runtime_error); + TS_ASSERT_THROWS(loader.execute(), const std::runtime_error &); // Now set it... loader.setPropertyValue("Filename", inputFile); diff --git a/Framework/DataHandling/test/LoadSESANSTest.h b/Framework/DataHandling/test/LoadSESANSTest.h index 3ff49b05aac..00722d4b612 100644 --- a/Framework/DataHandling/test/LoadSESANSTest.h +++ b/Framework/DataHandling/test/LoadSESANSTest.h @@ -110,7 +110,7 @@ private: void attemptToLoadBadFile(const std::string &filename) { const std::string filepath = getTestFilePath(filename); TS_ASSERT_THROWS_NOTHING(testAlg.setProperty("Filename", filepath)); - TS_ASSERT_THROWS(testAlg.execute(), std::runtime_error); + TS_ASSERT_THROWS(testAlg.execute(), const std::runtime_error &); } LoadSESANS testAlg; diff --git a/Framework/DataHandling/test/LoadSampleEnvironmentTest.h b/Framework/DataHandling/test/LoadSampleEnvironmentTest.h index a465f3edea6..60c68b9965f 100644 --- a/Framework/DataHandling/test/LoadSampleEnvironmentTest.h +++ b/Framework/DataHandling/test/LoadSampleEnvironmentTest.h @@ -86,7 +86,7 @@ public: alg.setProperty("RotationMatrix", "-1,0,1,0,0,0,0,1"); boost::shared_ptr<MeshObject> environmentMesh = nullptr; environmentMesh = loadCube(); - TS_ASSERT_THROWS(alg.rotate(environmentMesh), std::invalid_argument); + TS_ASSERT_THROWS(alg.rotate(environmentMesh), const std::invalid_argument &); } void testRotateFailInvalidMatrix() { @@ -95,7 +95,7 @@ public: alg.setProperty("RotationMatrix", "6,1,1,4,-2,5,2,8,7"); boost::shared_ptr<MeshObject> environmentMesh = nullptr; environmentMesh = loadCube(); - TS_ASSERT_THROWS(alg.rotate(environmentMesh), std::invalid_argument); + TS_ASSERT_THROWS(alg.rotate(environmentMesh), const std::invalid_argument &); } void testSetMaterial() { diff --git a/Framework/DataHandling/test/LoadSpice2dTest.h b/Framework/DataHandling/test/LoadSpice2dTest.h index 335a83770bc..51bc27170d0 100644 --- a/Framework/DataHandling/test/LoadSpice2dTest.h +++ b/Framework/DataHandling/test/LoadSpice2dTest.h @@ -52,7 +52,7 @@ public: spice2d.initialize(); // No parameters have been set yet, so it should throw - TS_ASSERT_THROWS(spice2d.execute(), std::runtime_error); + TS_ASSERT_THROWS(spice2d.execute(), const std::runtime_error &); // Set the file name spice2d.setPropertyValue("Filename", inputFile); @@ -188,7 +188,7 @@ public: spice2d.initialize(); // No parameters have been set yet, so it should throw - TS_ASSERT_THROWS(spice2d.execute(), std::runtime_error); + TS_ASSERT_THROWS(spice2d.execute(), const std::runtime_error &); // Set the file name spice2d.setPropertyValue("Filename", inputFile); diff --git a/Framework/DataHandling/test/LoadTBLTest.h b/Framework/DataHandling/test/LoadTBLTest.h index 30d4bd75a2b..7230989f652 100644 --- a/Framework/DataHandling/test/LoadTBLTest.h +++ b/Framework/DataHandling/test/LoadTBLTest.h @@ -363,7 +363,7 @@ public: m_abspath = alg->getPropertyValue("Filename"); // Get absolute path TS_ASSERT_THROWS_NOTHING( alg->setPropertyValue("OutputWorkspace", m_wsName)); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); cleanupafterwards(); } @@ -389,7 +389,7 @@ public: m_abspath = alg->getPropertyValue("Filename"); // Get absolute path TS_ASSERT_THROWS_NOTHING( alg->setPropertyValue("OutputWorkspace", m_wsName)); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); cleanupafterwards(); } diff --git a/Framework/DataHandling/test/PDLoadCharacterizationsTest.h b/Framework/DataHandling/test/PDLoadCharacterizationsTest.h index 3c46b8f328c..d7b09ee9ef1 100644 --- a/Framework/DataHandling/test/PDLoadCharacterizationsTest.h +++ b/Framework/DataHandling/test/PDLoadCharacterizationsTest.h @@ -439,7 +439,7 @@ public: alg.setPropertyValue("ExpIniFilename", "NOMAD_exp.ini"); alg.setPropertyValue("OutputWorkspace", WKSP_NAME); alg.setRethrows(true); // so the exception can be seen by testing - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/DataHandling/test/ReadMaterialTest.h b/Framework/DataHandling/test/ReadMaterialTest.h index b73d0c2b026..30c9be3ea01 100644 --- a/Framework/DataHandling/test/ReadMaterialTest.h +++ b/Framework/DataHandling/test/ReadMaterialTest.h @@ -350,7 +350,7 @@ public: ReadMaterial reader; reader.setMaterialParameters(params); - TS_ASSERT_THROWS(reader.buildMaterial(), std::runtime_error); + TS_ASSERT_THROWS(reader.buildMaterial(), const std::runtime_error &); } private: diff --git a/Framework/DataHandling/test/RemoveLogsTest.h b/Framework/DataHandling/test/RemoveLogsTest.h index ff8981a927a..b5305f9d255 100644 --- a/Framework/DataHandling/test/RemoveLogsTest.h +++ b/Framework/DataHandling/test/RemoveLogsTest.h @@ -110,8 +110,8 @@ public: // Ensure it has the correct log data TS_ASSERT_DIFFERS(output->run().getLogData().size(), 0); - TS_ASSERT_THROWS(output->run().getLogData("some_prop"), std::runtime_error); - TS_ASSERT_THROWS(output->run().getLogData("T0"), std::runtime_error); + TS_ASSERT_THROWS(output->run().getLogData("some_prop"), const std::runtime_error &); + TS_ASSERT_THROWS(output->run().getLogData("T0"), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(output->run().getLogData("Ei")); TS_ASSERT_THROWS_NOTHING(output->run().getLogData("scan_index")); diff --git a/Framework/DataHandling/test/SaveAscii2Test.h b/Framework/DataHandling/test/SaveAscii2Test.h index 055439f1e3e..5953cb4a3e8 100644 --- a/Framework/DataHandling/test/SaveAscii2Test.h +++ b/Framework/DataHandling/test/SaveAscii2Test.h @@ -454,7 +454,7 @@ public: // then check the workspace bounds testing TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("WorkspaceIndexMax", "5")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -480,7 +480,7 @@ public: // bounds aren't checked TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("WorkspaceIndexMax", "7")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm didn't run so there should be no file // the algorithm shouldn't have written a file to disk @@ -516,7 +516,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("WorkspaceIndexMin", "3")); TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("WorkspaceIndexMax", "2")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -551,7 +551,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("SpectrumList", "2, 3, 1")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -645,7 +645,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CommentIndicator", "3")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -662,7 +662,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CommentIndicator", "e")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -679,7 +679,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CommentIndicator", "-")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -696,7 +696,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CommentIndicator", "+")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -714,7 +714,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("Separator", "UserDefined")); TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CustomSeparator", "e")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -732,7 +732,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("Separator", "UserDefined")); TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CustomSeparator", "3")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -750,7 +750,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("Separator", "UserDefined")); TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CustomSeparator", "+")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); @@ -768,7 +768,7 @@ public: TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("Separator", "UserDefined")); TS_ASSERT_THROWS_NOTHING(save.setPropertyValue("CustomSeparator", "-")); - TS_ASSERT_THROWS(save.execute(), std::invalid_argument); + TS_ASSERT_THROWS(save.execute(), const std::invalid_argument &); // the algorithm shouldn't have written a file to disk TS_ASSERT(!Poco::File(filename).exists()); diff --git a/Framework/DataHandling/test/SaveBankScatteringAnglesTest.h b/Framework/DataHandling/test/SaveBankScatteringAnglesTest.h index a7112c346aa..e6d658925c3 100644 --- a/Framework/DataHandling/test/SaveBankScatteringAnglesTest.h +++ b/Framework/DataHandling/test/SaveBankScatteringAnglesTest.h @@ -37,7 +37,7 @@ public: SaveBankScatteringAngles testAlg; testAlg.initialize(); TS_ASSERT_THROWS(testAlg.setProperty("InputWorkspace", "ws"), - std::invalid_argument); + const std::invalid_argument &); ADS.remove("ws"); } diff --git a/Framework/DataHandling/test/SaveCSVTest.h b/Framework/DataHandling/test/SaveCSVTest.h index e211ac95353..04e0ab2d170 100644 --- a/Framework/DataHandling/test/SaveCSVTest.h +++ b/Framework/DataHandling/test/SaveCSVTest.h @@ -71,7 +71,7 @@ public: algToBeTested.setPropertyValue("InputWorkspace", "SAVECSVTEST-testSpace"); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); TS_ASSERT_EQUALS(algToBeTested.isExecuted(), false) // Now set it... diff --git a/Framework/DataHandling/test/SaveDiffCalTest.h b/Framework/DataHandling/test/SaveDiffCalTest.h index 884e4dc5f86..6825892872f 100644 --- a/Framework/DataHandling/test/SaveDiffCalTest.h +++ b/Framework/DataHandling/test/SaveDiffCalTest.h @@ -103,7 +103,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("GroupingWorkspace", groupWS)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("MaskWorkspace", maskWS)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Filename", FILENAME)); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -120,7 +120,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("MaskWorkspace", maskWS)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Filename", FILENAME)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("CalibrationWorkspace", calWS)); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/DataHandling/test/SaveFITSTest.h b/Framework/DataHandling/test/SaveFITSTest.h index 9257f7a53a2..7bfa59e8e31 100644 --- a/Framework/DataHandling/test/SaveFITSTest.h +++ b/Framework/DataHandling/test/SaveFITSTest.h @@ -49,15 +49,17 @@ public: TS_ASSERT_THROWS( alg->setPropertyValue("OutputWorkspace", "_unused_for_child"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); TS_ASSERT_THROWS( alg->setPropertyValue("BitDepth", "this_is_wrong_you_must_fail"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg->setProperty("BitDepth", 10), std::invalid_argument); + TS_ASSERT_THROWS(alg->setProperty("BitDepth", 10), + const std::invalid_argument &); - TS_ASSERT_THROWS(alg->setProperty("BitDepth", 64), std::invalid_argument); + TS_ASSERT_THROWS(alg->setProperty("BitDepth", 64), + const std::invalid_argument &); } void test_exec_fail() { @@ -67,9 +69,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Filename", "foo.fits")); TS_ASSERT_THROWS( alg.setPropertyValue("InputWorkspace", "inexistent_workspace_fails"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -85,7 +87,7 @@ public: TSM_ASSERT_THROWS( "The algorithm should not accept workspaces if the units are wrong", - alg.setProperty("InputWorkspace", ws), std::invalid_argument); + alg.setProperty("InputWorkspace", ws), const std::invalid_argument &); } void test_exec_fails_empty() { @@ -101,7 +103,7 @@ public: TSM_ASSERT_THROWS( "The algorithm should not accept empty / uninitialized workspaces", - alg.setProperty("InputWorkspace", ws), std::invalid_argument); + alg.setProperty("InputWorkspace", ws), const std::invalid_argument &); } void test_exec_runs_ok() { diff --git a/Framework/DataHandling/test/SaveGDATest.h b/Framework/DataHandling/test/SaveGDATest.h index 7f02a59bd18..b3be210d72e 100644 --- a/Framework/DataHandling/test/SaveGDATest.h +++ b/Framework/DataHandling/test/SaveGDATest.h @@ -90,7 +90,7 @@ public: SaveGDA testAlg; testAlg.initialize(); TS_ASSERT_THROWS(testAlg.setProperty("InputWorkspace", "ws"), - std::invalid_argument); + const std::invalid_argument &); ADS.remove("ws"); } diff --git a/Framework/DataHandling/test/SaveNXSPETest.h b/Framework/DataHandling/test/SaveNXSPETest.h index 4f773a59227..e9691bdfbd7 100644 --- a/Framework/DataHandling/test/SaveNXSPETest.h +++ b/Framework/DataHandling/test/SaveNXSPETest.h @@ -127,7 +127,8 @@ public: // throws file not exist from ChildAlgorithm saver.setRethrows(true); - TS_ASSERT_THROWS(saver.execute(), Mantid::Kernel::Exception::FileError); + TS_ASSERT_THROWS(saver.execute(), + const Mantid::Kernel::Exception::FileError &); TS_ASSERT(Poco::File(outputFile).exists()); if (Poco::File(outputFile).exists()) diff --git a/Framework/DataHandling/test/SaveNexusProcessedTest.h b/Framework/DataHandling/test/SaveNexusProcessedTest.h index da79348691c..00ab0675160 100644 --- a/Framework/DataHandling/test/SaveNexusProcessedTest.h +++ b/Framework/DataHandling/test/SaveNexusProcessedTest.h @@ -976,7 +976,7 @@ private: algToBeTested.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(algToBeTested.execute(), std::runtime_error); + TS_ASSERT_THROWS(algToBeTested.execute(), const std::runtime_error &); // create dummy 2D-workspace Workspace2D_sptr localWorkspace2D = diff --git a/Framework/DataHandling/test/SaveOpenGenieAsciiTest.h b/Framework/DataHandling/test/SaveOpenGenieAsciiTest.h index 8647da7638f..b64f6a6466f 100644 --- a/Framework/DataHandling/test/SaveOpenGenieAsciiTest.h +++ b/Framework/DataHandling/test/SaveOpenGenieAsciiTest.h @@ -32,7 +32,7 @@ public: const auto fileHandle = Poco::TemporaryFile(); auto alg = createAlg(ws, fileHandle.path()); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void testEventWSThrows() { @@ -44,7 +44,7 @@ public: const auto fileHandle = Poco::TemporaryFile(); auto alg = createAlg(ws, fileHandle.path()); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void testFileMatchesExpectedFormat() { diff --git a/Framework/DataHandling/test/SaveRKHTest.h b/Framework/DataHandling/test/SaveRKHTest.h index b6b7d96ed64..028860043a7 100644 --- a/Framework/DataHandling/test/SaveRKHTest.h +++ b/Framework/DataHandling/test/SaveRKHTest.h @@ -49,7 +49,7 @@ public: testAlgorithm1.initialize(); // No parameters have been set yet, so it should throw - TS_ASSERT_THROWS(testAlgorithm1.execute(), std::runtime_error); + TS_ASSERT_THROWS(testAlgorithm1.execute(), const std::runtime_error &); // Need a test workspace to use as input MatrixWorkspace_sptr inputWS1 = WorkspaceCreationHelper::create2DWorkspaceBinned(1, 10, 1.0); @@ -117,7 +117,7 @@ public: if (!testAlgorithm2.isInitialized()) testAlgorithm2.initialize(); - TS_ASSERT_THROWS(testAlgorithm2.execute(), std::runtime_error); + TS_ASSERT_THROWS(testAlgorithm2.execute(), const std::runtime_error &); using namespace Mantid::API; MatrixWorkspace_sptr inputWS2 = @@ -188,7 +188,7 @@ public: testAlgorithm3.initialize(); // No parameters have been set yet, so it should throw - TS_ASSERT_THROWS(testAlgorithm3.execute(), std::runtime_error); + TS_ASSERT_THROWS(testAlgorithm3.execute(), const std::runtime_error &); // Need a test workspace to use as input auto inputWS3 = createInputWorkspaceHistoWithXerror(); inputWS3->setDistribution(false); diff --git a/Framework/DataHandling/test/SaveReflectometryAsciiTest.h b/Framework/DataHandling/test/SaveReflectometryAsciiTest.h index dc62981c1c8..3e3205f0a4b 100644 --- a/Framework/DataHandling/test/SaveReflectometryAsciiTest.h +++ b/Framework/DataHandling/test/SaveReflectometryAsciiTest.h @@ -50,8 +50,8 @@ public: alg.setRethrows(true); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Filename", "ws")) TS_ASSERT_THROWS(alg.setProperty("InputWorkspace", "abc"), - std::invalid_argument) - TS_ASSERT_THROWS(alg.execute(), std::runtime_error) + const std::invalid_argument &) + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &) TS_ASSERT(!alg.isExecuted()) } diff --git a/Framework/DataHandling/test/SaveSESANSTest.h b/Framework/DataHandling/test/SaveSESANSTest.h index 55cd9c239bb..f34feb0e4b1 100644 --- a/Framework/DataHandling/test/SaveSESANSTest.h +++ b/Framework/DataHandling/test/SaveSESANSTest.h @@ -49,7 +49,7 @@ public: TS_ASSERT_THROWS_NOTHING(testAlg.setProperty("InputWorkspace", ws)); // Should throw, as we can't save more than one histogram - TS_ASSERT_THROWS(testAlg.execute(), std::runtime_error); + TS_ASSERT_THROWS(testAlg.execute(), const std::runtime_error &); } void test_exec() { diff --git a/Framework/DataHandling/test/SetBeamTest.h b/Framework/DataHandling/test/SetBeamTest.h index 8d327517af7..dd1e0f8363e 100644 --- a/Framework/DataHandling/test/SetBeamTest.h +++ b/Framework/DataHandling/test/SetBeamTest.h @@ -62,7 +62,7 @@ public: auto alg = createAlgorithm(); TS_ASSERT_THROWS(alg->setProperty("InputWorkspace", inputWS), - std::invalid_argument); + const std::invalid_argument &); } void test_No_Geometry_Inputs_Not_Accepted() { @@ -72,7 +72,7 @@ public: auto alg = createAlgorithm(); alg->setProperty("InputWorkspace", inputWS); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_Missing_Geometry_Inputs_Not_Accepted() { @@ -85,14 +85,14 @@ public: alg->setProperty("InputWorkspace", inputWS); auto props = boost::make_shared<PropertyManager>(); alg->setProperty("Geometry", props); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); props = createRectangularBeamProps(); props->removeProperty("Width"); alg->setProperty("Geometry", props); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); props->removeProperty("Height"); alg->setProperty("Geometry", props); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } //---------------------------------------------------------------------------- diff --git a/Framework/DataHandling/test/SetSampleTest.h b/Framework/DataHandling/test/SetSampleTest.h index 4de78a6110e..a6537c4f2e8 100644 --- a/Framework/DataHandling/test/SetSampleTest.h +++ b/Framework/DataHandling/test/SetSampleTest.h @@ -319,7 +319,7 @@ public: args->declareProperty( Mantid::Kernel::make_unique<StringProperty>("Container", "8mm"), ""); alg->setProperty("Environment", args); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_Environment_Args_Without_Container_Invalid() { @@ -333,7 +333,7 @@ public: args->declareProperty( Mantid::Kernel::make_unique<StringProperty>("Name", m_envName), ""); alg->setProperty("Environment", args); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_Environment_Args_With_Empty_Strings_Invalid() { @@ -347,12 +347,12 @@ public: args->declareProperty( Mantid::Kernel::make_unique<StringProperty>("Name", ""), ""); alg->setProperty("Environment", args); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); args->removeProperty("Name"); args->declareProperty( Mantid::Kernel::make_unique<StringProperty>("Container", ""), ""); alg->setProperty("Environment", args); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_Negative_FlatPlate_Dimensions_Give_Validation_Errors() { diff --git a/Framework/DataHandling/test/SortTableWorkspaceTest.h b/Framework/DataHandling/test/SortTableWorkspaceTest.h index a0669171f23..112e4d15de0 100644 --- a/Framework/DataHandling/test/SortTableWorkspaceTest.h +++ b/Framework/DataHandling/test/SortTableWorkspaceTest.h @@ -473,7 +473,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", ws)); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName)); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); TS_ASSERT(!alg.isExecuted()); } @@ -511,7 +511,7 @@ public: alg.setPropertyValue("OutputWorkspace", outWSName)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Columns", columns)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Ascending", ascending)); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); TS_ASSERT(!alg.isExecuted()); } @@ -548,7 +548,7 @@ public: alg.setPropertyValue("OutputWorkspace", outWSName)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Columns", columns)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Ascending", ascending)); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -586,7 +586,7 @@ public: alg.setPropertyValue("OutputWorkspace", outWSName)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Columns", columns)); TS_ASSERT_THROWS_NOTHING(alg.setProperty("Ascending", ascending)); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } }; diff --git a/Framework/DataHandling/test/UpdateInstrumentFromFileTest.h b/Framework/DataHandling/test/UpdateInstrumentFromFileTest.h index 3a477469a1f..65f4fe262aa 100644 --- a/Framework/DataHandling/test/UpdateInstrumentFromFileTest.h +++ b/Framework/DataHandling/test/UpdateInstrumentFromFileTest.h @@ -149,7 +149,7 @@ public: loadTestInstrument(); // No header TS_ASSERT_THROWS(runUpdateInstrument(datfile.getFileName()), - std::runtime_error); + const std::runtime_error &); } void test_GroupedDetector_Has_All_Components_Moved_To_Same_Coordinates() { @@ -204,7 +204,7 @@ private: loadTestInstrument(); // No header - TS_ASSERT_THROWS(runUpdateInstrument(filename), std::invalid_argument); + TS_ASSERT_THROWS(runUpdateInstrument(filename), const std::invalid_argument &); // Header claims fewer columns than there actually are std::string badHeader = "spectrum,theta,t0,-"; diff --git a/Framework/DataObjects/inc/MantidDataObjects/MortonIndex/WideIntImpl.h b/Framework/DataObjects/inc/MantidDataObjects/MortonIndex/WideIntImpl.h index 9d872820d45..cf43f57c787 100644 --- a/Framework/DataObjects/inc/MantidDataObjects/MortonIndex/WideIntImpl.h +++ b/Framework/DataObjects/inc/MantidDataObjects/MortonIndex/WideIntImpl.h @@ -1093,7 +1093,7 @@ operator++() noexcept(is_same<Signed, unsigned>::value) { template <size_t Bits, typename Signed> constexpr wide_integer<Bits, Signed> wide_integer<Bits, Signed>:: -operator++(int)noexcept(is_same<Signed, unsigned>::value) { +operator++(int) noexcept(is_same<Signed, unsigned>::value) { auto tmp = *this; *this = _impl::operator_plus(*this, 1); return tmp; @@ -1108,7 +1108,7 @@ operator--() noexcept(is_same<Signed, unsigned>::value) { template <size_t Bits, typename Signed> constexpr wide_integer<Bits, Signed> wide_integer<Bits, Signed>:: -operator--(int)noexcept(is_same<Signed, unsigned>::value) { +operator--(int) noexcept(is_same<Signed, unsigned>::value) { auto tmp = *this; *this = _impl::operator_minus(*this, 1); return tmp; diff --git a/Framework/DataObjects/src/EventWorkspaceMRU.cpp b/Framework/DataObjects/src/EventWorkspaceMRU.cpp index ebd6c4f0a8f..9678d376f03 100644 --- a/Framework/DataObjects/src/EventWorkspaceMRU.cpp +++ b/Framework/DataObjects/src/EventWorkspaceMRU.cpp @@ -93,7 +93,7 @@ Kernel::cow_ptr<HistogramData::HistogramY> EventWorkspaceMRU::findY(size_t thread_num, const EventList *index) { Poco::ScopedReadRWLock _lock(m_changeMruListsMutexY); auto result = m_bufferedDataY[thread_num]->find( - reinterpret_cast<const std::uintptr_t>(index)); + reinterpret_cast<std::uintptr_t>(index)); if (result) return result->m_data; return YType(nullptr); @@ -109,7 +109,7 @@ Kernel::cow_ptr<HistogramData::HistogramE> EventWorkspaceMRU::findE(size_t thread_num, const EventList *index) { Poco::ScopedReadRWLock _lock(m_changeMruListsMutexE); auto result = m_bufferedDataE[thread_num]->find( - reinterpret_cast<const std::uintptr_t>(index)); + reinterpret_cast<std::uintptr_t>(index)); if (result) return result->m_data; return EType(nullptr); @@ -125,7 +125,7 @@ void EventWorkspaceMRU::insertY(size_t thread_num, YType data, const EventList *index) { Poco::ScopedReadRWLock _lock(m_changeMruListsMutexY); auto yWithMarker = - new TypeWithMarker<YType>(reinterpret_cast<const std::uintptr_t>(index)); + new TypeWithMarker<YType>(reinterpret_cast<std::uintptr_t>(index)); yWithMarker->m_data = std::move(data); auto oldData = m_bufferedDataY[thread_num]->insert(yWithMarker); // And clear up the memory of the old one, if it is dropping out. @@ -142,7 +142,7 @@ void EventWorkspaceMRU::insertE(size_t thread_num, EType data, const EventList *index) { Poco::ScopedReadRWLock _lock(m_changeMruListsMutexE); auto eWithMarker = - new TypeWithMarker<EType>(reinterpret_cast<const std::uintptr_t>(index)); + new TypeWithMarker<EType>(reinterpret_cast<std::uintptr_t>(index)); eWithMarker->m_data = std::move(data); auto oldData = m_bufferedDataE[thread_num]->insert(eWithMarker); // And clear up the memory of the old one, if it is dropping out. @@ -158,14 +158,14 @@ void EventWorkspaceMRU::deleteIndex(const EventList *index) { Poco::ScopedReadRWLock _lock1(m_changeMruListsMutexE); for (auto &data : m_bufferedDataE) { if (data) { - data->deleteIndex(reinterpret_cast<const std::uintptr_t>(index)); + data->deleteIndex(reinterpret_cast<std::uintptr_t>(index)); } } } Poco::ScopedReadRWLock _lock2(m_changeMruListsMutexY); for (auto &data : m_bufferedDataY) { if (data) { - data->deleteIndex(reinterpret_cast<const std::uintptr_t>(index)); + data->deleteIndex(reinterpret_cast<std::uintptr_t>(index)); } } } diff --git a/Framework/DataObjects/test/AffineMatrixParameterParserTest.h b/Framework/DataObjects/test/AffineMatrixParameterParserTest.h index 5920396c2c1..40863f9c3c6 100644 --- a/Framework/DataObjects/test/AffineMatrixParameterParserTest.h +++ b/Framework/DataObjects/test/AffineMatrixParameterParserTest.h @@ -107,7 +107,7 @@ public: AffineMatrixParameterParser parser; AffineMatrixParameterParser otherParser; TS_ASSERT_THROWS(parser.setSuccessorParser(&otherParser), - std::runtime_error); + const std::runtime_error &); } void testThrowsIfWrongXML() { @@ -120,7 +120,7 @@ public: AffineMatrixParameterParser parser; - TS_ASSERT_THROWS(parser.createParameter(pRootElem), std::runtime_error); + TS_ASSERT_THROWS(parser.createParameter(pRootElem), const std::runtime_error &); } }; #endif diff --git a/Framework/DataObjects/test/AffineMatrixParameterTest.h b/Framework/DataObjects/test/AffineMatrixParameterTest.h index 7dc95280297..e48a7d7baf2 100644 --- a/Framework/DataObjects/test/AffineMatrixParameterTest.h +++ b/Framework/DataObjects/test/AffineMatrixParameterTest.h @@ -50,14 +50,14 @@ public: AffineMatrixParameter param(1, 3); AffineMatrixType transform(4, 4); - TS_ASSERT_THROWS(param.setMatrix(transform), std::runtime_error); + TS_ASSERT_THROWS(param.setMatrix(transform), const std::runtime_error &); } void testSetMatrixThrowsIfInDimsNotEqual() { AffineMatrixParameter param(3, 1); AffineMatrixType transform(4, 4); - TS_ASSERT_THROWS(param.setMatrix(transform), std::runtime_error); + TS_ASSERT_THROWS(param.setMatrix(transform), const std::runtime_error &); } void testAssign() { @@ -90,14 +90,14 @@ public: AffineMatrixParameter A(2, 4); AffineMatrixParameter B(4, 4); - TS_ASSERT_THROWS(B = A, std::runtime_error); + TS_ASSERT_THROWS(B = A, const std::runtime_error &); } void testAssignementThrowsIfInDimsNotEqual() { AffineMatrixParameter A(4, 2); AffineMatrixParameter B(4, 4); - TS_ASSERT_THROWS(B = A, std::runtime_error); + TS_ASSERT_THROWS(B = A, const std::runtime_error &); } void testToXMLString() { diff --git a/Framework/DataObjects/test/BoxControllerNeXusIOTest.h b/Framework/DataObjects/test/BoxControllerNeXusIOTest.h index 0d8868ff0fb..4f54deb50e7 100644 --- a/Framework/DataObjects/test/BoxControllerNeXusIOTest.h +++ b/Framework/DataObjects/test/BoxControllerNeXusIOTest.h @@ -56,7 +56,8 @@ public: TS_ASSERT_EQUALS("MDEvent", typeName); // set size - TS_ASSERT_THROWS(pSaver->setDataType(9, typeName), std::invalid_argument); + TS_ASSERT_THROWS(pSaver->setDataType(9, typeName), + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(pSaver->setDataType(8, typeName)); TS_ASSERT_THROWS_NOTHING(pSaver->getDataType(CoordSize, typeName)); TS_ASSERT_EQUALS(8, CoordSize); @@ -64,7 +65,7 @@ public: // set type TS_ASSERT_THROWS(pSaver->setDataType(4, "UnknownEvent"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(pSaver->setDataType(4, "MDLeanEvent")); TS_ASSERT_THROWS_NOTHING(pSaver->getDataType(CoordSize, typeName)); TS_ASSERT_EQUALS(4, CoordSize); @@ -74,10 +75,10 @@ public: } void test_CreateOrOpenFile() { + using Mantid::coord_t; using Mantid::API::FileFinder; using Mantid::DataObjects::BoxControllerNeXusIO; using Mantid::Kernel::Exception::FileError; - using Mantid::coord_t; BoxControllerNeXusIO *pSaver(nullptr); TS_ASSERT_THROWS_NOTHING(pSaver = createTestBoxController()); @@ -85,7 +86,8 @@ public: std::string FullPathFile; TSM_ASSERT_THROWS("new file does not open in read mode", - pSaver->openFile(this->xxfFileName, "r"), FileError); + pSaver->openFile(this->xxfFileName, "r"), + const FileError &); TS_ASSERT_THROWS_NOTHING(pSaver->openFile(this->xxfFileName, "w")); TS_ASSERT_THROWS_NOTHING(FullPathFile = pSaver->getFileName()); diff --git a/Framework/DataObjects/test/CoordTransformAffineParserTest.h b/Framework/DataObjects/test/CoordTransformAffineParserTest.h index cbb6d9ea271..fb0222aabd4 100644 --- a/Framework/DataObjects/test/CoordTransformAffineParserTest.h +++ b/Framework/DataObjects/test/CoordTransformAffineParserTest.h @@ -77,7 +77,7 @@ public: CoordTransformAffineParser parser; TSM_ASSERT_THROWS("XML root node must be a coordinate transform", - parser.createTransform(pRootElem), std::invalid_argument); + parser.createTransform(pRootElem), const std::invalid_argument &); } void testNoSuccessorThrows() { @@ -95,7 +95,7 @@ public: CoordTransformAffineParser parser; TSM_ASSERT_THROWS("Should throw since no successor parser has been set", - parser.createTransform(pRootElem), std::runtime_error); + parser.createTransform(pRootElem), const std::runtime_error &); } void testDelegateToSuccessor() { diff --git a/Framework/DataObjects/test/CoordTransformDistanceParserTest.h b/Framework/DataObjects/test/CoordTransformDistanceParserTest.h index f104b5e8bf9..4d93577dc75 100644 --- a/Framework/DataObjects/test/CoordTransformDistanceParserTest.h +++ b/Framework/DataObjects/test/CoordTransformDistanceParserTest.h @@ -69,7 +69,7 @@ public: CoordTransformDistanceParser parser; TSM_ASSERT_THROWS("XML root node must be a coordinate transform", - parser.createTransform(pRootElem), std::invalid_argument); + parser.createTransform(pRootElem), const std::invalid_argument &); } void testNoSuccessorThrows() { @@ -87,7 +87,7 @@ public: CoordTransformDistanceParser parser; TSM_ASSERT_THROWS("Should throw since no successor parser has been set", - parser.createTransform(pRootElem), std::runtime_error); + parser.createTransform(pRootElem), const std::runtime_error &); } void testDelegateToSuccessor() { diff --git a/Framework/DataObjects/test/EventListTest.h b/Framework/DataObjects/test/EventListTest.h index 730f0abdfac..fd513f6df3b 100644 --- a/Framework/DataObjects/test/EventListTest.h +++ b/Framework/DataObjects/test/EventListTest.h @@ -114,23 +114,23 @@ public: TS_ASSERT_EQUALS(target.getEventType(), EventType::TOF) TS_ASSERT_EQUALS(target.getSortType(), eventList.getSortType()); TS_ASSERT_EQUALS(target.getEvents(), eventList.getEvents()); - TS_ASSERT_THROWS(target.getWeightedEvents(), std::runtime_error); - TS_ASSERT_THROWS(target.getWeightedEventsNoTime(), std::runtime_error); + TS_ASSERT_THROWS(target.getWeightedEvents(), const std::runtime_error &); + TS_ASSERT_THROWS(target.getWeightedEventsNoTime(), const std::runtime_error &); eventList.switchTo(EventType::WEIGHTED); target.copyDataFrom(eventList); TS_ASSERT_EQUALS(target.getEventType(), EventType::WEIGHTED) TS_ASSERT_EQUALS(target.getSortType(), eventList.getSortType()); - TS_ASSERT_THROWS(target.getEvents(), std::runtime_error); + TS_ASSERT_THROWS(target.getEvents(), const std::runtime_error &); TS_ASSERT_EQUALS(target.getWeightedEvents(), eventList.getWeightedEvents()); - TS_ASSERT_THROWS(target.getWeightedEventsNoTime(), std::runtime_error); + TS_ASSERT_THROWS(target.getWeightedEventsNoTime(), const std::runtime_error &); eventList.switchTo(EventType::WEIGHTED_NOTIME); target.copyDataFrom(eventList); TS_ASSERT_EQUALS(target.getEventType(), EventType::WEIGHTED_NOTIME) TS_ASSERT_EQUALS(target.getSortType(), eventList.getSortType()); - TS_ASSERT_THROWS(target.getEvents(), std::runtime_error); - TS_ASSERT_THROWS(target.getWeightedEvents(), std::runtime_error); + TS_ASSERT_THROWS(target.getEvents(), const std::runtime_error &); + TS_ASSERT_THROWS(target.getWeightedEvents(), const std::runtime_error &); TS_ASSERT_EQUALS(target.getWeightedEventsNoTime(), eventList.getWeightedEventsNoTime()); } @@ -295,12 +295,12 @@ public: this->fake_data(); TS_ASSERT_EQUALS(el.getEvents().size(), NUMEVENTS); TS_ASSERT_EQUALS(el.getNumberEvents(), NUMEVENTS); - TS_ASSERT_THROWS(el.getWeightedEvents().size(), std::runtime_error); - TS_ASSERT_THROWS(el.getWeightedEventsNoTime().size(), std::runtime_error); + TS_ASSERT_THROWS(el.getWeightedEvents().size(), const std::runtime_error &); + TS_ASSERT_THROWS(el.getWeightedEventsNoTime().size(), const std::runtime_error &); el.switchTo(WEIGHTED); - TS_ASSERT_THROWS(el.getEvents().size(), std::runtime_error); - TS_ASSERT_THROWS(el.getWeightedEventsNoTime().size(), std::runtime_error); + TS_ASSERT_THROWS(el.getEvents().size(), const std::runtime_error &); + TS_ASSERT_THROWS(el.getWeightedEventsNoTime().size(), const std::runtime_error &); TS_ASSERT_EQUALS(el.getWeightedEvents().size(), NUMEVENTS); TS_ASSERT_EQUALS(el.getNumberEvents(), NUMEVENTS); TS_ASSERT_EQUALS(el.getEvent(0).weight(), 1.0); @@ -312,8 +312,8 @@ public: // Start with a bit of fake data this->fake_data(); el.switchTo(WEIGHTED_NOTIME); - TS_ASSERT_THROWS(el.getEvents().size(), std::runtime_error); - TS_ASSERT_THROWS(el.getWeightedEvents().size(), std::runtime_error); + TS_ASSERT_THROWS(el.getEvents().size(), const std::runtime_error &); + TS_ASSERT_THROWS(el.getWeightedEvents().size(), const std::runtime_error &); TS_ASSERT_EQUALS(el.getWeightedEventsNoTime().size(), NUMEVENTS); TS_ASSERT_EQUALS(el.getNumberEvents(), NUMEVENTS); TS_ASSERT_EQUALS(el.getWeightedEventsNoTime()[0].weight(), 1.0); @@ -596,9 +596,9 @@ public: void test_divide_by_zero() { // Perform the multiply - TS_ASSERT_THROWS(el.divide(0.0, 0.5), std::invalid_argument); - TS_ASSERT_THROWS(el.divide(0.0), std::invalid_argument); - TS_ASSERT_THROWS(el /= 0, std::invalid_argument); + TS_ASSERT_THROWS(el.divide(0.0, 0.5), const std::invalid_argument &); + TS_ASSERT_THROWS(el.divide(0.0), const std::invalid_argument &); + TS_ASSERT_THROWS(el /= 0, const std::invalid_argument &); } //----------------------------------------------------------------------------------------------- @@ -982,7 +982,7 @@ public: TSM_ASSERT_THROWS( "We don't support WeightedEvents with this feature at present.", - eList.generateHistogramPulseTime(X, Y, E), std::runtime_error); + eList.generateHistogramPulseTime(X, Y, E), const std::runtime_error &); } void test_histogram_by_time_at_sample_pulse_only() { @@ -1656,7 +1656,7 @@ public: if (curType == WEIGHTED_NOTIME) { TS_ASSERT_THROWS(el.filterByPulseTime(100, 200, out), - std::runtime_error); + const std::runtime_error &); } else { TS_ASSERT_THROWS_NOTHING(el.filterByPulseTime(100, 200, out);); @@ -1683,7 +1683,7 @@ public: } void test_filterByPulseTime_output_same_as_input_throws() { - TS_ASSERT_THROWS(el.filterByPulseTime(100, 200, el), std::invalid_argument); + TS_ASSERT_THROWS(el.filterByPulseTime(100, 200, el), const std::invalid_argument &); } void test_filter_by_time_at_sample_behaves_like_filter_by_pulse_time() { @@ -1705,7 +1705,7 @@ public: if (curType == WEIGHTED_NOTIME) { TS_ASSERT_THROWS( el.filterByTimeAtSample(100, 200, tofFactor, tofOffset, out), - std::runtime_error); + const std::runtime_error &); } else { TS_ASSERT_THROWS_NOTHING( el.filterByTimeAtSample(100, 200, tofFactor, tofOffset, out);); @@ -1752,7 +1752,7 @@ public: if (curType == WEIGHTED_NOTIME) { TS_ASSERT_THROWS(el.filterByTimeAtSample(startTEpoch, endTEpoch, tofFactor, tofOffset, out), - std::runtime_error); + const std::runtime_error &); } else { TS_ASSERT_THROWS_NOTHING(el.filterByTimeAtSample( startTEpoch, endTEpoch, tofFactor, tofOffset, out);); @@ -1809,7 +1809,7 @@ public: if (curType == WEIGHTED_NOTIME) { TS_ASSERT_THROWS(el.filterByTimeAtSample(startTEpoch, endTEpoch, tofFactor, tofOffset, out), - std::runtime_error); + const std::runtime_error &); } else { TS_ASSERT_THROWS_NOTHING(el.filterByTimeAtSample( startTEpoch, endTEpoch, tofFactor, tofOffset, out);); @@ -1940,7 +1940,7 @@ public: if (curType == WEIGHTED_NOTIME) { // Error cause no time - TS_ASSERT_THROWS(el.splitByTime(split, outputs), std::runtime_error); + TS_ASSERT_THROWS(el.splitByTime(split, outputs), const std::runtime_error &); } else { // Do the splitting TS_ASSERT_THROWS_NOTHING(el.splitByTime(split, outputs);); @@ -2062,7 +2062,7 @@ public: this->fake_uniform_time_data(); el.switchTo(WEIGHTED_NOTIME); TimeSplitterType split; - TS_ASSERT_THROWS(el.filterInPlace(split), std::runtime_error) + TS_ASSERT_THROWS(el.filterInPlace(split), const std::runtime_error &) } //---------------------------------------------------------------------------------------------- @@ -2159,7 +2159,7 @@ public: EventList el_notime = this->fake_data(WEIGHTED_NOTIME); TS_ASSERT_THROWS(el_notime.compressFatEvents(10., DateAndTime(0), 10., &el_notime_output), - std::invalid_argument); + const std::invalid_argument &); // integration range const double XMIN = 0.; @@ -2687,10 +2687,10 @@ public: void test_readYE_throws_without_MRU() { const EventList el; - TS_ASSERT_THROWS(el.readY(), std::runtime_error); - TS_ASSERT_THROWS(el.dataY(), std::runtime_error); - TS_ASSERT_THROWS(el.readE(), std::runtime_error); - TS_ASSERT_THROWS(el.dataE(), std::runtime_error); + TS_ASSERT_THROWS(el.readY(), const std::runtime_error &); + TS_ASSERT_THROWS(el.dataY(), const std::runtime_error &); + TS_ASSERT_THROWS(el.readE(), const std::runtime_error &); + TS_ASSERT_THROWS(el.dataE(), const std::runtime_error &); } void test_counts_works_without_MRU() { @@ -2703,7 +2703,7 @@ public: EventList el; el.setHistogram(HistogramData::BinEdges{0, 2}); TS_ASSERT_THROWS_NOTHING(el.setBinEdges(HistogramData::BinEdges{0, 2})); - TS_ASSERT_THROWS(el.setPoints(1), std::runtime_error); + TS_ASSERT_THROWS(el.setPoints(1), const std::runtime_error &); // Uncertainties for X are always for Points, this must work. TS_ASSERT_THROWS_NOTHING(el.setPointVariances(1)); TS_ASSERT_THROWS_NOTHING(el.setPointStandardDeviations(1)); @@ -2712,31 +2712,31 @@ public: void test_setCounts_fails() { EventList el; el.setHistogram(HistogramData::BinEdges{0, 2}); - TS_ASSERT_THROWS(el.setCounts(1), std::runtime_error); - TS_ASSERT_THROWS(el.setCountVariances(1), std::runtime_error); - TS_ASSERT_THROWS(el.setCountStandardDeviations(1), std::runtime_error); + TS_ASSERT_THROWS(el.setCounts(1), const std::runtime_error &); + TS_ASSERT_THROWS(el.setCountVariances(1), const std::runtime_error &); + TS_ASSERT_THROWS(el.setCountStandardDeviations(1), const std::runtime_error &); } void test_setFrequencies_fails() { EventList el; el.setHistogram(HistogramData::BinEdges{0, 2}); - TS_ASSERT_THROWS(el.setFrequencies(1), std::runtime_error); - TS_ASSERT_THROWS(el.setFrequencyVariances(1), std::runtime_error); - TS_ASSERT_THROWS(el.setFrequencyStandardDeviations(1), std::runtime_error); + TS_ASSERT_THROWS(el.setFrequencies(1), const std::runtime_error &); + TS_ASSERT_THROWS(el.setFrequencyVariances(1), const std::runtime_error &); + TS_ASSERT_THROWS(el.setFrequencyStandardDeviations(1), const std::runtime_error &); } void test_setShared_fails() { EventList el; TS_ASSERT_THROWS_NOTHING(el.setSharedX(el.sharedX())); - TS_ASSERT_THROWS(el.setSharedY(el.sharedY()), std::runtime_error); - TS_ASSERT_THROWS(el.setSharedE(el.sharedE()), std::runtime_error); + TS_ASSERT_THROWS(el.setSharedY(el.sharedY()), const std::runtime_error &); + TS_ASSERT_THROWS(el.setSharedE(el.sharedE()), const std::runtime_error &); } void test_mutable_access_fails() { EventList el; TS_ASSERT_THROWS_NOTHING(el.mutableX()); - TS_ASSERT_THROWS(el.mutableY(), std::runtime_error); - TS_ASSERT_THROWS(el.mutableE(), std::runtime_error); + TS_ASSERT_THROWS(el.mutableY(), const std::runtime_error &); + TS_ASSERT_THROWS(el.mutableE(), const std::runtime_error &); } void test_histogram() { @@ -2772,9 +2772,9 @@ public: TS_ASSERT_THROWS_NOTHING(el.setHistogram(histogram)); TS_ASSERT_EQUALS(el.sharedX(), histogram.sharedX()); histogram.setCounts(2); - TS_ASSERT_THROWS(el.setHistogram(histogram), std::runtime_error); + TS_ASSERT_THROWS(el.setHistogram(histogram), const std::runtime_error &); HistogramData::Histogram points(HistogramData::Points{0, 2}); - TS_ASSERT_THROWS(el.setHistogram(points), std::runtime_error); + TS_ASSERT_THROWS(el.setHistogram(points), const std::runtime_error &); } void test_YMode() { @@ -2788,7 +2788,7 @@ public: h.setYMode(HistogramData::Histogram::YMode::Counts); TS_ASSERT_THROWS_NOTHING(e.setHistogram(h)); h.setYMode(HistogramData::Histogram::YMode::Frequencies); - TS_ASSERT_THROWS(e.setHistogram(h), std::runtime_error); + TS_ASSERT_THROWS(e.setHistogram(h), const std::runtime_error &); } void test_setHistogram_preserves_YMode_when_setting_uninitialized() { diff --git a/Framework/DataObjects/test/EventWorkspaceTest.h b/Framework/DataObjects/test/EventWorkspaceTest.h index 288b7243408..6cc033531ac 100644 --- a/Framework/DataObjects/test/EventWorkspaceTest.h +++ b/Framework/DataObjects/test/EventWorkspaceTest.h @@ -157,7 +157,7 @@ public: // set the first histogram to have 2 bins ew->getSpectrum(0).setHistogram(BinEdges({0., 10., 20.})); - TS_ASSERT_THROWS(ew->blocksize(), std::logic_error); + TS_ASSERT_THROWS(ew->blocksize(), const std::logic_error &); TS_ASSERT(!(ew->isCommonBins())); TS_ASSERT_EQUALS(ew->size(), 501); } @@ -242,20 +242,20 @@ public: TS_ASSERT_EQUALS(el5.getNumberEvents(), 55); // Out of range - TS_ASSERT_THROWS(uneven->dataX(-3), std::range_error); - TS_ASSERT_THROWS(uneven->dataX(NUMPIXELS / 10), std::range_error); + TS_ASSERT_THROWS(uneven->dataX(-3), const std::range_error &); + TS_ASSERT_THROWS(uneven->dataX(NUMPIXELS / 10), const std::range_error &); } void test_data_access() { // Non-const access throws errors for Y & E - not for X TS_ASSERT_THROWS_NOTHING(ew->dataX(1)); - TS_ASSERT_THROWS(ew->dataY(2), NotImplementedError); - TS_ASSERT_THROWS(ew->dataE(3), NotImplementedError); + TS_ASSERT_THROWS(ew->dataY(2), const NotImplementedError &); + TS_ASSERT_THROWS(ew->dataE(3), const NotImplementedError &); // Out of range - TS_ASSERT_THROWS(ew->dataX(-123), std::range_error); - TS_ASSERT_THROWS(ew->dataX(5123), std::range_error); - TS_ASSERT_THROWS(ew->dataE(5123), NotImplementedError); - TS_ASSERT_THROWS(ew->dataY(5123), NotImplementedError); + TS_ASSERT_THROWS(ew->dataX(-123), const std::range_error &); + TS_ASSERT_THROWS(ew->dataX(5123), const std::range_error &); + TS_ASSERT_THROWS(ew->dataE(5123), const NotImplementedError &); + TS_ASSERT_THROWS(ew->dataY(5123), const NotImplementedError &); // Can't try the const access; copy constructors are not allowed. } @@ -419,7 +419,7 @@ public: MantidVec X, Y, E; TSM_ASSERT_THROWS("Number of histograms is out of range, should throw", ws->generateHistogramPulseTime(nHistos + 1, X, Y, E), - std::range_error); + const std::range_error &); } void do_test_binning(EventWorkspace_sptr ws, const BinEdges &axis, diff --git a/Framework/DataObjects/test/FakeMDTest.h b/Framework/DataObjects/test/FakeMDTest.h index 30237c0695b..b0764fe5c81 100644 --- a/Framework/DataObjects/test/FakeMDTest.h +++ b/Framework/DataObjects/test/FakeMDTest.h @@ -37,7 +37,7 @@ public: TS_ASSERT_THROWS( FakeMD(uniformParams, peakParams, randomSeed, randomizeSignal), - std::invalid_argument); + const std::invalid_argument &); } //--------------------------------------------------------------------------- diff --git a/Framework/DataObjects/test/Histogram1DTest.h b/Framework/DataObjects/test/Histogram1DTest.h index 1c4685de547..0efe0bf5200 100644 --- a/Framework/DataObjects/test/Histogram1DTest.h +++ b/Framework/DataObjects/test/Histogram1DTest.h @@ -105,7 +105,7 @@ public: void testcheckAndSanitizeHistogramThrowsNullY() { Histogram1D h{Histogram::XMode::Points, Histogram::YMode::Counts}; BinEdges edges{-0.04, 1.7}; - TS_ASSERT_THROWS(h.setHistogram(edges), std::invalid_argument); + TS_ASSERT_THROWS(h.setHistogram(edges), const std::invalid_argument &); } void testcheckAndSanitizeHistogramThrowsNullE() { @@ -114,7 +114,7 @@ public: Histogram histogram{edges}; Counts counts{23}; histogram.setCounts(counts); - TS_ASSERT_THROWS(h.setHistogram(histogram), std::invalid_argument); + TS_ASSERT_THROWS(h.setHistogram(histogram), const std::invalid_argument &); } void testsetgetXvector() { @@ -171,16 +171,16 @@ public: } void testrangeexceptionX() { h.setPoints(x1); - TS_ASSERT_THROWS(h.dataX().at(nel), std::out_of_range); + TS_ASSERT_THROWS(h.dataX().at(nel), const std::out_of_range &); } void testrangeexceptionY() { h.setCounts(y1); - TS_ASSERT_THROWS(h.dataY().at(nel), std::out_of_range); + TS_ASSERT_THROWS(h.dataY().at(nel), const std::out_of_range &); } void testrangeexceptionE() { h.setCounts(y1); h.setCountStandardDeviations(e1); - TS_ASSERT_THROWS(h.dataE().at(nel), std::out_of_range); + TS_ASSERT_THROWS(h.dataE().at(nel), const std::out_of_range &); } void test_copy_constructor() { diff --git a/Framework/DataObjects/test/MDBoxBaseTest.h b/Framework/DataObjects/test/MDBoxBaseTest.h index 6ec1cec6ada..85c7d194ea4 100644 --- a/Framework/DataObjects/test/MDBoxBaseTest.h +++ b/Framework/DataObjects/test/MDBoxBaseTest.h @@ -266,7 +266,7 @@ public: TS_ASSERT_DELTA(b.getExtents(1).getMin(), -4.0, 1e-6); TS_ASSERT_DELTA(b.getExtents(1).getMax(), +12.0, 1e-6); - TS_ASSERT_THROWS(b.setExtents(2, 0, 1.0), std::invalid_argument); + TS_ASSERT_THROWS(b.setExtents(2, 0, 1.0), const std::invalid_argument &); coord_t center[2]; b.getCenter(center); diff --git a/Framework/DataObjects/test/MDBoxFlatTreeTest.h b/Framework/DataObjects/test/MDBoxFlatTreeTest.h index d24913d1e66..3fde6195a08 100644 --- a/Framework/DataObjects/test/MDBoxFlatTreeTest.h +++ b/Framework/DataObjects/test/MDBoxFlatTreeTest.h @@ -52,7 +52,7 @@ public: "Should throw as the box data were written for lean event and now we " "try to retrieve full events", BoxStoredTree.loadBoxStructure("someFile.nxs", nDims, "MDEvent"), - std::runtime_error); + const std::runtime_error &); nDims = 0; TSM_ASSERT_THROWS_NOTHING( diff --git a/Framework/DataObjects/test/MDBoxTest.h b/Framework/DataObjects/test/MDBoxTest.h index 2eb3169b817..ac10602c6bf 100644 --- a/Framework/DataObjects/test/MDBoxTest.h +++ b/Framework/DataObjects/test/MDBoxTest.h @@ -380,7 +380,7 @@ public: sc->setSplitThreshold(10); using MACROS_ARE_DUMB = MDBox<MDLeanEvent<3>, 3>; //...since they get confused by commas - TS_ASSERT_THROWS(MACROS_ARE_DUMB b3(sc.get()), std::invalid_argument); + TS_ASSERT_THROWS(MACROS_ARE_DUMB b3(sc.get()), const std::invalid_argument &); } void test_splitter() { diff --git a/Framework/DataObjects/test/MDEventFactoryTest.h b/Framework/DataObjects/test/MDEventFactoryTest.h index 6d82f9a8ed7..89a93b9c906 100644 --- a/Framework/DataObjects/test/MDEventFactoryTest.h +++ b/Framework/DataObjects/test/MDEventFactoryTest.h @@ -42,7 +42,7 @@ public: ew->displayNormalizationHisto(), histoNormalization); TS_ASSERT_THROWS(ew = MDEventFactory::CreateMDWorkspace(0), - std::invalid_argument); + const std::invalid_argument &); } void test_box_factory() { @@ -84,10 +84,10 @@ public: TS_ASSERT_THROWS(MDEventFactory::createBox( 0, MDEventFactory::BoxType::MDBoxWithLean, bc), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(MDEventFactory::createBox( 10, MDEventFactory::BoxType::MDGridBoxWithFat, bc), - std::invalid_argument); + const std::invalid_argument &); } // Templated function that will be called for a specific MDEW diff --git a/Framework/DataObjects/test/MDEventTest.h b/Framework/DataObjects/test/MDEventTest.h index 16f522ee836..0af05444d26 100644 --- a/Framework/DataObjects/test/MDEventTest.h +++ b/Framework/DataObjects/test/MDEventTest.h @@ -120,7 +120,7 @@ public: std::vector<MDLeanEvent<4>> transfEvents4; TS_ASSERT_THROWS(MDLeanEvent<4>::dataToEvents(data, transfEvents4), - std::invalid_argument); + const std::invalid_argument &); std::vector<MDLeanEvent<3>> transfEvents; TS_ASSERT_THROWS_NOTHING(MDLeanEvent<3>::dataToEvents(data, transfEvents)); @@ -199,7 +199,7 @@ public: std::vector<MDEvent<3>> transfEvents3; TS_ASSERT_THROWS(MDEvent<3>::dataToEvents(data, transfEvents3), - std::invalid_argument); + const std::invalid_argument &); std::vector<MDEvent<4>> transfEvents; TS_ASSERT_THROWS_NOTHING(MDEvent<4>::dataToEvents(data, transfEvents)); diff --git a/Framework/DataObjects/test/MDEventWorkspaceTest.h b/Framework/DataObjects/test/MDEventWorkspaceTest.h index 09875999ec9..d4e08910021 100644 --- a/Framework/DataObjects/test/MDEventWorkspaceTest.h +++ b/Framework/DataObjects/test/MDEventWorkspaceTest.h @@ -172,18 +172,18 @@ public: void test_initialize_throws() { IMDEventWorkspace *ew = new MDEventWorkspace<MDLeanEvent<3>, 3>(); Mantid::Geometry::GeneralFrame frame("m", "m"); - TS_ASSERT_THROWS(ew->initialize(), std::runtime_error); + TS_ASSERT_THROWS(ew->initialize(), const std::runtime_error &); for (size_t i = 0; i < 5; i++) ew->addDimension(MDHistoDimension_sptr( new MDHistoDimension("x", "x", frame, -1, 1, 0))); - TS_ASSERT_THROWS(ew->initialize(), std::runtime_error); + TS_ASSERT_THROWS(ew->initialize(), const std::runtime_error &); delete ew; } void test_initialize() { IMDEventWorkspace *ew = new MDEventWorkspace<MDLeanEvent<3>, 3>(); Mantid::Geometry::GeneralFrame frame("m", "m"); - TS_ASSERT_THROWS(ew->initialize(), std::runtime_error); + TS_ASSERT_THROWS(ew->initialize(), const std::runtime_error &); for (size_t i = 0; i < 3; i++) ew->addDimension(MDHistoDimension_sptr( new MDHistoDimension("x", "x", frame, -1, 1, 0))); diff --git a/Framework/DataObjects/test/MDFramesToSpecialCoordinateSystemTest.h b/Framework/DataObjects/test/MDFramesToSpecialCoordinateSystemTest.h index 8ce8f3591f1..355ecfa0a21 100644 --- a/Framework/DataObjects/test/MDFramesToSpecialCoordinateSystemTest.h +++ b/Framework/DataObjects/test/MDFramesToSpecialCoordinateSystemTest.h @@ -34,7 +34,7 @@ public: // Act + Assert TSM_ASSERT_THROWS( "Should throw as only MDEvent and MDHisto workspaces are allowed", - converter(ws.get()), std::invalid_argument); + converter(ws.get()), const std::invalid_argument &); } void test_that_throws_for_non_uniform_Q_coodinate_system() { @@ -55,7 +55,7 @@ public: // Act + Assert TSM_ASSERT_THROWS( "Should throw as coordinate system is mixed with several Q types.", - converter(ws.get()), std::invalid_argument); + converter(ws.get()), const std::invalid_argument &); } void test_that_doesn_not_throw_for_non_uniform_Q_coodinate_system() { diff --git a/Framework/DataObjects/test/MDGridBoxTest.h b/Framework/DataObjects/test/MDGridBoxTest.h index 850a91086f1..107b3314773 100644 --- a/Framework/DataObjects/test/MDGridBoxTest.h +++ b/Framework/DataObjects/test/MDGridBoxTest.h @@ -452,7 +452,7 @@ public: std::vector<coord_t> cenroid(2, 0); TS_ASSERT_THROWS(superbox->calculateCentroid(&cenroid[0]), - std::runtime_error); + const std::runtime_error &); // Check the centroid for these 3 events // TS_ASSERT_DELTA( cenroid[0], 3.233, 0.001); diff --git a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h index 715b776a8ba..1677b3e4e1f 100644 --- a/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h +++ b/Framework/DataObjects/test/MDHistoWorkspaceIteratorTest.h @@ -1493,7 +1493,7 @@ public: bool maskDim[] = {true}; TSM_ASSERT_THROWS("Not implemented yet, should throw", it->getVertexesArray(numVertexes, outDimensions, maskDim), - std::runtime_error); + const std::runtime_error &); } void test_getIsMasked() { diff --git a/Framework/DataObjects/test/MaskWorkspaceTest.h b/Framework/DataObjects/test/MaskWorkspaceTest.h index 68f0f12b0fc..6b488faaff6 100644 --- a/Framework/DataObjects/test/MaskWorkspaceTest.h +++ b/Framework/DataObjects/test/MaskWorkspaceTest.h @@ -28,8 +28,8 @@ public: Mantid::DataObjects::MaskWorkspace maskWS(nDetectors); TS_ASSERT_EQUALS(maskWS.getNumberHistograms(), nDetectors); TS_ASSERT_EQUALS(maskWS.blocksize(), 1); - TS_ASSERT_THROWS(maskWS.getNumberMasked(), std::runtime_error); - TS_ASSERT_THROWS(maskWS.isMasked(0), std::runtime_error); + TS_ASSERT_THROWS(maskWS.getNumberMasked(), const std::runtime_error &); + TS_ASSERT_THROWS(maskWS.isMasked(0), const std::runtime_error &); TS_ASSERT_EQUALS(maskWS.isMaskedIndex(0), false); maskWS.setMaskedIndex(0); TS_ASSERT_EQUALS(maskWS.isMaskedIndex(0), true); diff --git a/Framework/DataObjects/test/PeakColumnTest.h b/Framework/DataObjects/test/PeakColumnTest.h index 758d16d6233..7d31089ad19 100644 --- a/Framework/DataObjects/test/PeakColumnTest.h +++ b/Framework/DataObjects/test/PeakColumnTest.h @@ -50,7 +50,8 @@ public: } void test_constructor_throws_given_unknown_name() { - TS_ASSERT_THROWS(PeakColumn(m_peaks, "NotPeakColumn"), std::runtime_error); + TS_ASSERT_THROWS(PeakColumn(m_peaks, "NotPeakColumn"), + const std::runtime_error &); } void test_clone() { @@ -84,19 +85,19 @@ public: void test_PeakColumn_Cannot_Be_Resized() { PeakColumnTestHelper pc(m_peaks, "DetID"); TS_ASSERT_THROWS(pc.resize(10), - Mantid::Kernel::Exception::NotImplementedError); + const Mantid::Kernel::Exception::NotImplementedError &); } void test_Row_Cannot_Be_Inserted_Into_PeakColumn() { PeakColumnTestHelper pc(m_peaks, "DetID"); TS_ASSERT_THROWS(pc.insert(0), - Mantid::Kernel::Exception::NotImplementedError); + const Mantid::Kernel::Exception::NotImplementedError &); } void test_Row_Cannot_Be_Removed_From_PeakColumn() { PeakColumnTestHelper pc(m_peaks, "DetID"); TS_ASSERT_THROWS(pc.remove(0), - Mantid::Kernel::Exception::NotImplementedError); + const Mantid::Kernel::Exception::NotImplementedError &); } void test_cell_returns_correct_value_from_PeakColumn() { diff --git a/Framework/DataObjects/test/RefAxisTest.h b/Framework/DataObjects/test/RefAxisTest.h index b2e6bcbf9c3..bdabefe79fe 100644 --- a/Framework/DataObjects/test/RefAxisTest.h +++ b/Framework/DataObjects/test/RefAxisTest.h @@ -57,7 +57,7 @@ public: TS_ASSERT(m_refAxis->isNumeric()) TS_ASSERT(!m_refAxis->isSpectra()) TS_ASSERT_EQUALS(m_refAxis->unit()->unitID(), "TOF") - TS_ASSERT_THROWS(m_refAxis->spectraNo(0), std::domain_error) + TS_ASSERT_THROWS(m_refAxis->spectraNo(0), const std::domain_error &) } void testClone() { @@ -68,7 +68,7 @@ public: TS_ASSERT_EQUALS(clonedAxis->unit()->unitID(), "TOF") TS_ASSERT(clonedAxis->isNumeric()) TS_ASSERT_EQUALS((*clonedAxis)(0, 0), 1.0) - TS_ASSERT_THROWS((*clonedAxis)(0, 1), std::range_error) + TS_ASSERT_THROWS((*clonedAxis)(0, 1), const std::range_error &) } void testCloneDifferentLength() { @@ -87,24 +87,24 @@ public: TS_ASSERT_EQUALS((*m_refAxis)(0, 2), 10.1) TS_ASSERT_EQUALS((*m_refAxis)(2, 0), 2.1) - TS_ASSERT_THROWS((*m_refAxis)(-1, 0), Exception::IndexError) - TS_ASSERT_THROWS((*m_refAxis)(5, 0), Exception::IndexError) - TS_ASSERT_THROWS((*m_refAxis)(0, -1), std::range_error) - TS_ASSERT_THROWS((*m_refAxis)(0, 5), std::range_error) + TS_ASSERT_THROWS((*m_refAxis)(-1, 0), const Exception::IndexError &) + TS_ASSERT_THROWS((*m_refAxis)(5, 0), const Exception::IndexError &) + TS_ASSERT_THROWS((*m_refAxis)(0, -1), const std::range_error &) + TS_ASSERT_THROWS((*m_refAxis)(0, 5), const std::range_error &) } void testSetValue() { - TS_ASSERT_THROWS(m_refAxis->setValue(0, 9.9), std::domain_error) + TS_ASSERT_THROWS(m_refAxis->setValue(0, 9.9), const std::domain_error &) } void testGetMin() { std::unique_ptr<Axis> newRefAxis(m_refAxis->clone(5, m_space2.get())); - TS_ASSERT_THROWS(newRefAxis->getMin(), std::runtime_error) + TS_ASSERT_THROWS(newRefAxis->getMin(), const std::runtime_error &) } void testGetMax() { std::unique_ptr<Axis> newRefAxis(m_refAxis->clone(5, m_space2.get())); - TS_ASSERT_THROWS(newRefAxis->getMax(), std::runtime_error) + TS_ASSERT_THROWS(newRefAxis->getMax(), const std::runtime_error &) } private: diff --git a/Framework/DataObjects/test/TableWorkspaceTest.h b/Framework/DataObjects/test/TableWorkspaceTest.h index 3896698cbdd..a96cbe477ee 100644 --- a/Framework/DataObjects/test/TableWorkspaceTest.h +++ b/Framework/DataObjects/test/TableWorkspaceTest.h @@ -118,7 +118,8 @@ public: TS_ASSERT_EQUALS(tw.getColumn("Name"), strCol); TS_ASSERT_EQUALS(tw.getColumn("Position"), v3dCol); // Test trying to add existing column returns null pointer - TS_ASSERT_THROWS(tw.addColumn("int", "Number"), std::invalid_argument); + TS_ASSERT_THROWS(tw.addColumn("int", "Number"), + const std::invalid_argument &); tw.getRef<int>("Number", 1) = 17; tw.cell<std::string>(2, 1) = "STRiNG"; @@ -214,13 +215,13 @@ public: TableWorkspace tw(2); tw.addColumn("str", "Name"); tw.addColumn("int", "Number"); - TS_ASSERT_THROWS(tw.String(0, 1), std::runtime_error); - TS_ASSERT_THROWS(tw.Int(0, 3), std::range_error); - TS_ASSERT_THROWS(tw.Int(3, 1), std::range_error); + TS_ASSERT_THROWS(tw.String(0, 1), const std::runtime_error &); + TS_ASSERT_THROWS(tw.Int(0, 3), const std::range_error &); + TS_ASSERT_THROWS(tw.Int(3, 1), const std::range_error &); { TableRow row = tw.appendRow(); - TS_ASSERT_THROWS(row << "One" << 1 << 2, std::range_error); + TS_ASSERT_THROWS(row << "One" << 1 << 2, const std::range_error &); } { @@ -228,12 +229,12 @@ public: int i; double d; TableRow row = tw.getFirstRow(); - TS_ASSERT_THROWS(row >> str >> i >> d, std::range_error); + TS_ASSERT_THROWS(row >> str >> i >> d, const std::range_error &); } { TableRow row = tw.getFirstRow(); - TS_ASSERT_THROWS(row.row(3), std::range_error); + TS_ASSERT_THROWS(row.row(3), const std::range_error &); } } @@ -378,7 +379,8 @@ public: TS_ASSERT_EQUALS(d, 0.0); TS_ASSERT_THROWS_NOTHING(d = tw.getColumn("T")->toDouble(0)); TS_ASSERT_EQUALS(d, 1.0); - TS_ASSERT_THROWS(d = tw.getColumn("S")->toDouble(0), std::invalid_argument); + TS_ASSERT_THROWS(d = tw.getColumn("S")->toDouble(0), + const std::invalid_argument &); } void testGetVectorSetVectorValues() { @@ -388,7 +390,8 @@ public: tw.addColumn("str", "String"); auto &SizeTData = tw.getColVector<size_t>("SizeT"); - TS_ASSERT_THROWS(tw.getColVector<int>("Double"), std::runtime_error); + TS_ASSERT_THROWS(tw.getColVector<int>("Double"), + const std::runtime_error &); std::vector<double> &DoublData = tw.getColVector<double>("Double"); std::vector<std::string> &StrData = tw.getColVector<std::string>("String"); @@ -404,7 +407,7 @@ public: StrData[2] = "3"; auto SizeTDataI = tw.getColVector<size_t>(0); - TS_ASSERT_THROWS(tw.getColVector<int>(1), std::runtime_error); + TS_ASSERT_THROWS(tw.getColVector<int>(1), const std::runtime_error &); auto DoublDataI = tw.getColVector<double>(1); auto StrDataI = tw.getColVector<std::string>(2); diff --git a/Framework/DataObjects/test/VectorColumnTest.h b/Framework/DataObjects/test/VectorColumnTest.h index 7547ec43315..3f127fd71f3 100644 --- a/Framework/DataObjects/test/VectorColumnTest.h +++ b/Framework/DataObjects/test/VectorColumnTest.h @@ -69,7 +69,7 @@ public: TS_ASSERT_EQUALS(col.cell<std::vector<int>>(4), v4); // Non-convertable characters - TS_ASSERT_THROWS(col.read(4, "1,2,a,3"), std::invalid_argument); + TS_ASSERT_THROWS(col.read(4, "1,2,a,3"), const std::invalid_argument &); } void test_print() { diff --git a/Framework/DataObjects/test/Workspace2DTest.h b/Framework/DataObjects/test/Workspace2DTest.h index c9494d4cb81..4d20342d655 100644 --- a/Framework/DataObjects/test/Workspace2DTest.h +++ b/Framework/DataObjects/test/Workspace2DTest.h @@ -26,8 +26,8 @@ using namespace Mantid::Geometry; using namespace Mantid::HistogramData; using namespace Mantid::Kernel; using namespace Mantid::API; -using HistogramData::CountStandardDeviations; using HistogramData::Counts; +using HistogramData::CountStandardDeviations; using HistogramData::LinearGenerator; using WorkspaceCreationHelper::create2DWorkspaceBinned; @@ -90,7 +90,7 @@ public: // mess with the binning and the results change Workspace2D_sptr cloned(ws->clone()); cloned->setHistogram(0, Points(0), Counts(0)); - TS_ASSERT_THROWS(cloned->blocksize(), std::logic_error); + TS_ASSERT_THROWS(cloned->blocksize(), const std::logic_error &); TS_ASSERT(!(cloned->isCommonBins())); TS_ASSERT_EQUALS(cloned->size(), 45); } @@ -103,8 +103,8 @@ public: nbins + 1, LinearGenerator(aNumber, 1.0)); TS_ASSERT_THROWS_NOTHING(ws->setX(0, v)); TS_ASSERT_EQUALS(ws->dataX(0)[0], aNumber); - TS_ASSERT_THROWS(ws->setX(-1, v), std::range_error); - TS_ASSERT_THROWS(ws->setX(nhist + 5, v), std::range_error); + TS_ASSERT_THROWS(ws->setX(-1, v), const std::range_error &); + TS_ASSERT_THROWS(ws->setX(nhist + 5, v), const std::range_error &); } void testSetX_cowptr() { @@ -113,8 +113,8 @@ public: nbins + 1, LinearGenerator(aNumber, 1.0)); TS_ASSERT_THROWS_NOTHING(ws->setX(0, v)); TS_ASSERT_EQUALS(ws->dataX(0)[0], aNumber); - TS_ASSERT_THROWS(ws->setX(-1, v), std::range_error); - TS_ASSERT_THROWS(ws->setX(nhist + 5, v), std::range_error); + TS_ASSERT_THROWS(ws->setX(-1, v), const std::range_error &); + TS_ASSERT_THROWS(ws->setX(nhist + 5, v), const std::range_error &); } void testSetCounts_cowptr() { diff --git a/Framework/DataObjects/test/WorkspaceCreationTest.h b/Framework/DataObjects/test/WorkspaceCreationTest.h index a7fe8b94993..6f544def3ec 100644 --- a/Framework/DataObjects/test/WorkspaceCreationTest.h +++ b/Framework/DataObjects/test/WorkspaceCreationTest.h @@ -244,7 +244,7 @@ public: // No instrument, so spectrum definitions created by make_indices are bad. TS_ASSERT_THROWS( create<Workspace2D>(make_indices(), Histogram(BinEdges{1, 2, 4})), - std::invalid_argument); + const std::invalid_argument &); } void test_create_Instrument_size_Histogram() { @@ -397,7 +397,7 @@ public: // make_indices are bad. TS_ASSERT_THROWS( create<Workspace2D>(*parent, make_indices(), (BinEdges{1, 2, 4})), - std::invalid_argument); + const std::invalid_argument &); } void test_create_parent_IndexInfo() { diff --git a/Framework/DataObjects/test/WorkspaceValidatorsTest.h b/Framework/DataObjects/test/WorkspaceValidatorsTest.h index 797119ee226..af3a2a623b0 100644 --- a/Framework/DataObjects/test/WorkspaceValidatorsTest.h +++ b/Framework/DataObjects/test/WorkspaceValidatorsTest.h @@ -165,7 +165,7 @@ public: ; // fine and no unit - TS_ASSERT_THROWS(wsp1 = ws1, std::invalid_argument); + TS_ASSERT_THROWS(wsp1 = ws1, const std::invalid_argument &); TS_ASSERT_EQUALS(wsp1.setValue(""), "Enter a name for the Input/InOut workspace"); diff --git a/Framework/Geometry/test/BasicHKLFiltersTest.h b/Framework/Geometry/test/BasicHKLFiltersTest.h index 65381551ff5..56c4d71f323 100644 --- a/Framework/Geometry/test/BasicHKLFiltersTest.h +++ b/Framework/Geometry/test/BasicHKLFiltersTest.h @@ -22,9 +22,9 @@ using namespace Mantid::Geometry; using namespace Mantid::Kernel; +using ::testing::_; using ::testing::Mock; using ::testing::Return; -using ::testing::_; class BasicHKLFiltersTest : public CxxTest::TestSuite { public: @@ -39,13 +39,16 @@ public: UnitCell cell(10., 10., 10.); TS_ASSERT_THROWS_NOTHING(HKLFilterDRange dFilter(cell, 1.0)); - TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, -1.0), std::range_error); - TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, 0.0), std::range_error); + TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, -1.0), + const std::range_error &); + TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, 0.0), + const std::range_error &); TS_ASSERT_THROWS_NOTHING(HKLFilterDRange dFilter(cell, 1.0, 2.0)); - TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, 1.0, 0.5), std::range_error); + TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, 1.0, 0.5), + const std::range_error &); TS_ASSERT_THROWS(HKLFilterDRange dFilter(cell, 1.0, -0.5), - std::range_error); + const std::range_error &); } void testHKLFilterDRangeDescription() { @@ -73,7 +76,8 @@ public: void testHKLFilterSpaceGroupConstructor() { SpaceGroup_const_sptr invalid; - TS_ASSERT_THROWS(HKLFilterSpaceGroup sgFilter(invalid), std::runtime_error); + TS_ASSERT_THROWS(HKLFilterSpaceGroup sgFilter(invalid), + const std::runtime_error &); SpaceGroup_const_sptr sg = SpaceGroupFactory::Instance().createSpaceGroup("F d -3 m"); @@ -108,7 +112,7 @@ public: void testHKLFilterStructureFactorConstructor() { StructureFactorCalculator_sptr invalid; TS_ASSERT_THROWS(HKLFilterStructureFactor sfFilter(invalid), - std::runtime_error); + const std::runtime_error &); StructureFactorCalculator_sptr mock = boost::make_shared<MockStructureFactorCalculator>(); diff --git a/Framework/Geometry/test/BoundingBoxTest.h b/Framework/Geometry/test/BoundingBoxTest.h index f722c314eec..22f3ddef890 100644 --- a/Framework/Geometry/test/BoundingBoxTest.h +++ b/Framework/Geometry/test/BoundingBoxTest.h @@ -46,13 +46,13 @@ public: test_That_Construction_With_An_Invalid_Point_Does_Not_Create_A_Bounding_Box() { // xmax < xmin TS_ASSERT_THROWS(BoundingBox(1.0, 4.0, 5.0, 3.0, 2.0, 3.0), - std::invalid_argument); + const std::invalid_argument &); // ymax < ymin TS_ASSERT_THROWS(BoundingBox(1.0, 0.5, 5.0, 3.0, 2.0, 3.0), - std::invalid_argument); + const std::invalid_argument &); // zmax < zmin TS_ASSERT_THROWS(BoundingBox(1.0, 4.0, 5.0, 3.0, 2.0, 6.0), - std::invalid_argument); + const std::invalid_argument &); } void test_That_Default_Construction_Gives_A_Null_Bounding_Box() { @@ -284,9 +284,9 @@ public: TS_ASSERT_THROWS( bbox.doesLineIntersect(V3D(-5.0, -1.0, 0.0), V3D(1.0, 1.0, 0.0)), - Kernel::Exception::NotImplementedError); + const Kernel::Exception::NotImplementedError &); TS_ASSERT_THROWS(bbox.isPointInside(V3D(-5.0, -1.0, 0.0)), - Kernel::Exception::NotImplementedError); + const Kernel::Exception::NotImplementedError &); } void testBBAlignedToNewCoordinateSystemWorksCorrect() { BoundingBox bbox(3.0, 4.0, 5.5, 1.0, 1.0, 1.5); diff --git a/Framework/Geometry/test/CSGObjectTest.h b/Framework/Geometry/test/CSGObjectTest.h index 4c40de5b413..6bb842b3c7f 100644 --- a/Framework/Geometry/test/CSGObjectTest.h +++ b/Framework/Geometry/test/CSGObjectTest.h @@ -873,7 +873,7 @@ public: auto shell = ComponentCreationHelper::createHollowShell(0.5, 1.0); constexpr size_t maxAttempts{1}; TS_ASSERT_THROWS(shell->generatePointInObject(rng, maxAttempts), - std::runtime_error); + const std::runtime_error &); } void testGeneratePointInsideRespectsActiveRegion() { @@ -1125,7 +1125,7 @@ public: void testVolumeThrowsWhenBoundingBoxIsInvalid() { CSGObject shape("This text gives an invalid Object."); - TS_ASSERT_THROWS(shape.volume(), std::runtime_error); + TS_ASSERT_THROWS(shape.volume(), const std::runtime_error &); } void testGetBoundingBoxForCylinder() @@ -1219,7 +1219,7 @@ public: xmin = 3.0; TS_ASSERT_THROWS( geom_obj->defineBoundingBox(xmax, ymax, zmax, xmin, ymin, zmin), - std::invalid_argument); + const std::invalid_argument &); } void testSurfaceTriangulation() /** diff --git a/Framework/Geometry/test/CenteringGroupTest.h b/Framework/Geometry/test/CenteringGroupTest.h index 4f778700679..7258c8cb30d 100644 --- a/Framework/Geometry/test/CenteringGroupTest.h +++ b/Framework/Geometry/test/CenteringGroupTest.h @@ -53,8 +53,8 @@ public: } void testInvalidCentering() { - TS_ASSERT_THROWS(CenteringGroup group("G"), std::invalid_argument); - TS_ASSERT_THROWS(CenteringGroup group("f"), std::invalid_argument); + TS_ASSERT_THROWS(CenteringGroup group("G"), const std::invalid_argument &); + TS_ASSERT_THROWS(CenteringGroup group("f"), const std::invalid_argument &); } private: diff --git a/Framework/Geometry/test/CompAssemblyTest.h b/Framework/Geometry/test/CompAssemblyTest.h index a9690363b1a..edf52d05d60 100644 --- a/Framework/Geometry/test/CompAssemblyTest.h +++ b/Framework/Geometry/test/CompAssemblyTest.h @@ -25,7 +25,7 @@ public: void testEmptyConstructor() { CompAssembly q; TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), ""); TS_ASSERT(!q.getParent()); @@ -38,7 +38,7 @@ public: void testNameValueConstructor() { CompAssembly q("Name"); TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), "Name"); TS_ASSERT(!q.getParent()); @@ -54,7 +54,7 @@ public: CompAssembly *q = new CompAssembly("Child", parent); TS_ASSERT_EQUALS(q->getName(), "Child"); TS_ASSERT_EQUALS(q->nelements(), 0); - TS_ASSERT_THROWS((*q)[0], std::runtime_error); + TS_ASSERT_THROWS((*q)[0], const std::runtime_error &); // check the parent TS_ASSERT(q->getParent()); TS_ASSERT_EQUALS(q->getParent()->getName(), parent->getName()); @@ -72,7 +72,7 @@ public: Component *det2 = new Component("Det2Name"); Component *det3 = new Component("Det3Name"); TS_ASSERT_EQUALS(bank.nelements(), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); bank.add(det1); bank.add(det2); bank.add(det3); @@ -92,11 +92,11 @@ public: TS_ASSERT_EQUALS(bank.nelements(), 1); // Throws if you try to remove a component that's not in there Component *det2 = new Component("Det2Name"); - TS_ASSERT_THROWS(bank.remove(det2), std::runtime_error); + TS_ASSERT_THROWS(bank.remove(det2), const std::runtime_error &); delete det2; // Works on components that are in the assembly TS_ASSERT_EQUALS(bank.remove(det1), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); } //----------------------------------------------------------------------------- @@ -184,7 +184,7 @@ public: Component det2("Det2Name"); Component det3("Det3Name"); TS_ASSERT_EQUALS(bank.nelements(), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); bank.addCopy(&det1); bank.addCopy(&det2); bank.addCopy(&det3, "ChangedDet3Name"); diff --git a/Framework/Geometry/test/ComponentTest.h b/Framework/Geometry/test/ComponentTest.h index 48b205492f8..5f9a194f58a 100644 --- a/Framework/Geometry/test/ComponentTest.h +++ b/Framework/Geometry/test/ComponentTest.h @@ -166,7 +166,7 @@ public: Component q("Child", V3D(5, 6, 7), Quat(1, 1, 1, 1), &parent); TS_ASSERT_THROWS(parent.setDescription("descr"), - Mantid::Kernel::Exception::NotImplementedError); + const Mantid::Kernel::Exception::NotImplementedError &); ParameterMap_sptr pmap(new ParameterMap()); pmap->addString(&q, "ChildMessage", "Message from a child"); @@ -294,7 +294,7 @@ public: // Rotate by angle+axis not implemented yet. Check for exception throw TS_ASSERT_THROWS(comp.rotate(45, V3D(1, 1, 1)), - Mantid::Kernel::Exception::NotImplementedError); + const Mantid::Kernel::Exception::NotImplementedError &); } void testRelativeRotate() { diff --git a/Framework/Geometry/test/CompositeBraggScattererTest.h b/Framework/Geometry/test/CompositeBraggScattererTest.h index 795608ebb7f..2bc75e51073 100644 --- a/Framework/Geometry/test/CompositeBraggScattererTest.h +++ b/Framework/Geometry/test/CompositeBraggScattererTest.h @@ -88,7 +88,7 @@ public: TS_ASSERT_EQUALS(scatterer->propertyCount(), 1); TS_ASSERT_EQUALS(scatterer->nScatterers(), oldCount + 1); - TS_ASSERT_THROWS(scatterer->getScatterer(2), std::out_of_range); + TS_ASSERT_THROWS(scatterer->getScatterer(2), const std::out_of_range &); } void testRemoveScatterer() { @@ -101,9 +101,9 @@ public: TS_ASSERT_EQUALS(scattererCollection->nScatterers(), oldCount - 1); TS_ASSERT_THROWS(scattererCollection->getScatterer(oldCount - 1), - std::out_of_range); + const std::out_of_range &); TS_ASSERT_THROWS(scattererCollection->removeScatterer(10), - std::out_of_range); + const std::out_of_range &); scattererCollection->removeScatterer(0); diff --git a/Framework/Geometry/test/ContainerTest.h b/Framework/Geometry/test/ContainerTest.h index 70549e351b7..4b74900f05f 100644 --- a/Framework/Geometry/test/ContainerTest.h +++ b/Framework/Geometry/test/ContainerTest.h @@ -32,7 +32,7 @@ public: Container can; TS_ASSERT_EQUALS(false, can.hasSampleShape()); TS_ASSERT_THROWS(can.createSampleShape(Container::ShapeArgs()), - std::runtime_error); + const std::runtime_error &); } void test_Construction_With_XML_Assumes_XML_For_Can_Itself() { @@ -105,7 +105,7 @@ public: TS_ASSERT_THROWS(can->setSampleShape("<sphere id=\"shape\"> " "<radius val=\"1.0\" /> " "</sphere>"), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/Geometry/test/ConvexPolygonIteratorTest.h b/Framework/Geometry/test/ConvexPolygonIteratorTest.h index 8423ba9948f..fa652445df8 100644 --- a/Framework/Geometry/test/ConvexPolygonIteratorTest.h +++ b/Framework/Geometry/test/ConvexPolygonIteratorTest.h @@ -77,7 +77,7 @@ public: // so use a pointer instead ConvexPolygon::Iterator *iter(nullptr); TS_ASSERT_THROWS(iter = new ConvexPolygon::Iterator(invalid), - std::invalid_argument); + const std::invalid_argument &); delete iter; } diff --git a/Framework/Geometry/test/ConvexPolygonTest.h b/Framework/Geometry/test/ConvexPolygonTest.h index b8f9ca1368a..fc6bae806d7 100644 --- a/Framework/Geometry/test/ConvexPolygonTest.h +++ b/Framework/Geometry/test/ConvexPolygonTest.h @@ -122,8 +122,8 @@ public: void test_Invalid_Index_Access_Throws_For_At() { using Mantid::Kernel::Exception::IndexError; ConvexPolygon triangle = makeEquilateralTriangle(); - TS_ASSERT_THROWS(triangle.at(3), IndexError); - TS_ASSERT_THROWS(triangle.at(-1), IndexError); + TS_ASSERT_THROWS(triangle.at(3), const IndexError &); + TS_ASSERT_THROWS(triangle.at(-1), const IndexError &); } private: diff --git a/Framework/Geometry/test/GoniometerTest.h b/Framework/Geometry/test/GoniometerTest.h index bd33d43c6d4..b5936cb419b 100644 --- a/Framework/Geometry/test/GoniometerTest.h +++ b/Framework/Geometry/test/GoniometerTest.h @@ -37,7 +37,7 @@ public: M.identityMatrix(); TS_ASSERT(!G.isDefined()); TS_ASSERT_EQUALS(G.getR(), M); - TS_ASSERT_THROWS(G.setRotationAngle("Axis4", 3), std::invalid_argument); + TS_ASSERT_THROWS(G.setRotationAngle("Axis4", 3), const std::invalid_argument &); TS_ASSERT_THROWS_ANYTHING(G.setRotationAngle(1, 2)); TS_ASSERT_EQUALS((G.axesInfo()).compare("No axis is found\n"), 0); TS_ASSERT(!G.isDefined()); @@ -45,7 +45,7 @@ public: TS_ASSERT_THROWS_NOTHING(G.pushAxis("Axis2", 0., 0., 1., 30)); TS_ASSERT(G.isDefined()); TS_ASSERT_THROWS(G.pushAxis("Axis2", 0., 0., 1., 30), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(G.setRotationAngle("Axis2", 25)); TS_ASSERT_THROWS_NOTHING(G.setRotationAngle(0, -17)); TS_ASSERT_EQUALS(G.getAxis(1).angle, 25.); diff --git a/Framework/Geometry/test/GridDetectorTest.h b/Framework/Geometry/test/GridDetectorTest.h index f8206ea3700..5ee9df1f226 100644 --- a/Framework/Geometry/test/GridDetectorTest.h +++ b/Framework/Geometry/test/GridDetectorTest.h @@ -27,7 +27,7 @@ public: void testNameValueConstructor() { GridDetector q("Name"); TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), "Name"); TS_ASSERT(!q.getParent()); @@ -47,7 +47,7 @@ public: TS_ASSERT_EQUALS(q->getName(), "Child"); TS_ASSERT_EQUALS(q->nelements(), 0); - TS_ASSERT_THROWS((*q)[0], std::runtime_error); + TS_ASSERT_THROWS((*q)[0], const std::runtime_error &); // check the parent TS_ASSERT(q->getParent()); TS_ASSERT_EQUALS(q->getParent()->getName(), parent->getName()); @@ -85,7 +85,7 @@ public: TS_ASSERT_THROWS(det->initialize(cuboidShape, 100, -50.0, 1.0, 200, -100.0, 1.0, 300, -20, 1.0, 1000000, "abc", 1000, 1), - std::invalid_argument); + const std::invalid_argument &); } void testFullConstructor() { @@ -210,10 +210,10 @@ private: void do_test_bounds(GridDetector *det) { // Go out of bounds - TS_ASSERT_THROWS(det->getAtXYZ(-1, 0, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXYZ(0, -1, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXYZ(100, 0, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXYZ(0, 205, 0), std::runtime_error); + TS_ASSERT_THROWS(det->getAtXYZ(-1, 0, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXYZ(0, -1, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXYZ(100, 0, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXYZ(0, 205, 0), const std::runtime_error &); } void do_test_ids(GridDetector *det) { diff --git a/Framework/Geometry/test/GroupTest.h b/Framework/Geometry/test/GroupTest.h index 2b881fa6cc8..043cbd31b30 100644 --- a/Framework/Geometry/test/GroupTest.h +++ b/Framework/Geometry/test/GroupTest.h @@ -52,7 +52,7 @@ public: TS_ASSERT_EQUALS(groupOps.size(), 2); std::vector<SymmetryOperation> empty; - TS_ASSERT_THROWS(Group group(empty), std::invalid_argument); + TS_ASSERT_THROWS(Group group(empty), const std::invalid_argument &); } void testCopyConstructor() { @@ -373,17 +373,17 @@ public: // Make sure that null-pointer do not work Group_const_sptr null; - TS_ASSERT_THROWS(null * null, std::invalid_argument); + TS_ASSERT_THROWS(null * null, const std::invalid_argument &); // clang gives a warning if we don't use the result GNU_DIAG_OFF("unused-comparison") - TS_ASSERT_THROWS(null == null, std::invalid_argument); - TS_ASSERT_THROWS(null != null, std::invalid_argument); + TS_ASSERT_THROWS(null == null, const std::invalid_argument &); + TS_ASSERT_THROWS(null != null, const std::invalid_argument &); GNU_DIAG_ON("unused-comparison") - TS_ASSERT_THROWS(three * null, std::invalid_argument); - TS_ASSERT_THROWS(null * three, std::invalid_argument); + TS_ASSERT_THROWS(three * null, const std::invalid_argument &); + TS_ASSERT_THROWS(null * three, const std::invalid_argument &); Mantid::Kernel::V3D coords(0.4, 0.3, 0.1); - TS_ASSERT_THROWS(null * coords, std::invalid_argument); + TS_ASSERT_THROWS(null * coords, const std::invalid_argument &); } }; diff --git a/Framework/Geometry/test/HKLFilterTest.h b/Framework/Geometry/test/HKLFilterTest.h index 2b776070d4f..1e2e7208479 100644 --- a/Framework/Geometry/test/HKLFilterTest.h +++ b/Framework/Geometry/test/HKLFilterTest.h @@ -56,7 +56,7 @@ public: HKLFilter_const_sptr invalid; TS_ASSERT_THROWS(MockHKLFilterUnaryLogicOperation op(invalid), - std::runtime_error); + const std::runtime_error &); } void testBinaryLogicOperation() { @@ -71,11 +71,11 @@ public: HKLFilter_const_sptr invalid; TS_ASSERT_THROWS(MockHKLFilterBinaryLogicOperation op(invalid, rhs), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(MockHKLFilterBinaryLogicOperation op(lhs, invalid), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(MockHKLFilterBinaryLogicOperation op(invalid, invalid), - std::runtime_error); + const std::runtime_error &); } void testHKLFilterNot() { diff --git a/Framework/Geometry/test/HKLFilterWavelengthTest.h b/Framework/Geometry/test/HKLFilterWavelengthTest.h index 87875fa21e5..53a112fb7b4 100644 --- a/Framework/Geometry/test/HKLFilterWavelengthTest.h +++ b/Framework/Geometry/test/HKLFilterWavelengthTest.h @@ -32,17 +32,17 @@ public: HKLFilterWavelength wavelengthFilter(ub, 0.9, 6.0)); TS_ASSERT_THROWS(HKLFilterWavelength wavelengthFilter(ub, -0.9, 6.0), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS(HKLFilterWavelength wavelengthFilter(ub, 0.9, -6.0), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS(HKLFilterWavelength wavelengthFilter(ub, -0.9, -6.0), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS(HKLFilterWavelength wavelengthFilter(ub, 0.0, 6.0), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS(HKLFilterWavelength wavelengthFilter(ub, 0.9, 0.0), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS(HKLFilterWavelength wavelengthFilter(ub, 0.0, 0.0), - std::range_error); + const std::range_error &); } void testDescription() { diff --git a/Framework/Geometry/test/IMDDimensionFactoryTest.h b/Framework/Geometry/test/IMDDimensionFactoryTest.h index 9fb1733f768..6e4a4f7ebcb 100644 --- a/Framework/Geometry/test/IMDDimensionFactoryTest.h +++ b/Framework/Geometry/test/IMDDimensionFactoryTest.h @@ -110,39 +110,39 @@ public: } void testPassInvalidString() { - TS_ASSERT_THROWS(createDimension(""), std::invalid_argument); - TS_ASSERT_THROWS(createDimension("garbage"), std::invalid_argument); + TS_ASSERT_THROWS(createDimension(""), const std::invalid_argument &); + TS_ASSERT_THROWS(createDimension("garbage"), const std::invalid_argument &); std::string missingID = constructNonReciprocalDimensionXMLString().erase(10, 8); - TS_ASSERT_THROWS(createDimension(missingID), std::invalid_argument); + TS_ASSERT_THROWS(createDimension(missingID), const std::invalid_argument &); std::string missingName = constructNonReciprocalDimensionXMLString().erase(19, 19); - TS_ASSERT_THROWS(createDimension(missingName), std::invalid_argument); + TS_ASSERT_THROWS(createDimension(missingName), const std::invalid_argument &); std::string missingUpperBounds = constructNonReciprocalDimensionXMLString().erase(38, 30); TS_ASSERT_THROWS(createDimension(missingUpperBounds), - std::invalid_argument); + const std::invalid_argument &); std::string missingUpperBoundsValue = constructNonReciprocalDimensionXMLString().erase(51, 3); TS_ASSERT_THROWS(createDimension(missingUpperBoundsValue), - std::invalid_argument); + const std::invalid_argument &); std::string missingLowerBounds = constructNonReciprocalDimensionXMLString().erase(68, 28); TS_ASSERT_THROWS(createDimension(missingLowerBounds), - std::invalid_argument); + const std::invalid_argument &); std::string missingLowerBoundsValue = constructNonReciprocalDimensionXMLString().erase(81, 1); TS_ASSERT_THROWS(createDimension(missingLowerBoundsValue), - std::invalid_argument); + const std::invalid_argument &); std::string missingNumberOfBins = constructNonReciprocalDimensionXMLString().erase(96, 30); TS_ASSERT_THROWS(createDimension(missingNumberOfBins), - std::invalid_argument); + const std::invalid_argument &); std::string missingNumberOfBinsValue = constructNonReciprocalDimensionXMLString().erase(110, 1); TS_ASSERT_THROWS(createDimension(missingNumberOfBins), - std::invalid_argument); + const std::invalid_argument &); } void testExtractFrame() { diff --git a/Framework/Geometry/test/InstrumentDefinitionParserTest.h b/Framework/Geometry/test/InstrumentDefinitionParserTest.h index 34843cdf3f2..e23c1c399df 100644 --- a/Framework/Geometry/test/InstrumentDefinitionParserTest.h +++ b/Framework/Geometry/test/InstrumentDefinitionParserTest.h @@ -995,12 +995,12 @@ public: detid_t numDetectors = 2; TS_ASSERT_THROWS(loadInstrLocations(locations, numDetectors, true), - Exception::InstrumentDefinitionError); + const Exception::InstrumentDefinitionError &); locations = R"(<locations n-elements="-1" t="0.0" t-end="180.0" />)"; TS_ASSERT_THROWS(loadInstrLocations(locations, numDetectors, true), - Exception::InstrumentDefinitionError); + const Exception::InstrumentDefinitionError &); } void testLocationsNotANumber() { @@ -1030,7 +1030,7 @@ public: detid_t numDetectors = 2; TS_ASSERT_THROWS(loadInstrLocations(locations, numDetectors, true), - Exception::InstrumentDefinitionError); + const Exception::InstrumentDefinitionError &); } }; diff --git a/Framework/Geometry/test/InstrumentRayTracerTest.h b/Framework/Geometry/test/InstrumentRayTracerTest.h index ec8f86ddaa7..dd66f76c2d0 100644 --- a/Framework/Geometry/test/InstrumentRayTracerTest.h +++ b/Framework/Geometry/test/InstrumentRayTracerTest.h @@ -48,13 +48,13 @@ public: void test_That_Constructor_Throws_Invalid_Argument_On_Giving_A_Null_Instrument() { TS_ASSERT_THROWS(new InstrumentRayTracer(boost::shared_ptr<Instrument>()), - std::invalid_argument); + const std::invalid_argument &); } void test_That_Constructor_Throws_Invalid_Argument_On_Giving_An_Instrument_With_No_Source() { Instrument_sptr testInst(new Instrument("empty")); - TS_ASSERT_THROWS(new InstrumentRayTracer(testInst), std::invalid_argument); + TS_ASSERT_THROWS(new InstrumentRayTracer(testInst), const std::invalid_argument &); } void diff --git a/Framework/Geometry/test/InstrumentTest.h b/Framework/Geometry/test/InstrumentTest.h index 7fb5caff696..a5d589fbf2e 100644 --- a/Framework/Geometry/test/InstrumentTest.h +++ b/Framework/Geometry/test/InstrumentTest.h @@ -67,8 +67,8 @@ public: TS_ASSERT(!i.getSource()); TS_ASSERT(!i.getSample()); TS_ASSERT(!i.isParametrized()); - TS_ASSERT_THROWS(i.baseInstrument(), std::runtime_error); - TS_ASSERT_THROWS(i.getParameterMap(), std::runtime_error); + TS_ASSERT_THROWS(i.baseInstrument(), const std::runtime_error &); + TS_ASSERT_THROWS(i.getParameterMap(), const std::runtime_error &); Instrument ii("anInstrument"); TS_ASSERT(!ii.getSource()); @@ -86,8 +86,8 @@ public: TS_ASSERT_EQUALS(i.getDefaultView(), instrument.getDefaultView()); TS_ASSERT_EQUALS(i.getDefaultAxis(), instrument.getDefaultAxis()); // Should not be parameterized - there's a different constructor for that - TS_ASSERT_THROWS(i.baseInstrument(), std::runtime_error); - TS_ASSERT_THROWS(i.getParameterMap(), std::runtime_error); + TS_ASSERT_THROWS(i.baseInstrument(), const std::runtime_error &); + TS_ASSERT_THROWS(i.getParameterMap(), const std::runtime_error &); TS_ASSERT_EQUALS(i.getValidFromDate(), instrument.getValidFromDate()); TS_ASSERT_EQUALS(i.getValidToDate(), instrument.getValidToDate()); @@ -137,7 +137,7 @@ public: TS_ASSERT(!i.getSource()); ObjComponent *s = new ObjComponent(""); // Cannot have an unnamed source - TS_ASSERT_THROWS(i.markAsSource(s), Exception::InstrumentDefinitionError); + TS_ASSERT_THROWS(i.markAsSource(s), const Exception::InstrumentDefinitionError &); s->setName("source"); TS_ASSERT_THROWS_NOTHING(i.markAsSource(s)); TS_ASSERT_EQUALS(i.getSource().get(), s); @@ -152,8 +152,9 @@ public: void test_Marking_Chopper_Point_Without_Defined_Source_Throws_Exception() { Instrument instr; const ObjComponent *chopper = new ObjComponent("chopper1"); - TS_ASSERT_THROWS(instr.markAsChopperPoint(chopper), - Mantid::Kernel::Exception::InstrumentDefinitionError); + TS_ASSERT_THROWS( + instr.markAsChopperPoint(chopper), + const Mantid::Kernel::Exception::InstrumentDefinitionError &); delete chopper; } @@ -167,13 +168,14 @@ public: void test_Marking_Unamed_Chopper_As_Chopper_Throws_Exception() { Instrument_sptr instr = createInstrumentWithSource(); const ObjComponent *chopper = new ObjComponent(""); - TS_ASSERT_THROWS(instr->markAsChopperPoint(chopper), std::invalid_argument); + TS_ASSERT_THROWS(instr->markAsChopperPoint(chopper), + const std::invalid_argument &); delete chopper; // It was not added to the assembly } void test_Retrieving_Chopper_With_Invalid_Index_Throws_Exception() { Instrument_sptr instr = createInstrumentWithSource(); - TS_ASSERT_THROWS(instr->getChopperPoint(0), std::invalid_argument); + TS_ASSERT_THROWS(instr->getChopperPoint(0), const std::invalid_argument &); } void test_Inserting_Chopper_Closest_To_Source_Gets_Set_To_Index_Zero() { @@ -224,7 +226,7 @@ public: ObjComponent *s = new ObjComponent(""); // Cannot have an unnamed source TS_ASSERT_THROWS(i.markAsSamplePos(s), - Exception::InstrumentDefinitionError); + const Exception::InstrumentDefinitionError &); s->setName("sample"); TS_ASSERT_THROWS_NOTHING(i.markAsSamplePos(s)); TS_ASSERT_EQUALS(i.getSample().get(), s); @@ -250,9 +252,11 @@ public: } void testDetector() { - TS_ASSERT_THROWS(instrument.getDetector(0), Exception::NotFoundError); + TS_ASSERT_THROWS(instrument.getDetector(0), + const Exception::NotFoundError &); TS_ASSERT_EQUALS(instrument.getDetector(1).get(), det); - TS_ASSERT_THROWS(instrument.getDetector(2), Exception::NotFoundError); + TS_ASSERT_THROWS(instrument.getDetector(2), + const Exception::NotFoundError &); Detector *d = new Detector("det", 2, nullptr); TS_ASSERT_THROWS_NOTHING(instrument.markAsDetector(d)); TS_ASSERT_EQUALS(instrument.getDetector(2).get(), d); @@ -267,15 +271,15 @@ public: // Next 2 lines demonstrate what can happen if detector cache and // CompAssembly tree are inconsistent // Unfortunately, the way things were written means that this can happen - TS_ASSERT_THROWS(i.removeDetector(d), std::runtime_error); - TS_ASSERT_THROWS(i.getDetector(1).get(), Exception::NotFoundError); + TS_ASSERT_THROWS(i.removeDetector(d), const std::runtime_error &); + TS_ASSERT_THROWS(i.getDetector(1).get(), const Exception::NotFoundError &); // Now make the 2 calls necessary to do it properly TS_ASSERT_THROWS_NOTHING(i.add(d)); TS_ASSERT_THROWS_NOTHING(i.markAsDetector(d)); TS_ASSERT_EQUALS(i.getDetectorIDs(false).size(), 1); TS_ASSERT_EQUALS(i.nelements(), 1); TS_ASSERT_THROWS_NOTHING(i.removeDetector(d)); - TS_ASSERT_THROWS(i.getDetector(1).get(), Exception::NotFoundError); + TS_ASSERT_THROWS(i.getDetector(1).get(), const Exception::NotFoundError &); TS_ASSERT_EQUALS(i.nelements(), 0); // Now check it does the right thing for a monitor as well @@ -326,7 +330,7 @@ public: std::vector<IDetector_const_sptr> dets; TS_ASSERT_THROWS(dets = instrument.getDetectors(detIDs), - Kernel::Exception::NotFoundError); + const Kernel::Exception::NotFoundError &); } void testCasts() { @@ -406,7 +410,7 @@ public: ComponentCreationHelper::createTestInstrumentRectangular(5, 6); std::vector<IDetector_const_sptr> dets; TS_ASSERT_THROWS(inst->getDetectorsInBank(dets, "bank_in_the_dark_side"), - Exception::NotFoundError) + const Exception::NotFoundError &) } void test_getDetectors() { @@ -653,7 +657,8 @@ public: // GridDetectorPixel (parameters ignored by // GridDetectorPixel::getRelativePos), so we cannot support this. detInfo.setPosition(3, detInfo.position(3) + detOffset); - TS_ASSERT_THROWS(instr->makeLegacyParameterMap(), std::runtime_error); + TS_ASSERT_THROWS(instr->makeLegacyParameterMap(), + const std::runtime_error &); // 2 bank parameters + 0 det parameters TS_ASSERT_EQUALS(legacyMap->size(), 2); diff --git a/Framework/Geometry/test/IsotropicAtomBraggScattererTest.h b/Framework/Geometry/test/IsotropicAtomBraggScattererTest.h index 0d72a4864f2..078d8a3d1a1 100644 --- a/Framework/Geometry/test/IsotropicAtomBraggScattererTest.h +++ b/Framework/Geometry/test/IsotropicAtomBraggScattererTest.h @@ -61,9 +61,9 @@ public: TS_ASSERT_THROWS_NOTHING(scatterer->setProperty("Occupancy", 1.0)); TS_ASSERT_THROWS(scatterer->setProperty("Occupancy", -0.3), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(scatterer->setProperty("Occupancy", 1.3), - std::invalid_argument); + const std::invalid_argument &); } void testGetSetU() { @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING(scatterer->setProperty("U", 1.23e12)); TS_ASSERT_THROWS_NOTHING(scatterer->setProperty("U", 1.23e-2)); - TS_ASSERT_THROWS(scatterer->setProperty("U", -0.2), std::invalid_argument); + TS_ASSERT_THROWS(scatterer->setProperty("U", -0.2), const std::invalid_argument &); } void testCreate() { diff --git a/Framework/Geometry/test/MDGeometryXMLBuilderTest.h b/Framework/Geometry/test/MDGeometryXMLBuilderTest.h index 0a47f50a08a..992a8e589a2 100644 --- a/Framework/Geometry/test/MDGeometryXMLBuilderTest.h +++ b/Framework/Geometry/test/MDGeometryXMLBuilderTest.h @@ -187,16 +187,16 @@ public: MDGeometryBuilderXML<StrictDimensionPolicy> builder; TSM_ASSERT_THROWS("Strict policy should prevent add of a dimension to the " "x mapping, which is integrated.", - builder.addXDimension(dimension), std::invalid_argument); + builder.addXDimension(dimension), const std::invalid_argument &); TSM_ASSERT_THROWS("Strict policy should prevent add of a dimension to the " "y mapping, which is integrated.", - builder.addYDimension(dimension), std::invalid_argument); + builder.addYDimension(dimension), const std::invalid_argument &); TSM_ASSERT_THROWS("Strict policy should prevent add of a dimension to the " "z mapping, which is integrated.", - builder.addZDimension(dimension), std::invalid_argument); + builder.addZDimension(dimension), const std::invalid_argument &); TSM_ASSERT_THROWS("Strict policy should prevent add of a dimension to the " "t mapping, which is integrated.", - builder.addTDimension(dimension), std::invalid_argument); + builder.addTDimension(dimension), const std::invalid_argument &); } // Same as test above, but shouldn't throw. diff --git a/Framework/Geometry/test/MDGeometryXMLParserTest.h b/Framework/Geometry/test/MDGeometryXMLParserTest.h index 2ddbeb0b48a..7e5db3d9efc 100644 --- a/Framework/Geometry/test/MDGeometryXMLParserTest.h +++ b/Framework/Geometry/test/MDGeometryXMLParserTest.h @@ -183,7 +183,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getNonMappedDimensions(), std::runtime_error); + xmlParser.getNonMappedDimensions(), const std::runtime_error &); } void testGetXDimensionThrows() { @@ -191,7 +191,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getXDimension(), std::runtime_error); + xmlParser.getXDimension(), const std::runtime_error &); } void testGetYDimensionThrows() { @@ -199,7 +199,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getYDimension(), std::runtime_error); + xmlParser.getYDimension(), const std::runtime_error &); } void testGetZDimensionThrows() { @@ -207,7 +207,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getZDimension(), std::runtime_error); + xmlParser.getZDimension(), const std::runtime_error &); } void testGetTDimensionThrows() { @@ -215,7 +215,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getTDimension(), std::runtime_error); + xmlParser.getTDimension(), const std::runtime_error &); } void testGetAllDimensionsThrows() { @@ -223,7 +223,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getAllDimensions(), std::runtime_error); + xmlParser.getAllDimensions(), const std::runtime_error &); } void testGetNonIntegratedDimensionsThrows() { @@ -231,7 +231,7 @@ public: MDGeometryXMLParser xmlParser(constructXML("qy", "qx", "en", "qz")); TSM_ASSERT_THROWS( "execute not called before using getter. Should have thrown", - xmlParser.getNonIntegratedDimensions(), std::runtime_error); + xmlParser.getNonIntegratedDimensions(), const std::runtime_error &); } void testGetAllDimensions() { @@ -358,7 +358,7 @@ public: // schema. xmlParser.SetRootNodeCheck( "SomeOtherSchemaElement"); // This won't match so should throw! - TS_ASSERT_THROWS(xmlParser.execute(), std::runtime_error); + TS_ASSERT_THROWS(xmlParser.execute(), const std::runtime_error &); } }; diff --git a/Framework/Geometry/test/MDHistoDimensionBuilderTest.h b/Framework/Geometry/test/MDHistoDimensionBuilderTest.h index 0b1a9a8b77b..d9b237a06d4 100644 --- a/Framework/Geometry/test/MDHistoDimensionBuilderTest.h +++ b/Framework/Geometry/test/MDHistoDimensionBuilderTest.h @@ -173,7 +173,7 @@ public: builder.setMax(2); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testNoIdThrows() { @@ -185,7 +185,7 @@ public: builder.setMax(2); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testNoUnitThrows() { @@ -197,7 +197,7 @@ public: builder.setMax(2); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testNoMaxThrows() { @@ -209,7 +209,7 @@ public: // builder.setMax(2); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testNoMinThrows() { @@ -221,7 +221,7 @@ public: builder.setMax(2); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testMinLessThanMaxThrows() { @@ -233,7 +233,7 @@ public: builder.setMax(0); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testMinEqualToMaxThrows() { @@ -245,7 +245,7 @@ public: builder.setMax(1); builder.setNumBins(1); - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } void testNBinsLessThanOneThrows() { @@ -257,7 +257,7 @@ public: builder.setMax(2); builder.setNumBins(0); // No bins! - TS_ASSERT_THROWS(builder.create(), std::invalid_argument); + TS_ASSERT_THROWS(builder.create(), const std::invalid_argument &); } }; diff --git a/Framework/Geometry/test/MDHistoDimensionTest.h b/Framework/Geometry/test/MDHistoDimensionTest.h index e1bfcc8d118..a587ab7aac5 100644 --- a/Framework/Geometry/test/MDHistoDimensionTest.h +++ b/Framework/Geometry/test/MDHistoDimensionTest.h @@ -25,7 +25,7 @@ public: Mantid::Geometry::GeneralFrame frame("My General Frame", "Furlongs"); TSM_ASSERT_THROWS("Should throw if min > max!", MDHistoDimension("name", "id", frame, min, max, 15), - std::invalid_argument); + const std::invalid_argument &); } void test_constructor() { diff --git a/Framework/Geometry/test/MatrixVectorPairParserTest.h b/Framework/Geometry/test/MatrixVectorPairParserTest.h index ceeb8fc4e11..8dccfdc1ee6 100644 --- a/Framework/Geometry/test/MatrixVectorPairParserTest.h +++ b/Framework/Geometry/test/MatrixVectorPairParserTest.h @@ -27,28 +27,28 @@ public: std::string tooLong("1/2x,-4y,-2-z,x"); TS_ASSERT_THROWS(parseMatrixVectorPair<double>(tooLong), - Exception::ParseError); + const Exception::ParseError &); } void test_throws_on_short_input() { std::string tooShort("2/3x,-x+y"); TS_ASSERT_THROWS(parseMatrixVectorPair<double>(tooShort), - Exception::ParseError); + const Exception::ParseError &); } void test_throws_on_empty_element() { std::string emptyY("2/3x, ,-x+y"); TS_ASSERT_THROWS(parseMatrixVectorPair<double>(emptyY), - Exception::ParseError); + const Exception::ParseError &); } void test_throws_on_zero_division() { std::string zeroDivision("2/0x,-4y,-2-z,x"); TS_ASSERT_THROWS(parseMatrixVectorPair<double>(zeroDivision), - Exception::ParseError); + const Exception::ParseError &); } void test_parse_many_directions() { diff --git a/Framework/Geometry/test/MeshObjectTest.h b/Framework/Geometry/test/MeshObjectTest.h index 4ef4f11464b..430a0e31e2d 100644 --- a/Framework/Geometry/test/MeshObjectTest.h +++ b/Framework/Geometry/test/MeshObjectTest.h @@ -854,7 +854,7 @@ public: auto geom_obj = createOctahedron(); size_t maxAttempts(1); TS_ASSERT_THROWS(geom_obj->generatePointInObject(rng, maxAttempts), - std::runtime_error); + const std::runtime_error &); } void testVolumeOfCube() { diff --git a/Framework/Geometry/test/ObjCompAssemblyTest.h b/Framework/Geometry/test/ObjCompAssemblyTest.h index bc31cf9789b..6697468645d 100644 --- a/Framework/Geometry/test/ObjCompAssemblyTest.h +++ b/Framework/Geometry/test/ObjCompAssemblyTest.h @@ -26,7 +26,7 @@ public: void testNameValueConstructor() { ObjCompAssembly q("Name"); TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), "Name"); TS_ASSERT(!q.getParent()); @@ -42,7 +42,7 @@ public: ObjCompAssembly *q = new ObjCompAssembly("Child", parent); TS_ASSERT_EQUALS(q->getName(), "Child"); TS_ASSERT_EQUALS(q->nelements(), 0); - TS_ASSERT_THROWS((*q)[0], std::runtime_error); + TS_ASSERT_THROWS((*q)[0], const std::runtime_error &); // check the parent TS_ASSERT(q->getParent()); TS_ASSERT_EQUALS(q->getParent()->getName(), parent->getName()); @@ -57,8 +57,9 @@ public: void testAddBad() { ObjCompAssembly bank("BankName"); Component det1("Det1Name"); - TS_ASSERT_THROWS(bank.add(&det1), - Mantid::Kernel::Exception::InstrumentDefinitionError); + TS_ASSERT_THROWS( + bank.add(&det1), + const Mantid::Kernel::Exception::InstrumentDefinitionError &); } void testAdd() { @@ -67,7 +68,7 @@ public: Component *det2 = new ObjComponent("Det2Name"); Component *det3 = new ObjComponent("Det3Name"); TS_ASSERT_EQUALS(bank.nelements(), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); bank.add(det1); bank.add(det2); bank.add(det3); @@ -86,7 +87,7 @@ public: ObjComponent det2("Det2Name"); ObjComponent det3("Det3Name"); TS_ASSERT_EQUALS(bank.nelements(), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); bank.addCopy(&det1); bank.addCopy(&det2); bank.addCopy(&det3, "ChangedDet3Name"); @@ -396,7 +397,7 @@ public: bank.add(det3); TS_ASSERT_THROWS(boost::shared_ptr<IObject> shape = bank.createOutline(), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/Geometry/test/ObjComponentTest.h b/Framework/Geometry/test/ObjComponentTest.h index 32bf56a2dae..05ee1035db5 100644 --- a/Framework/Geometry/test/ObjComponentTest.h +++ b/Framework/Geometry/test/ObjComponentTest.h @@ -181,7 +181,7 @@ public: // throw ObjComponent comp("noShape"); TS_ASSERT_THROWS(comp.interceptSurface(track), - Exception::NullPointerException); + const Exception::NullPointerException &); } void testSolidAngleCappedCylinder() { @@ -211,7 +211,7 @@ public: // throw ObjComponent B("noShape"); TS_ASSERT_THROWS(B.solidAngle(V3D(1, 2, 3)), - Exception::NullPointerException); + const Exception::NullPointerException &); } void testBoundingBoxCappedCylinder() { @@ -445,7 +445,7 @@ public: // throw ObjComponent B("noShape"); TS_ASSERT_THROWS(B.solidAngle(V3D(1, 2, 3)), - Exception::NullPointerException) + const Exception::NullPointerException &) delete A; } diff --git a/Framework/Geometry/test/OrientedLatticeTest.h b/Framework/Geometry/test/OrientedLatticeTest.h index bcc1019b7d2..87dcc11761c 100644 --- a/Framework/Geometry/test/OrientedLatticeTest.h +++ b/Framework/Geometry/test/OrientedLatticeTest.h @@ -93,7 +93,7 @@ public: TSM_ASSERT_THROWS("The transformation to plane defined by two parallel " "vectors should throw", theCell.setUFromVectors(V3D(0, 1, 0), V3D(0, 1, 0)), - std::invalid_argument); + const std::invalid_argument &); } /** @author Alex Buts, fixed by Andrei Savici */ diff --git a/Framework/Geometry/test/ParCompAssemblyTest.h b/Framework/Geometry/test/ParCompAssemblyTest.h index 3058d5eee4b..7306799fe11 100644 --- a/Framework/Geometry/test/ParCompAssemblyTest.h +++ b/Framework/Geometry/test/ParCompAssemblyTest.h @@ -27,7 +27,7 @@ public: CompAssembly pq(&q, pmap.get()); TS_ASSERT_EQUALS(pq.nelements(), 0); - TS_ASSERT_THROWS(pq[0], std::runtime_error); + TS_ASSERT_THROWS(pq[0], const std::runtime_error &); TS_ASSERT_EQUALS(pq.getName(), ""); TS_ASSERT(!pq.getParent()); @@ -44,7 +44,7 @@ public: CompAssembly pq(&q, pmap.get()); TS_ASSERT_EQUALS(pq.nelements(), 0); - TS_ASSERT_THROWS(pq[0], std::runtime_error); + TS_ASSERT_THROWS(pq[0], const std::runtime_error &); TS_ASSERT_EQUALS(pq.getName(), "Name"); TS_ASSERT(!pq.getParent()); @@ -64,7 +64,7 @@ public: TS_ASSERT_EQUALS(pq.getName(), "Child"); TS_ASSERT_EQUALS(pq.nelements(), 0); - TS_ASSERT_THROWS(pq[0], std::runtime_error); + TS_ASSERT_THROWS(pq[0], const std::runtime_error &); // check the parent TS_ASSERT(pq.getParent()); TS_ASSERT_EQUALS(pq.getParent()->getName(), parent->getName()); @@ -82,7 +82,7 @@ public: Component *det2 = new Component("Det2Name"); Component *det3 = new Component("Det3Name"); TS_ASSERT_EQUALS(bank.nelements(), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); bank.add(det1); bank.add(det2); bank.add(det3); diff --git a/Framework/Geometry/test/ParDetectorTest.h b/Framework/Geometry/test/ParDetectorTest.h index 3f399409dab..cd16a899d87 100644 --- a/Framework/Geometry/test/ParDetectorTest.h +++ b/Framework/Geometry/test/ParDetectorTest.h @@ -65,8 +65,8 @@ public: // Reading and writing masking should throw: Masking is now stored in // DetectorInfo and ParameterMap should reject it. - TS_ASSERT_THROWS(pmap->get(&det, "masked"), std::runtime_error); - TS_ASSERT_THROWS(pmap->addBool(&det, "masked", true), std::runtime_error); + TS_ASSERT_THROWS(pmap->get(&det, "masked"), const std::runtime_error &); + TS_ASSERT_THROWS(pmap->addBool(&det, "masked", true), const std::runtime_error &); } void testGetNumberParameter() { diff --git a/Framework/Geometry/test/ParInstrumentTest.h b/Framework/Geometry/test/ParInstrumentTest.h index 1f59db0d82d..22e7ee0b3cd 100644 --- a/Framework/Geometry/test/ParInstrumentTest.h +++ b/Framework/Geometry/test/ParInstrumentTest.h @@ -51,13 +51,14 @@ public: void test_Constructor_Throws_With_Invalid_Pointers() { TS_ASSERT_THROWS(Instrument(boost::shared_ptr<Instrument>(), boost::shared_ptr<ParameterMap>()), - std::invalid_argument); + const std::invalid_argument &); // boost::shared_ptr<Instrument> instr = boost::make_shared<Instrument>(); - // TS_ASSERT_THROWS(Instrument(instr,boost::shared_ptr<ParameterMap>()),std::invalid_argument); + // TS_ASSERT_THROWS(Instrument(instr,boost::shared_ptr<ParameterMap>()),const + // std::invalid_argument &); boost::shared_ptr<ParameterMap> paramMap = boost::make_shared<ParameterMap>(); TS_ASSERT_THROWS(Instrument(boost::shared_ptr<Instrument>(), paramMap), - std::invalid_argument); + const std::invalid_argument &); } void test_getMonitors() { @@ -70,9 +71,11 @@ public: void testDetector() { Instrument pinstrument(instrument, pmap); - TS_ASSERT_THROWS(pinstrument.getDetector(0), Exception::NotFoundError); + TS_ASSERT_THROWS(pinstrument.getDetector(0), + const Exception::NotFoundError &); TS_ASSERT_EQUALS(pinstrument.getDetector(1)->getID(), det->getID()); - TS_ASSERT_THROWS(pinstrument.getDetector(2), Exception::NotFoundError); + TS_ASSERT_THROWS(pinstrument.getDetector(2), + const Exception::NotFoundError &); TS_ASSERT(nullptr == pinstrument.getBaseDetector(0)); Detector *d = new Detector("det", 2, nullptr); diff --git a/Framework/Geometry/test/ParObjCompAssemblyTest.h b/Framework/Geometry/test/ParObjCompAssemblyTest.h index 8fa6cbf6fd8..8bd7fbda516 100644 --- a/Framework/Geometry/test/ParObjCompAssemblyTest.h +++ b/Framework/Geometry/test/ParObjCompAssemblyTest.h @@ -29,7 +29,7 @@ public: ObjCompAssembly pq(&q, pmap.get()); TS_ASSERT_EQUALS(pq.nelements(), 0); - TS_ASSERT_THROWS(pq[0], std::runtime_error); + TS_ASSERT_THROWS(pq[0], const std::runtime_error &); TS_ASSERT_EQUALS(pq.getName(), "Name"); TS_ASSERT(!pq.getParent()); @@ -49,7 +49,7 @@ public: TS_ASSERT_EQUALS(pq.getName(), "Child"); TS_ASSERT_EQUALS(pq.nelements(), 0); - TS_ASSERT_THROWS(pq[0], std::runtime_error); + TS_ASSERT_THROWS(pq[0], const std::runtime_error &); // check the parent TS_ASSERT(pq.getParent()); TS_ASSERT_EQUALS(pq.getParent()->getName(), parent->getName()); @@ -67,7 +67,7 @@ public: Component *det2 = new ObjComponent("Det2Name"); Component *det3 = new ObjComponent("Det3Name"); TS_ASSERT_EQUALS(bank.nelements(), 0); - TS_ASSERT_THROWS(bank[0], std::runtime_error); + TS_ASSERT_THROWS(bank[0], const std::runtime_error &); bank.add(det1); bank.add(det2); bank.add(det3); diff --git a/Framework/Geometry/test/ParObjComponentTest.h b/Framework/Geometry/test/ParObjComponentTest.h index c0d7f5d9be6..27ca851e2aa 100644 --- a/Framework/Geometry/test/ParObjComponentTest.h +++ b/Framework/Geometry/test/ParObjComponentTest.h @@ -196,7 +196,7 @@ public: ObjComponent pcomp(&comp, pmap.get()); TS_ASSERT_THROWS(pcomp.interceptSurface(track), - Exception::NullPointerException); + const Exception::NullPointerException &); } void testSolidAngleCappedCylinder() { @@ -232,7 +232,7 @@ public: ObjComponent pB(&B, pmap.get()); TS_ASSERT_THROWS(pB.solidAngle(V3D(1, 2, 3)), - Exception::NullPointerException); + const Exception::NullPointerException &); } void testBoundingBoxCappedCylinder() { diff --git a/Framework/Geometry/test/PointGroupFactoryTest.h b/Framework/Geometry/test/PointGroupFactoryTest.h index 38562313eb6..b7a692df2ff 100644 --- a/Framework/Geometry/test/PointGroupFactoryTest.h +++ b/Framework/Geometry/test/PointGroupFactoryTest.h @@ -58,7 +58,7 @@ public: PointGroupFactory::Instance().createPointGroup("triclinic")); TS_ASSERT_THROWS(PointGroupFactory::Instance().createPointGroup("cubicC"), - std::invalid_argument); + const std::invalid_argument &); } void testGetAllPointGroupSymbols() { @@ -96,7 +96,7 @@ public: TS_ASSERT_THROWS( PointGroupFactory::Instance().createPointGroup("monoclinicA"), - std::invalid_argument); + const std::invalid_argument &); PointGroupFactory::Instance().subscribePointGroup("monoclinicA", "x,y,-z", "test"); diff --git a/Framework/Geometry/test/PointGroupTest.h b/Framework/Geometry/test/PointGroupTest.h index 1887036560d..f8c4696cdcc 100644 --- a/Framework/Geometry/test/PointGroupTest.h +++ b/Framework/Geometry/test/PointGroupTest.h @@ -366,7 +366,7 @@ public: PointGroup::CrystalSystem::Triclinic); TS_ASSERT_THROWS(getCrystalSystemFromString("DoesNotExist"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_EQUALS(getCrystalSystemFromString(getCrystalSystemAsString( PointGroup::CrystalSystem::Cubic)), @@ -415,7 +415,7 @@ public: PointGroup::LatticeSystem::Triclinic); TS_ASSERT_THROWS(getLatticeSystemFromString("DoesNotExist"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_EQUALS(getLatticeSystemFromString(getLatticeSystemAsString( PointGroup::LatticeSystem::Cubic)), diff --git a/Framework/Geometry/test/RasterizeTest.h b/Framework/Geometry/test/RasterizeTest.h index f47791d74ea..63de4d4880e 100644 --- a/Framework/Geometry/test/RasterizeTest.h +++ b/Framework/Geometry/test/RasterizeTest.h @@ -187,7 +187,7 @@ public: const auto sphere = createSphere(true); TS_ASSERT_THROWS( Rasterize::calculateCylinder(V3D(0., 0., 1.), sphere, 3, 3), - std::invalid_argument); + const std::invalid_argument &); } void test_calculateArbitraryOnCylinder() { diff --git a/Framework/Geometry/test/RectangularDetectorTest.h b/Framework/Geometry/test/RectangularDetectorTest.h index 1a4a8ab31a8..09220e9ed9a 100644 --- a/Framework/Geometry/test/RectangularDetectorTest.h +++ b/Framework/Geometry/test/RectangularDetectorTest.h @@ -27,7 +27,7 @@ public: void testNameValueConstructor() { RectangularDetector q("Name"); TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), "Name"); TS_ASSERT(!q.getParent()); @@ -47,7 +47,7 @@ public: TS_ASSERT_EQUALS(q->getName(), "Child"); TS_ASSERT_EQUALS(q->nelements(), 0); - TS_ASSERT_THROWS((*q)[0], std::runtime_error); + TS_ASSERT_THROWS((*q)[0], const std::runtime_error &); // check the parent TS_ASSERT(q->getParent()); TS_ASSERT_EQUALS(q->getParent()->getName(), parent->getName()); @@ -114,10 +114,10 @@ public: TS_ASSERT_EQUALS(det->ysize(), 200.0); // Go out of bounds - TS_ASSERT_THROWS(det->getAtXY(-1, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXY(0, -1), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXY(100, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXY(0, 205), std::runtime_error); + TS_ASSERT_THROWS(det->getAtXY(-1, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXY(0, -1), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXY(100, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXY(0, 205), const std::runtime_error &); // Check some ids TS_ASSERT_EQUALS(det->getAtXY(0, 0)->getID() - 1000000, 0); diff --git a/Framework/Geometry/test/ReferenceFrameTest.h b/Framework/Geometry/test/ReferenceFrameTest.h index 3a6f2d69c8a..ddaa20e3c16 100644 --- a/Framework/Geometry/test/ReferenceFrameTest.h +++ b/Framework/Geometry/test/ReferenceFrameTest.h @@ -103,7 +103,7 @@ public: void testIdenticalUpAndBeamDirectionsThrow() { TS_ASSERT_THROWS(ReferenceFrame(X, X, Right, "source"), - std::invalid_argument); + const std::invalid_argument &); } void testGetUpDirectionVector() { diff --git a/Framework/Geometry/test/ReflectionConditionTest.h b/Framework/Geometry/test/ReflectionConditionTest.h index 63758402eaa..b4926244594 100644 --- a/Framework/Geometry/test/ReflectionConditionTest.h +++ b/Framework/Geometry/test/ReflectionConditionTest.h @@ -108,7 +108,7 @@ public: } TS_ASSERT_THROWS(getReflectionConditionByName("invalid"), - std::invalid_argument); + const std::invalid_argument &); } void test_getReflectionConditionBySymbol() { @@ -120,7 +120,7 @@ public: } TS_ASSERT_THROWS(getReflectionConditionBySymbol("Q"), - std::invalid_argument); + const std::invalid_argument &); } }; diff --git a/Framework/Geometry/test/SampleEnvironmentFactoryTest.h b/Framework/Geometry/test/SampleEnvironmentFactoryTest.h index 751205f037d..070f320a48a 100644 --- a/Framework/Geometry/test/SampleEnvironmentFactoryTest.h +++ b/Framework/Geometry/test/SampleEnvironmentFactoryTest.h @@ -62,14 +62,14 @@ public: SampleEnvironmentFactory factory( Mantid::Kernel::make_unique<NullSampleEnvSpecFinder>()); TS_ASSERT_THROWS(factory.create("unknown", "unknown", "unknown", "unknown"), - std::runtime_error); + const std::runtime_error &); } void test_Known_Specification_Unknown_Container_Throws() { SampleEnvironmentFactory factory( Mantid::Kernel::make_unique<TestSampleEnvSpecFinder>()); TS_ASSERT_THROWS(factory.create("unknown", "unknown", "CRYO001", "unknown"), - std::invalid_argument); + const std::invalid_argument &); } //---------------------------------------------------------------------------- diff --git a/Framework/Geometry/test/SampleEnvironmentSpecFileFinderTest.h b/Framework/Geometry/test/SampleEnvironmentSpecFileFinderTest.h index 474ab114e7b..28b3e847fe4 100644 --- a/Framework/Geometry/test/SampleEnvironmentSpecFileFinderTest.h +++ b/Framework/Geometry/test/SampleEnvironmentSpecFileFinderTest.h @@ -104,35 +104,35 @@ public: void test_Finder_Throws_If_Empty_Directory_List_Given() { std::vector<std::string> empty; TS_ASSERT_THROWS(SampleEnvironmentSpecFileFinder finder(empty), - std::invalid_argument); + const std::invalid_argument &); } void test_Finder_Throws_If_Facility_Correct_Instrument_Incorrect() { SampleEnvironmentSpecFileFinder finder( std::vector<std::string>(1, m_testRoot)); TS_ASSERT_THROWS(finder.find(m_facilityName, "unknown", m_envName), - std::runtime_error); + const std::runtime_error &); } void test_Finder_Throws_If_Facility_Incorrect_Instrument_Correct() { SampleEnvironmentSpecFileFinder finder( std::vector<std::string>(1, m_testRoot)); TS_ASSERT_THROWS(finder.find("unknown", m_instName, m_envName), - std::runtime_error); + const std::runtime_error &); } void test_Finder_Throws_If_Facility_Instrument_Correct_Bad_Environment() { SampleEnvironmentSpecFileFinder finder( std::vector<std::string>(1, m_testRoot)); TS_ASSERT_THROWS(finder.find(m_facilityName, m_instName, "unknown"), - std::runtime_error); + const std::runtime_error &); } void test_Finder_Throws_If_Filename_Found_But_Content_Invalid() { SampleEnvironmentSpecFileFinder finder( std::vector<std::string>(1, m_testRoot)); TS_ASSERT_THROWS(finder.find(m_facilityName, m_instName, m_badName), - std::runtime_error); + const std::runtime_error &); } private: diff --git a/Framework/Geometry/test/SampleEnvironmentSpecParserTest.h b/Framework/Geometry/test/SampleEnvironmentSpecParserTest.h index 01365d62928..c3d3c063fe7 100644 --- a/Framework/Geometry/test/SampleEnvironmentSpecParserTest.h +++ b/Framework/Geometry/test/SampleEnvironmentSpecParserTest.h @@ -246,13 +246,13 @@ public: std::string xml; std::istringstream instream(xml); SampleEnvironmentSpecParser parser; - TS_ASSERT_THROWS(parser.parse("name", instream), std::runtime_error); + TS_ASSERT_THROWS(parser.parse("name", instream), const std::runtime_error &); } void test_Root_Tag_Must_Be_EnvironmentSpec() { TS_ASSERT_THROWS(parseSpec("name", "<materials>" "</materials>"), - std::invalid_argument); + const std::invalid_argument &); } void test_Missing_Geometry_Tag_Under_Can_Throws_Error() { @@ -281,7 +281,7 @@ public: " </containers>" " </components>" "</environmentspec>"), - std::runtime_error); + const std::runtime_error &); } void test_Missing_Can_ID_Throws_Error() { @@ -310,7 +310,7 @@ public: " </containers>" " </components>" "</environmentspec>"), - std::runtime_error); + const std::runtime_error &); } void test_Missing_Material_For_Can_Throws_Error() { @@ -339,7 +339,7 @@ public: " </containers>" " </components>" "</environmentspec>"), - std::runtime_error); + const std::runtime_error &); } //---------------------------------------------------------------------------- diff --git a/Framework/Geometry/test/SampleEnvironmentSpecTest.h b/Framework/Geometry/test/SampleEnvironmentSpecTest.h index 9221b051f36..fb06d6f834f 100644 --- a/Framework/Geometry/test/SampleEnvironmentSpecTest.h +++ b/Framework/Geometry/test/SampleEnvironmentSpecTest.h @@ -89,21 +89,21 @@ public: SampleEnvironmentSpec spec("CRYO-001"); auto testContainer = boost::make_shared<const Container>(""); - TS_ASSERT_THROWS(spec.addContainer(testContainer), std::invalid_argument); + TS_ASSERT_THROWS(spec.addContainer(testContainer), const std::invalid_argument &); } void test_Find_Throws_If_ID_Not_Found() { using Mantid::Geometry::Container; SampleEnvironmentSpec spec("CRYO-001"); - TS_ASSERT_THROWS(spec.findContainer("8mm"), std::invalid_argument); + TS_ASSERT_THROWS(spec.findContainer("8mm"), const std::invalid_argument &); } void test_BuildEnvironment_Throws_If_ID_Not_Found() { using Mantid::Geometry::Container; SampleEnvironmentSpec spec("CRYO-001"); - TS_ASSERT_THROWS(spec.buildEnvironment("8mm"), std::invalid_argument); + TS_ASSERT_THROWS(spec.buildEnvironment("8mm"), const std::invalid_argument &); } }; diff --git a/Framework/Geometry/test/SampleEnvironmentTest.h b/Framework/Geometry/test/SampleEnvironmentTest.h index 9ffe251dd53..0586b9ceb8e 100644 --- a/Framework/Geometry/test/SampleEnvironmentTest.h +++ b/Framework/Geometry/test/SampleEnvironmentTest.h @@ -160,7 +160,7 @@ public: TS_ASSERT_THROWS(kit->generatePoint(rng, kit->getContainer().getBoundingBox(), maxAttempts), - std::runtime_error); + const std::runtime_error &); Mock::VerifyAndClearExpectations(&rng); } diff --git a/Framework/Geometry/test/SpaceGroupFactoryTest.h b/Framework/Geometry/test/SpaceGroupFactoryTest.h index 6133cebe686..905013af632 100644 --- a/Framework/Geometry/test/SpaceGroupFactoryTest.h +++ b/Framework/Geometry/test/SpaceGroupFactoryTest.h @@ -49,7 +49,7 @@ public: // subscribing twice does not work TS_ASSERT_THROWS(factory.subscribeGeneratedSpaceGroup(2, "P-1", "-x,-y,-z"), - std::invalid_argument); + const std::invalid_argument &); // but having a different symbol for the same number is ok. TS_ASSERT_THROWS_NOTHING( @@ -58,11 +58,11 @@ public: // neither does with a tabulated space group TS_ASSERT_THROWS( factory.subscribeTabulatedSpaceGroup(2, "P-1", "x,y,z; -x,-y,-z"), - std::invalid_argument); + const std::invalid_argument &); // Different number with same symbol - does not work TS_ASSERT_THROWS(factory.subscribeGeneratedSpaceGroup(3, "P-1", "-x,-y,-z"), - std::invalid_argument); + const std::invalid_argument &); // invalid generators are caught before anything is done TS_ASSERT_THROWS_ANYTHING( @@ -87,7 +87,7 @@ public: // subscribing twice does not work TS_ASSERT_THROWS( factory.subscribeTabulatedSpaceGroup(2, "P-1", "x,y,z; -x,-y,-z"), - std::invalid_argument); + const std::invalid_argument &); // but having a different symbol for the same number is ok. TS_ASSERT_THROWS_NOTHING( @@ -95,11 +95,11 @@ public: // neither does with a generated space group TS_ASSERT_THROWS(factory.subscribeGeneratedSpaceGroup(2, "P-1", "-x,-y,-z"), - std::invalid_argument); + const std::invalid_argument &); // Different number with same symbol - does not work TS_ASSERT_THROWS(factory.subscribeTabulatedSpaceGroup(3, "P-1", "-x,-y,-z"), - std::invalid_argument); + const std::invalid_argument &); // invalid generators are caught before anything is done TS_ASSERT_THROWS_ANYTHING( @@ -209,7 +209,7 @@ public: TestableSpaceGroupFactory factory; TS_ASSERT_THROWS(factory.unsubscribeSpaceGroup("P-1"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( factory.subscribeTabulatedSpaceGroup(2, "P-1", "x,y,z; -x,-y,-z")); @@ -285,7 +285,7 @@ public: TransformationSpaceGroupGenerator generator(1, "fake symbol", "Fake base symbol | -x+z,y,-x"); - TS_ASSERT_THROWS(generator.getPrototype(), std::invalid_argument); + TS_ASSERT_THROWS(generator.getPrototype(), const std::invalid_argument &); } void testTransformationSpaceGroupGenerator_succeeds_with_registered_base() { @@ -326,7 +326,7 @@ public: void test_OperatorSymOpString_too_short() { std::vector<std::string> strings{"a", "b"}; TS_ASSERT_THROWS(SymmetryOperation("x,y,z") * strings, - std::invalid_argument); + const std::invalid_argument &); } void test_OperatorSymOpString_correctness() { diff --git a/Framework/Geometry/test/StructuredDetectorTest.h b/Framework/Geometry/test/StructuredDetectorTest.h index 379ad49be76..1b4074b4658 100644 --- a/Framework/Geometry/test/StructuredDetectorTest.h +++ b/Framework/Geometry/test/StructuredDetectorTest.h @@ -36,7 +36,7 @@ public: TS_ASSERT_EQUALS(q.getR().size(), 0); TS_ASSERT_EQUALS(q.getG().size(), 0); TS_ASSERT_EQUALS(q.getB().size(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), ""); TS_ASSERT(!q.getParent()); @@ -59,8 +59,8 @@ public: TS_ASSERT_EQUALS(q.getG().size(), 0); TS_ASSERT_EQUALS(q.getB().size(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); - TS_ASSERT_THROWS(q[0], std::runtime_error); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); + TS_ASSERT_THROWS(q[0], const std::runtime_error &); TS_ASSERT_EQUALS(q.getName(), "Name"); TS_ASSERT(!q.getParent()); @@ -90,7 +90,7 @@ public: TS_ASSERT_EQUALS(q->getG().size(), 0); TS_ASSERT_EQUALS(q->getB().size(), 0); - TS_ASSERT_THROWS((*q)[0], std::runtime_error); + TS_ASSERT_THROWS((*q)[0], const std::runtime_error &); // check the parent TS_ASSERT(q->getParent()); TS_ASSERT_EQUALS(q->getParent()->getName(), parent->getName()); @@ -155,7 +155,7 @@ public: "StructuredDetectors created with beams not aligned " "along the z-axis should fail.", det->initialize(2, 2, std::move(x), std::move(y), false, 0, true, 2, 1), - std::invalid_argument); + const std::invalid_argument &); delete det; } @@ -175,7 +175,7 @@ public: // Initialize with these parameters TS_ASSERT_THROWS( det->initialize(2, 2, std::move(x), std::move(y), true, 0, true, 2, 1), - std::invalid_argument); + const std::invalid_argument &); x2.resize(3); auto x3 = x2; @@ -183,14 +183,14 @@ public: TS_ASSERT_THROWS(det->initialize(2, 2, std::move(x2), std::move(y2), true, 0, true, 2, 1), - std::invalid_argument); + const std::invalid_argument &); x3.resize(0); y3.resize(0); TS_ASSERT_THROWS(det->initialize(2, 2, std::move(x3), std::move(y3), true, 0, true, 2, 1), - std::invalid_argument); + const std::invalid_argument &); delete det; } @@ -208,10 +208,10 @@ public: TS_ASSERT_EQUALS(det->getYValues().size(), size); // Go out of bounds - TS_ASSERT_THROWS(det->getAtXY(-1, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXY(0, -1), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXY(5, 0), std::runtime_error); - TS_ASSERT_THROWS(det->getAtXY(0, 6), std::runtime_error); + TS_ASSERT_THROWS(det->getAtXY(-1, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXY(0, -1), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXY(5, 0), const std::runtime_error &); + TS_ASSERT_THROWS(det->getAtXY(0, 6), const std::runtime_error &); // Check some ids TS_ASSERT_EQUALS(det->getAtXY(0, 0)->getID(), 0); diff --git a/Framework/Geometry/test/SymmetryElementFactoryTest.h b/Framework/Geometry/test/SymmetryElementFactoryTest.h index 3e9ea9036ef..9af13028c0d 100644 --- a/Framework/Geometry/test/SymmetryElementFactoryTest.h +++ b/Framework/Geometry/test/SymmetryElementFactoryTest.h @@ -358,7 +358,7 @@ public: TS_ASSERT_THROWS(factory.subscribeSymmetryElementGenerator< TestableSymmetryElementMirrorGenerator>( "SymmetryElementMirrorGenerator"), - std::runtime_error); + const std::runtime_error &); } void testSymmetryElementFactoryCreateSymElem() { diff --git a/Framework/Geometry/test/SymmetryElementTest.h b/Framework/Geometry/test/SymmetryElementTest.h index de6a6a19910..42c0ae97380 100644 --- a/Framework/Geometry/test/SymmetryElementTest.h +++ b/Framework/Geometry/test/SymmetryElementTest.h @@ -86,7 +86,7 @@ public: TS_ASSERT_THROWS(MockSymmetryElementWithAxis invalidElement( "41", V3R(0, 0, 0), translation), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( MockSymmetryElementWithAxis axisElement("41", axis, translation)); diff --git a/Framework/Geometry/test/SymmetryOperationFactoryTest.h b/Framework/Geometry/test/SymmetryOperationFactoryTest.h index 062dae4fd4e..3331d6263c9 100644 --- a/Framework/Geometry/test/SymmetryOperationFactoryTest.h +++ b/Framework/Geometry/test/SymmetryOperationFactoryTest.h @@ -39,7 +39,7 @@ public: TS_ASSERT_THROWS_NOTHING( SymmetryOperationFactory::Instance().createSymOp("x,y,z")); TS_ASSERT_THROWS(SymmetryOperationFactory::Instance().createSymOp("fake2"), - Mantid::Kernel::Exception::ParseError); + const Mantid::Kernel::Exception::ParseError &); // createSymOp also works when an operation is not subscribed TS_ASSERT_THROWS_NOTHING( @@ -75,7 +75,7 @@ public: opStrings.emplace_back("doesNotWork"); TS_ASSERT_THROWS( symOps = SymmetryOperationFactory::Instance().createSymOps(opStrings), - Mantid::Kernel::Exception::ParseError); + const Mantid::Kernel::Exception::ParseError &); } void testCreateSymOpsString() { @@ -95,10 +95,10 @@ public: TS_ASSERT_THROWS( SymmetryOperationFactory::Instance().createSymOps(invalidSep), - Mantid::Kernel::Exception::ParseError); + const Mantid::Kernel::Exception::ParseError &); TS_ASSERT_THROWS( SymmetryOperationFactory::Instance().createSymOps(invalidOne), - Mantid::Kernel::Exception::ParseError); + const Mantid::Kernel::Exception::ParseError &); } void testUnsubscribe() { diff --git a/Framework/Geometry/test/SymmetryOperationSymbolParserTest.h b/Framework/Geometry/test/SymmetryOperationSymbolParserTest.h index cc9ec84cd89..1619daa3d63 100644 --- a/Framework/Geometry/test/SymmetryOperationSymbolParserTest.h +++ b/Framework/Geometry/test/SymmetryOperationSymbolParserTest.h @@ -39,13 +39,13 @@ public: TS_ASSERT_THROWS( TestableSymmetryOperationSymbolParser::parseIdentifier("1/4, x, -z-x"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( TestableSymmetryOperationSymbolParser::parseIdentifier("x, -z-x"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( TestableSymmetryOperationSymbolParser::parseIdentifier("y, x, -z-x, z"), - std::runtime_error); + const std::runtime_error &); } void testGetNormalizedIdentifier() { diff --git a/Framework/Geometry/test/SymmetryOperationTest.h b/Framework/Geometry/test/SymmetryOperationTest.h index 3cbee17cacd..2448598a68f 100644 --- a/Framework/Geometry/test/SymmetryOperationTest.h +++ b/Framework/Geometry/test/SymmetryOperationTest.h @@ -268,7 +268,7 @@ public: for (int i = 1; i < 10; ++i) { randMatrix.setRandom(1, -i, i); TS_ASSERT_THROWS(symOp.getOrderFromMatrix(randMatrix), - std::runtime_error); + const std::runtime_error &); } } @@ -346,12 +346,12 @@ public: // no [] std::stringstream invalidBrackets; invalidBrackets << "x,-y,z"; - TS_ASSERT_THROWS(invalidBrackets >> mirror, std::runtime_error); + TS_ASSERT_THROWS(invalidBrackets >> mirror, const std::runtime_error &); // invalid string std::stringstream invalid; invalid << "[someString]"; - TS_ASSERT_THROWS(invalid >> mirror, Exception::ParseError); + TS_ASSERT_THROWS(invalid >> mirror, const Exception::ParseError &); } private: diff --git a/Framework/Geometry/test/TorusTest.h b/Framework/Geometry/test/TorusTest.h index a404448d0fe..dbee2f014ff 100644 --- a/Framework/Geometry/test/TorusTest.h +++ b/Framework/Geometry/test/TorusTest.h @@ -23,7 +23,8 @@ class TorusTest : public CxxTest::TestSuite { public: void testEmptyConstructor() { - TS_ASSERT_THROWS(Torus A;, Mantid::Kernel::Exception::NotImplementedError) + TS_ASSERT_THROWS(Torus A; + , const Mantid::Kernel::Exception::NotImplementedError &) // TS_ASSERT_EQUALS(extractString(A),"-1 tx [0,0,0] 0 0 0\n"); // TS_ASSERT_EQUALS(A.getCentre(),V3D(0,0,0)); // TS_ASSERT_EQUALS(A.getNormal(),V3D(1.0,0.0,0.0)); diff --git a/Framework/Geometry/test/UnitCellTest.h b/Framework/Geometry/test/UnitCellTest.h index 358f5c88ac4..c06952fe67d 100644 --- a/Framework/Geometry/test/UnitCellTest.h +++ b/Framework/Geometry/test/UnitCellTest.h @@ -23,7 +23,7 @@ class UnitCellTest : public CxxTest::TestSuite { public: void testInvalidParametersThrow() { TSM_ASSERT_THROWS("Should throw if matrix is not invertible!", - UnitCell(0, 0, 0, 0, 0, 0), std::range_error); + UnitCell(0, 0, 0, 0, 0, 0), const std::range_error &); } void test_Simple() { @@ -120,7 +120,7 @@ public: } void test_UnitCellCrash() { TS_ASSERT_THROWS(UnitCell(10.4165, 3.4165, 10.4165, 30, 45, 80); - , std::invalid_argument); + , const std::invalid_argument &); } void test_printing() { diff --git a/Framework/Geometry/test/V3RTest.h b/Framework/Geometry/test/V3RTest.h index 6454e469758..afe3adaf949 100644 --- a/Framework/Geometry/test/V3RTest.h +++ b/Framework/Geometry/test/V3RTest.h @@ -46,7 +46,7 @@ public: std::vector<int> bad(4, 1); TS_ASSERT_THROWS(V3R rationalIntVecBad(bad), - Mantid::Kernel::Exception::MisMatch<size_t>); + const Mantid::Kernel::Exception::MisMatch<size_t> &); // copy constructor V3R copied(rational); @@ -84,13 +84,13 @@ public: TS_ASSERT_EQUALS(vector[0], 1); TS_ASSERT_EQUALS(vector[1], 2); TS_ASSERT_EQUALS(vector[2], 3); - TS_ASSERT_THROWS(vector[3], Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS(vector[3], const Mantid::Kernel::Exception::IndexError &); TS_ASSERT_THROWS_NOTHING(vector[0] = RationalNumber(2, 3)); TS_ASSERT_THROWS_NOTHING(vector[1] = RationalNumber(2, 3)); TS_ASSERT_THROWS_NOTHING(vector[2] = RationalNumber(2, 3)); TS_ASSERT_THROWS(vector[3] = RationalNumber(2, 3), - Mantid::Kernel::Exception::IndexError); + const Mantid::Kernel::Exception::IndexError &); } void testIntegerAddition() { @@ -165,7 +165,7 @@ public: vector *= 2; TS_ASSERT_EQUALS(vector, originalVector); - TS_ASSERT_THROWS(vector / 0, boost::bad_rational); + TS_ASSERT_THROWS(vector / 0, const boost::bad_rational &); } void testRationalAddition() { @@ -406,10 +406,11 @@ public: // wrong sizes IntMatrix wrongOne(3, 4); TS_ASSERT_THROWS(wrongOne * vector, - Mantid::Kernel::Exception::MisMatch<size_t>); + const Mantid::Kernel::Exception::MisMatch<size_t> &); IntMatrix wrongTwo(4, 3); - TS_ASSERT_THROWS(wrongTwo * vector, Mantid::Kernel::Exception::IndexError); + TS_ASSERT_THROWS(wrongTwo * vector, + const Mantid::Kernel::Exception::IndexError &); // Smaller works IntMatrix wrongThree(2, 3); diff --git a/Framework/Geometry/test/XMLInstrumentParameterTest.h b/Framework/Geometry/test/XMLInstrumentParameterTest.h index c5c069bb9d6..b16fbcce39d 100644 --- a/Framework/Geometry/test/XMLInstrumentParameterTest.h +++ b/Framework/Geometry/test/XMLInstrumentParameterTest.h @@ -63,7 +63,7 @@ public: TSM_ASSERT_THROWS("Unknown flag should cause failure", logFile->createParamValue(&series), - Kernel::Exception::InstrumentDefinitionError) + const Kernel::Exception::InstrumentDefinitionError &) } void test_filter_by_first_value() { diff --git a/Framework/HistogramData/test/AddableTest.h b/Framework/HistogramData/test/AddableTest.h index 0db860e7be3..27a5e1aee8c 100644 --- a/Framework/HistogramData/test/AddableTest.h +++ b/Framework/HistogramData/test/AddableTest.h @@ -79,10 +79,10 @@ public: void test_length_mismatch() { AddableTester rhs1{1, 2}; const AddableTester rhs2{1, 2, 3}; - TS_ASSERT_THROWS(rhs1 + rhs2, std::runtime_error); - TS_ASSERT_THROWS(rhs1 - rhs2, std::runtime_error); - TS_ASSERT_THROWS(rhs1 += rhs2, std::runtime_error); - TS_ASSERT_THROWS(rhs1 -= rhs2, std::runtime_error); + TS_ASSERT_THROWS(rhs1 + rhs2, const std::runtime_error &); + TS_ASSERT_THROWS(rhs1 - rhs2, const std::runtime_error &); + TS_ASSERT_THROWS(rhs1 += rhs2, const std::runtime_error &); + TS_ASSERT_THROWS(rhs1 -= rhs2, const std::runtime_error &); } void test_with_FixedLengthVector() { diff --git a/Framework/HistogramData/test/CountStandardDeviationsTest.h b/Framework/HistogramData/test/CountStandardDeviationsTest.h index 7963837e849..eb7f17978ab 100644 --- a/Framework/HistogramData/test/CountStandardDeviationsTest.h +++ b/Framework/HistogramData/test/CountStandardDeviationsTest.h @@ -57,28 +57,28 @@ public: const FrequencyStandardDeviations frequencies(0); const BinEdges edges{}; TS_ASSERT_THROWS(const CountStandardDeviations counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_empty_FrequencyStandardDeviations_size_mismatch() { const FrequencyStandardDeviations frequencies(0); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const CountStandardDeviations counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_FrequencyStandardDeviations_null_BinEdges() { const FrequencyStandardDeviations frequencies(1); const BinEdges edges{}; TS_ASSERT_THROWS(const CountStandardDeviations counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_FrequencyStandardDeviations_size_mismatch() { const FrequencyStandardDeviations frequencies(2); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const CountStandardDeviations counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_FrequencyStandardDeviations() { diff --git a/Framework/HistogramData/test/CountVariancesTest.h b/Framework/HistogramData/test/CountVariancesTest.h index 7b87f37142d..e50be62dd97 100644 --- a/Framework/HistogramData/test/CountVariancesTest.h +++ b/Framework/HistogramData/test/CountVariancesTest.h @@ -64,28 +64,28 @@ public: const FrequencyVariances frequencies(0); const BinEdges edges{}; TS_ASSERT_THROWS(const CountVariances counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_empty_FrequencyVariances_size_mismatch() { const FrequencyVariances frequencies(0); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const CountVariances counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_FrequencyVariances_null_BinEdges() { const FrequencyVariances frequencies(1); const BinEdges edges{}; TS_ASSERT_THROWS(const CountVariances counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_FrequencyVariances_size_mismatch() { const FrequencyVariances frequencies(2); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const CountVariances counts(frequencies, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_FrequencyVariances() { diff --git a/Framework/HistogramData/test/CountsTest.h b/Framework/HistogramData/test/CountsTest.h index 84df2b18741..c4b950c9253 100644 --- a/Framework/HistogramData/test/CountsTest.h +++ b/Framework/HistogramData/test/CountsTest.h @@ -59,25 +59,29 @@ public: void test_construct_from_empty_Frequencies_null_BinEdges() { const Frequencies frequencies(0); const BinEdges edges{}; - TS_ASSERT_THROWS(const Counts counts(frequencies, edges), std::logic_error); + TS_ASSERT_THROWS(const Counts counts(frequencies, edges), + const std::logic_error &); } void test_construct_from_empty_Frequencies_size_mismatch() { const Frequencies frequencies(0); const BinEdges edges{1.0, 2.0}; - TS_ASSERT_THROWS(const Counts counts(frequencies, edges), std::logic_error); + TS_ASSERT_THROWS(const Counts counts(frequencies, edges), + const std::logic_error &); } void test_construct_from_Frequencies_null_BinEdges() { const Frequencies frequencies(1); const BinEdges edges{}; - TS_ASSERT_THROWS(const Counts counts(frequencies, edges), std::logic_error); + TS_ASSERT_THROWS(const Counts counts(frequencies, edges), + const std::logic_error &); } void test_construct_from_Frequencies_size_mismatch() { const Frequencies frequencies(2); const BinEdges edges{1.0, 2.0}; - TS_ASSERT_THROWS(const Counts counts(frequencies, edges), std::logic_error); + TS_ASSERT_THROWS(const Counts counts(frequencies, edges), + const std::logic_error &); } void test_construct_from_Frequencies() { diff --git a/Framework/HistogramData/test/EstimatePolynomialTest.h b/Framework/HistogramData/test/EstimatePolynomialTest.h index b221cfca3e7..727e7c1ad62 100644 --- a/Framework/HistogramData/test/EstimatePolynomialTest.h +++ b/Framework/HistogramData/test/EstimatePolynomialTest.h @@ -39,13 +39,13 @@ public: // bad order TS_ASSERT_THROWS(Mantid::HistogramData::estimatePolynomial( 3, histo, 0, histo.size(), bg0, bg1, bg2, chisq), - std::runtime_error); + const std::runtime_error &); // bad range i_max < i_min TS_ASSERT_THROWS(estimatePolynomial(2, histo, 1, 0, bg0, bg1, bg2, chisq), - std::runtime_error); + const std::runtime_error &); // bad range x.size() < i_max TS_ASSERT_THROWS(estimatePolynomial(2, histo, 0, 30, bg0, bg1, bg2, chisq), - std::runtime_error); + const std::runtime_error &); } void test_FlatData() { diff --git a/Framework/HistogramData/test/FixedLengthVectorTest.h b/Framework/HistogramData/test/FixedLengthVectorTest.h index 85d801a2d1b..a97f709a66a 100644 --- a/Framework/HistogramData/test/FixedLengthVectorTest.h +++ b/Framework/HistogramData/test/FixedLengthVectorTest.h @@ -137,7 +137,8 @@ public: std::vector<double> src(10, 0); FixedLengthVectorTester dest(5); - TS_ASSERT_THROWS(dest.assign(src.cbegin(), src.cend()), std::logic_error); + TS_ASSERT_THROWS(dest.assign(src.cbegin(), src.cend()), + const std::logic_error &); } void test_length_value_assignment() { @@ -155,7 +156,7 @@ public: void test_value_assignment_fail() { FixedLengthVectorTester dest(3); - TS_ASSERT_THROWS(dest.assign(20, 4.5), std::logic_error); + TS_ASSERT_THROWS(dest.assign(20, 4.5), const std::logic_error &); } void test_copy_assignment() { @@ -170,7 +171,7 @@ public: void test_copy_assignment_fail() { const FixedLengthVectorTester src(2, 0.1); FixedLengthVectorTester dest(1); - TS_ASSERT_THROWS(dest = src, std::logic_error); + TS_ASSERT_THROWS(dest = src, const std::logic_error &); } void test_move_assignment() { @@ -185,7 +186,7 @@ public: void test_move_assignment_fail() { FixedLengthVectorTester src(2, 0.1); FixedLengthVectorTester dest(1); - TS_ASSERT_THROWS(dest = std::move(src), std::logic_error); + TS_ASSERT_THROWS(dest = std::move(src), const std::logic_error &); } void test_initializer_list_assignment() { @@ -206,7 +207,7 @@ public: void test_initializer_list_assignment_fail() { FixedLengthVectorTester values(2); - TS_ASSERT_THROWS((values = {0.1, 0.2, 0.3}), std::logic_error); + TS_ASSERT_THROWS((values = {0.1, 0.2, 0.3}), const std::logic_error &); } void test_vector_constructor() { diff --git a/Framework/HistogramData/test/FrequenciesTest.h b/Framework/HistogramData/test/FrequenciesTest.h index 562eeb44ac0..15814270ae0 100644 --- a/Framework/HistogramData/test/FrequenciesTest.h +++ b/Framework/HistogramData/test/FrequenciesTest.h @@ -60,28 +60,28 @@ public: const Counts counts(0); const BinEdges edges{}; TS_ASSERT_THROWS(const Frequencies frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_empty_Counts_size_mismatch() { const Counts counts(0); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const Frequencies frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_Counts_null_BinEdges() { const Counts counts(1); const BinEdges edges{}; TS_ASSERT_THROWS(const Frequencies frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_Counts_size_mismatch() { const Counts counts(2); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const Frequencies frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_Counts() { diff --git a/Framework/HistogramData/test/FrequencyStandardDeviationsTest.h b/Framework/HistogramData/test/FrequencyStandardDeviationsTest.h index 09282c5914c..9e6c7acbdf9 100644 --- a/Framework/HistogramData/test/FrequencyStandardDeviationsTest.h +++ b/Framework/HistogramData/test/FrequencyStandardDeviationsTest.h @@ -61,7 +61,7 @@ public: const BinEdges edges{}; TS_ASSERT_THROWS( const FrequencyStandardDeviations frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_empty_CountStandardDeviations_size_mismatch() { @@ -69,7 +69,7 @@ public: const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS( const FrequencyStandardDeviations frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_CountStandardDeviations_null_BinEdges() { @@ -77,7 +77,7 @@ public: const BinEdges edges{}; TS_ASSERT_THROWS( const FrequencyStandardDeviations frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_CountStandardDeviations_size_mismatch() { @@ -85,7 +85,7 @@ public: const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS( const FrequencyStandardDeviations frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_CountStandardDeviations() { diff --git a/Framework/HistogramData/test/FrequencyVariancesTest.h b/Framework/HistogramData/test/FrequencyVariancesTest.h index 0ebf36a2183..affb6084489 100644 --- a/Framework/HistogramData/test/FrequencyVariancesTest.h +++ b/Framework/HistogramData/test/FrequencyVariancesTest.h @@ -67,28 +67,28 @@ public: const CountVariances counts(0); const BinEdges edges{}; TS_ASSERT_THROWS(const FrequencyVariances frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_empty_CountVariances_size_mismatch() { const CountVariances counts(0); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const FrequencyVariances frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_CountVariances_null_BinEdges() { const CountVariances counts(1); const BinEdges edges{}; TS_ASSERT_THROWS(const FrequencyVariances frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_CountVariances_size_mismatch() { const CountVariances counts(2); const BinEdges edges{1.0, 2.0}; TS_ASSERT_THROWS(const FrequencyVariances frequencies(counts, edges), - std::logic_error); + const std::logic_error &); } void test_construct_from_CountVariances() { diff --git a/Framework/HistogramData/test/HistogramBuilderTest.h b/Framework/HistogramData/test/HistogramBuilderTest.h index 1958ea7ffe5..12c5fb9cc14 100644 --- a/Framework/HistogramData/test/HistogramBuilderTest.h +++ b/Framework/HistogramData/test/HistogramBuilderTest.h @@ -42,11 +42,11 @@ public: HistogramBuilder builder; builder.setX(5); builder.setY(3); - TS_ASSERT_THROWS(builder.build(), std::logic_error); + TS_ASSERT_THROWS(builder.build(), const std::logic_error &); builder.setY(6); - TS_ASSERT_THROWS(builder.build(), std::logic_error); + TS_ASSERT_THROWS(builder.build(), const std::logic_error &); builder.setDx(3); - TS_ASSERT_THROWS(builder.build(), std::logic_error); + TS_ASSERT_THROWS(builder.build(), const std::logic_error &); } void test_build_from_size() { diff --git a/Framework/HistogramData/test/HistogramMathTest.h b/Framework/HistogramData/test/HistogramMathTest.h index 3e6acad91aa..dc78cc219f0 100644 --- a/Framework/HistogramData/test/HistogramMathTest.h +++ b/Framework/HistogramData/test/HistogramMathTest.h @@ -84,13 +84,13 @@ public: void test_bad_factors() { Histogram hist(BinEdges{1, 2, 3}, Counts{4, 9}); - TS_ASSERT_THROWS(hist *= (-1.0), std::runtime_error); - TS_ASSERT_THROWS(hist * (-1.0), std::runtime_error); - TS_ASSERT_THROWS((-1.0) * hist, std::runtime_error); - TS_ASSERT_THROWS(hist /= (-1.0), std::runtime_error); - TS_ASSERT_THROWS(hist / (-1.0), std::runtime_error); - TS_ASSERT_THROWS(hist /= 0.0, std::runtime_error); - TS_ASSERT_THROWS(hist / 0.0, std::runtime_error); + TS_ASSERT_THROWS(hist *= (-1.0), const std::runtime_error &); + TS_ASSERT_THROWS(hist * (-1.0), const std::runtime_error &); + TS_ASSERT_THROWS((-1.0) * hist, const std::runtime_error &); + TS_ASSERT_THROWS(hist /= (-1.0), const std::runtime_error &); + TS_ASSERT_THROWS(hist / (-1.0), const std::runtime_error &); + TS_ASSERT_THROWS(hist /= 0.0, const std::runtime_error &); + TS_ASSERT_THROWS(hist / 0.0, const std::runtime_error &); } void test_plus_histogram() { @@ -119,25 +119,25 @@ public: void test_plus_histogram_fail_xMode() { const Histogram hist1(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram hist2(Points{1, 2, 3}, Counts{1, 2, 3}); - TS_ASSERT_THROWS(hist1 + hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 + hist2, const std::runtime_error &); } void test_plus_histogram_fail_yMode() { const Histogram hist1(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram hist2(BinEdges{1, 2, 3}, Frequencies{4, 9}); - TS_ASSERT_THROWS(hist1 + hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 + hist2, const std::runtime_error &); } void test_plus_histogram_fail_x_length_mismatch() { const Histogram hist1(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram hist2(BinEdges{1, 2}, Counts{1}); - TS_ASSERT_THROWS(hist1 + hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 + hist2, const std::runtime_error &); } void test_plus_histogram_fail_x_value_mismatch() { const Histogram hist1(BinEdges{1, 2.0, 3}, Counts{4, 9}); const Histogram hist2(BinEdges{1, 2.1, 3}, Counts{1, 2}); - TS_ASSERT_THROWS(hist1 + hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 + hist2, const std::runtime_error &); } void test_minus_histogram() { @@ -168,25 +168,25 @@ public: void test_minus_histogram_fail_xMode() { const Histogram hist1(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram hist2(Points{1, 2, 3}, Counts{1, 2, 3}); - TS_ASSERT_THROWS(hist1 - hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 - hist2, const std::runtime_error &); } void test_minus_histogram_fail_yMode() { const Histogram hist1(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram hist2(BinEdges{1, 2, 3}, Frequencies{4, 9}); - TS_ASSERT_THROWS(hist1 - hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 - hist2, const std::runtime_error &); } void test_minus_histogram_fail_x_length_mismatch() { const Histogram hist1(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram hist2(BinEdges{1, 2}, Counts{1}); - TS_ASSERT_THROWS(hist1 - hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 - hist2, const std::runtime_error &); } void test_minus_histogram_fail_x_value_mismatch() { const Histogram hist1(BinEdges{1, 2.0, 3}, Counts{4, 9}); const Histogram hist2(BinEdges{1, 2.1, 3}, Counts{1, 2}); - TS_ASSERT_THROWS(hist1 - hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 - hist2, const std::runtime_error &); } void test_times_histogram() { @@ -233,13 +233,13 @@ public: void test_times_histogram_fail_xMode() { const Histogram hist1(BinEdges{1, 2, 3}, Frequencies{4, 9}); const Histogram hist2(Points{1, 2, 3}, Frequencies{1, 2, 3}); - TS_ASSERT_THROWS(hist1 * hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 * hist2, const std::runtime_error &); } void test_times_histogram_fail_yMode() { const Histogram histC(BinEdges{1, 2, 3}, Counts{4, 9}); const Histogram histF(BinEdges{1, 2, 3}, Frequencies{4, 9}); - TS_ASSERT_THROWS(histC * histC, std::runtime_error); + TS_ASSERT_THROWS(histC * histC, const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(histC * histF); TS_ASSERT_THROWS_NOTHING(histF * histC); TS_ASSERT_THROWS_NOTHING(histF * histF); @@ -248,13 +248,13 @@ public: void test_times_histogram_fail_x_length_mismatch() { const Histogram hist1(BinEdges{1, 2, 3}, Frequencies{4, 9}); const Histogram hist2(BinEdges{1, 2}, Frequencies{1}); - TS_ASSERT_THROWS(hist1 * hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 * hist2, const std::runtime_error &); } void test_times_histogram_fail_x_value_mismatch() { const Histogram hist1(BinEdges{1, 2.0, 3}, Frequencies{4, 9}); const Histogram hist2(BinEdges{1, 2.1, 3}, Frequencies{1, 2}); - TS_ASSERT_THROWS(hist1 * hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 * hist2, const std::runtime_error &); } void test_divide_histogram() { @@ -303,7 +303,7 @@ public: void test_divide_histogram_fail_xMode() { const Histogram hist1(BinEdges{1, 2, 3}, Frequencies{4, 9}); const Histogram hist2(Points{1, 2, 3}, Frequencies{1, 2, 3}); - TS_ASSERT_THROWS(hist1 / hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 / hist2, const std::runtime_error &); } void test_divide_histogram_fail_yMode() { @@ -311,20 +311,20 @@ public: const Histogram histF(BinEdges{1, 2, 3}, Frequencies{4, 9}); TS_ASSERT_THROWS_NOTHING(histC / histC); TS_ASSERT_THROWS_NOTHING(histC / histF); - TS_ASSERT_THROWS(histF / histC, std::runtime_error); + TS_ASSERT_THROWS(histF / histC, const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(histF / histF); } void test_divide_histogram_fail_x_length_mismatch() { const Histogram hist1(BinEdges{1, 2, 3}, Frequencies{4, 9}); const Histogram hist2(BinEdges{1, 2}, Frequencies{1}); - TS_ASSERT_THROWS(hist1 / hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 / hist2, const std::runtime_error &); } void test_divide_histogram_fail_x_value_mismatch() { const Histogram hist1(BinEdges{1, 2.0, 3}, Frequencies{4, 9}); const Histogram hist2(BinEdges{1, 2.1, 3}, Frequencies{1, 2}); - TS_ASSERT_THROWS(hist1 / hist2, std::runtime_error); + TS_ASSERT_THROWS(hist1 / hist2, const std::runtime_error &); } }; diff --git a/Framework/HistogramData/test/HistogramTest.h b/Framework/HistogramData/test/HistogramTest.h index 90323dd1aa8..248b52aacbb 100644 --- a/Framework/HistogramData/test/HistogramTest.h +++ b/Framework/HistogramData/test/HistogramTest.h @@ -14,20 +14,20 @@ #include "MantidHistogramData/LinearGenerator.h" using Mantid::HistogramData::BinEdges; +using Mantid::HistogramData::Counts; using Mantid::HistogramData::CountStandardDeviations; using Mantid::HistogramData::CountVariances; -using Mantid::HistogramData::Counts; using Mantid::HistogramData::Frequencies; using Mantid::HistogramData::FrequencyStandardDeviations; using Mantid::HistogramData::FrequencyVariances; +using Mantid::HistogramData::getHistogramXMode; using Mantid::HistogramData::Histogram; using Mantid::HistogramData::HistogramE; using Mantid::HistogramData::HistogramX; using Mantid::HistogramData::HistogramY; using Mantid::HistogramData::LinearGenerator; -using Mantid::HistogramData::PointStandardDeviations; using Mantid::HistogramData::Points; -using Mantid::HistogramData::getHistogramXMode; +using Mantid::HistogramData::PointStandardDeviations; class HistogramTest : public CxxTest::TestSuite { public: @@ -68,7 +68,7 @@ public: void test_construct_from_invalid_BinEdges() { BinEdges binEdges(1); - TS_ASSERT_THROWS(Histogram{binEdges}, std::logic_error); + TS_ASSERT_THROWS(Histogram{binEdges}, const std::logic_error &); } void test_construct_Points_Counts() { @@ -87,25 +87,26 @@ public: } void test_construct_values_size_mismatch() { - TS_ASSERT_THROWS(Histogram(Points(1), Counts(2)), std::logic_error); + TS_ASSERT_THROWS(Histogram(Points(1), Counts(2)), const std::logic_error &); TS_ASSERT_THROWS(Histogram(BinEdges{1.0, 2.0}, Counts(2)), - std::logic_error); - TS_ASSERT_THROWS(Histogram(Points(1), Frequencies(2)), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(Histogram(Points(1), Frequencies(2)), + const std::logic_error &); TS_ASSERT_THROWS(Histogram(BinEdges{1.0, 2.0}, Frequencies(2)), - std::logic_error); + const std::logic_error &); } void test_construct_values_uncertainties_size_mismatch() { TS_ASSERT_THROWS(Histogram(Points{1.0, 2.0}, Counts(2), CountVariances(1)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS( Histogram(Points{1.0, 2.0}, Frequencies(2), FrequencyVariances(1)), - std::logic_error); + const std::logic_error &); } void test_construct_null_values_but_uncertainties_fail() { TS_ASSERT_THROWS(Histogram(Points{1.0, 2.0}, Counts(), CountVariances(2)), - std::logic_error); + const std::logic_error &); } void test_construct_Counts_automatic_errors() { @@ -212,9 +213,9 @@ public: TS_ASSERT_EQUALS(getHistogramXMode(1, 1), Histogram::XMode::Points); TS_ASSERT_EQUALS(getHistogramXMode(1, 0), Histogram::XMode::BinEdges); TS_ASSERT_EQUALS(getHistogramXMode(2, 1), Histogram::XMode::BinEdges); - TS_ASSERT_THROWS(getHistogramXMode(2, 0), std::logic_error); - TS_ASSERT_THROWS(getHistogramXMode(3, 1), std::logic_error); - TS_ASSERT_THROWS(getHistogramXMode(0, 1), std::logic_error); + TS_ASSERT_THROWS(getHistogramXMode(2, 0), const std::logic_error &); + TS_ASSERT_THROWS(getHistogramXMode(3, 1), const std::logic_error &); + TS_ASSERT_THROWS(getHistogramXMode(0, 1), const std::logic_error &); } void test_assignment() { @@ -357,33 +358,40 @@ public: void test_setPoints_size_mismatch() { Histogram h1(Points{1.0, 2.0}); - TS_ASSERT_THROWS(h1.setPoints(std::vector<double>(1)), std::logic_error); + TS_ASSERT_THROWS(h1.setPoints(std::vector<double>(1)), + const std::logic_error &); TS_ASSERT_THROWS(h1.setPoints(std::vector<double>{1.0, 2.0, 3.0}), - std::logic_error); - TS_ASSERT_THROWS(h1.setPoints(Points(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setPoints(Points{1.0, 2.0, 3.0}), std::logic_error); - TS_ASSERT_THROWS(h1.setPoints(BinEdges{1.0, 2.0}), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h1.setPoints(Points(1)), const std::logic_error &); + TS_ASSERT_THROWS(h1.setPoints(Points{1.0, 2.0, 3.0}), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setPoints(BinEdges{1.0, 2.0}), + const std::logic_error &); TS_ASSERT_THROWS(h1.setPoints(BinEdges{1.0, 2.0, 3.0, 4.0}), - std::logic_error); + const std::logic_error &); Histogram h2(BinEdges{1.0, 2.0}); - TS_ASSERT_THROWS(h2.setPoints(std::vector<double>(0)), std::logic_error); + TS_ASSERT_THROWS(h2.setPoints(std::vector<double>(0)), + const std::logic_error &); TS_ASSERT_THROWS(h2.setPoints(std::vector<double>{1.0, 2.0}), - std::logic_error); - TS_ASSERT_THROWS(h2.setPoints(Points(0)), std::logic_error); - TS_ASSERT_THROWS(h2.setPoints(Points{1.0, 2.0}), std::logic_error); - TS_ASSERT_THROWS(h2.setPoints(BinEdges(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setPoints(BinEdges{1.0, 2.0, 3.0}), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h2.setPoints(Points(0)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setPoints(Points{1.0, 2.0}), const std::logic_error &); + TS_ASSERT_THROWS(h2.setPoints(BinEdges(1)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setPoints(BinEdges{1.0, 2.0, 3.0}), + const std::logic_error &); } void test_setPoints_size_mismatch_degenerate() { Histogram h1(Points(0)); - TS_ASSERT_THROWS(h1.setPoints(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setPoints(Points(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setPoints(BinEdges(1)), std::logic_error); + TS_ASSERT_THROWS(h1.setPoints(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setPoints(Points(1)), const std::logic_error &); + TS_ASSERT_THROWS(h1.setPoints(BinEdges(1)), const std::logic_error &); Histogram h2(BinEdges(0)); - TS_ASSERT_THROWS(h2.setPoints(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setPoints(Points(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setPoints(BinEdges(1)), std::logic_error); + TS_ASSERT_THROWS(h2.setPoints(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setPoints(Points(1)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setPoints(BinEdges(1)), const std::logic_error &); } void test_setPoints_self_assignment() { @@ -407,7 +415,7 @@ public: auto &x = h.x(); // This test makes sure that size mismatch takes precedence over the // self-assignment check. x is bin edges, setting it as points should fail. - TS_ASSERT_THROWS(h.setPoints(x), std::logic_error); + TS_ASSERT_THROWS(h.setPoints(x), const std::logic_error &); } void test_setPoints_keepsDxStorageMode() { @@ -509,33 +517,40 @@ public: void test_setBinEdges_size_mismatch() { Histogram h1(Points{1.0, 2.0}); TS_ASSERT_THROWS(h1.setBinEdges(std::vector<double>{1.0, 2.0}), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS(h1.setBinEdges(std::vector<double>{1.0, 2.0, 3.0, 4.0}), - std::logic_error); - TS_ASSERT_THROWS(h1.setBinEdges(Points(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setBinEdges(Points{1.0, 2.0, 3.0}), std::logic_error); - TS_ASSERT_THROWS(h1.setBinEdges(BinEdges{1.0, 2.0}), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h1.setBinEdges(Points(1)), const std::logic_error &); + TS_ASSERT_THROWS(h1.setBinEdges(Points{1.0, 2.0, 3.0}), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setBinEdges(BinEdges{1.0, 2.0}), + const std::logic_error &); TS_ASSERT_THROWS(h1.setBinEdges(BinEdges{1.0, 2.0, 3.0, 4.0}), - std::logic_error); + const std::logic_error &); Histogram h2(BinEdges{1.0, 2.0}); - TS_ASSERT_THROWS(h2.setBinEdges(std::vector<double>(1)), std::logic_error); + TS_ASSERT_THROWS(h2.setBinEdges(std::vector<double>(1)), + const std::logic_error &); TS_ASSERT_THROWS(h2.setBinEdges(std::vector<double>{1.0, 2.0, 3.0}), - std::logic_error); - TS_ASSERT_THROWS(h2.setBinEdges(Points(0)), std::logic_error); - TS_ASSERT_THROWS(h2.setBinEdges(Points{1.0, 2.0}), std::logic_error); - TS_ASSERT_THROWS(h2.setBinEdges(BinEdges(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setBinEdges(BinEdges{1.0, 2.0, 3.0}), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h2.setBinEdges(Points(0)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setBinEdges(Points{1.0, 2.0}), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setBinEdges(BinEdges(1)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setBinEdges(BinEdges{1.0, 2.0, 3.0}), + const std::logic_error &); } void test_setBinEdges_size_mismatch_degenerate() { Histogram h1(Points(0)); - TS_ASSERT_THROWS(h1.setBinEdges(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setBinEdges(Points(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setBinEdges(BinEdges(1)), std::logic_error); + TS_ASSERT_THROWS(h1.setBinEdges(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setBinEdges(Points(1)), const std::logic_error &); + TS_ASSERT_THROWS(h1.setBinEdges(BinEdges(1)), const std::logic_error &); Histogram h2(BinEdges(0)); - TS_ASSERT_THROWS(h2.setBinEdges(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setBinEdges(Points(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setBinEdges(BinEdges(1)), std::logic_error); + TS_ASSERT_THROWS(h2.setBinEdges(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setBinEdges(Points(1)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setBinEdges(BinEdges(1)), const std::logic_error &); } void test_setBinEdges_self_assignment() { @@ -559,7 +574,7 @@ public: auto &x = h.x(); // This test makes sure that size mismatch takes precedence over the // self-assignment check. x is points, setting it as bin edges should fail. - TS_ASSERT_THROWS(h.setBinEdges(x), std::logic_error); + TS_ASSERT_THROWS(h.setBinEdges(x), const std::logic_error &); } void test_setBinEdges_keepsDxStorageMode() { @@ -574,24 +589,30 @@ public: void test_setCounts_size_mismatch() { Histogram h1(Points{1.0, 2.0}); - TS_ASSERT_THROWS(h1.setCounts(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setCounts(std::vector<double>(3)), std::logic_error); - TS_ASSERT_THROWS(h1.setCounts(Counts(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setCounts(Counts(3)), std::logic_error); + TS_ASSERT_THROWS(h1.setCounts(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setCounts(std::vector<double>(3)), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setCounts(Counts(1)), const std::logic_error &); + TS_ASSERT_THROWS(h1.setCounts(Counts(3)), const std::logic_error &); Histogram h2(BinEdges{1.0, 2.0}); - TS_ASSERT_THROWS(h2.setCounts(std::vector<double>(0)), std::logic_error); - TS_ASSERT_THROWS(h2.setCounts(std::vector<double>(2)), std::logic_error); - TS_ASSERT_THROWS(h2.setCounts(Counts(0)), std::logic_error); - TS_ASSERT_THROWS(h2.setCounts(Counts(2)), std::logic_error); + TS_ASSERT_THROWS(h2.setCounts(std::vector<double>(0)), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setCounts(std::vector<double>(2)), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setCounts(Counts(0)), const std::logic_error &); + TS_ASSERT_THROWS(h2.setCounts(Counts(2)), const std::logic_error &); } void test_setCounts_size_mismatch_degenerate() { Histogram h1(Points(0)); - TS_ASSERT_THROWS(h1.setCounts(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setCounts(Counts(1)), std::logic_error); + TS_ASSERT_THROWS(h1.setCounts(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setCounts(Counts(1)), const std::logic_error &); Histogram h2(BinEdges(0)); - TS_ASSERT_THROWS(h2.setCounts(std::vector<double>(1)), std::logic_error); - TS_ASSERT_THROWS(h2.setCounts(Counts(1)), std::logic_error); + TS_ASSERT_THROWS(h2.setCounts(std::vector<double>(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setCounts(Counts(1)), const std::logic_error &); } void test_setCounts_self_assignment() { @@ -615,29 +636,35 @@ public: void test_setFrequencies_size_mismatch() { Histogram h1(Points{1.0, 2.0}); TS_ASSERT_THROWS(h1.setFrequencies(std::vector<double>(1)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS(h1.setFrequencies(std::vector<double>(3)), - std::logic_error); - TS_ASSERT_THROWS(h1.setFrequencies(Frequencies(1)), std::logic_error); - TS_ASSERT_THROWS(h1.setFrequencies(Frequencies(3)), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h1.setFrequencies(Frequencies(1)), + const std::logic_error &); + TS_ASSERT_THROWS(h1.setFrequencies(Frequencies(3)), + const std::logic_error &); Histogram h2(BinEdges{1.0, 2.0}); TS_ASSERT_THROWS(h2.setFrequencies(std::vector<double>(0)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS(h2.setFrequencies(std::vector<double>(2)), - std::logic_error); - TS_ASSERT_THROWS(h2.setFrequencies(Frequencies(0)), std::logic_error); - TS_ASSERT_THROWS(h2.setFrequencies(Frequencies(2)), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h2.setFrequencies(Frequencies(0)), + const std::logic_error &); + TS_ASSERT_THROWS(h2.setFrequencies(Frequencies(2)), + const std::logic_error &); } void test_setFrequencies_size_mismatch_degenerate() { Histogram h1(Points(0)); TS_ASSERT_THROWS(h1.setFrequencies(std::vector<double>(1)), - std::logic_error); - TS_ASSERT_THROWS(h1.setFrequencies(Frequencies(1)), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h1.setFrequencies(Frequencies(1)), + const std::logic_error &); Histogram h2(BinEdges(0)); TS_ASSERT_THROWS(h2.setFrequencies(std::vector<double>(1)), - std::logic_error); - TS_ASSERT_THROWS(h2.setFrequencies(Frequencies(1)), std::logic_error); + const std::logic_error &); + TS_ASSERT_THROWS(h2.setFrequencies(Frequencies(1)), + const std::logic_error &); } void test_setFrequencies_self_assignment() { @@ -703,26 +730,28 @@ public: void test_setCountVariances_size_mismatch() { Histogram h(Points{1.0, 2.0}); - TS_ASSERT_THROWS(h.setCountVariances(1), std::logic_error); - TS_ASSERT_THROWS(h.setCountVariances(3), std::logic_error); + TS_ASSERT_THROWS(h.setCountVariances(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setCountVariances(3), const std::logic_error &); } void test_setCountStandardDeviations_size_mismatch() { Histogram h(Points{1.0, 2.0}); - TS_ASSERT_THROWS(h.setCountStandardDeviations(1), std::logic_error); - TS_ASSERT_THROWS(h.setCountStandardDeviations(3), std::logic_error); + TS_ASSERT_THROWS(h.setCountStandardDeviations(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setCountStandardDeviations(3), const std::logic_error &); } void test_setFrequencyVariances_size_mismatch() { Histogram h(Points{1.0, 2.0}); - TS_ASSERT_THROWS(h.setFrequencyVariances(1), std::logic_error); - TS_ASSERT_THROWS(h.setFrequencyVariances(3), std::logic_error); + TS_ASSERT_THROWS(h.setFrequencyVariances(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setFrequencyVariances(3), const std::logic_error &); } void test_setFrequencyStandardDeviations_size_mismatch() { Histogram h(Points{1.0, 2.0}); - TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(1), std::logic_error); - TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(3), std::logic_error); + TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(1), + const std::logic_error &); + TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(3), + const std::logic_error &); } void test_error_setter_self_assignment() { @@ -732,9 +761,10 @@ public: auto old_address = &e; // e is always count standard deviations, self assignment as variances or // frequencies should fail unless we are setting count standard deviations. - TS_ASSERT_THROWS(h.setCountVariances(e), std::logic_error); - TS_ASSERT_THROWS(h.setFrequencyVariances(e), std::logic_error); - TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(e), std::logic_error); + TS_ASSERT_THROWS(h.setCountVariances(e), const std::logic_error &); + TS_ASSERT_THROWS(h.setFrequencyVariances(e), const std::logic_error &); + TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(e), + const std::logic_error &); TS_ASSERT_THROWS_NOTHING(h.setCountStandardDeviations(e)); TS_ASSERT_EQUALS(&h.e(), old_address); } @@ -798,14 +828,15 @@ public: auto tmp = {1.0, 2.0}; auto data2 = Mantid::Kernel::make_cow<HistogramX>(tmp); Histogram hist{BinEdges(data1)}; - TS_ASSERT_THROWS(hist.setSharedX(data2), std::logic_error); + TS_ASSERT_THROWS(hist.setSharedX(data2), const std::logic_error &); } void test_setSharedX_catches_misuse() { BinEdges edges{1.0, 2.0}; Histogram hist(edges); auto points = hist.points(); - TS_ASSERT_THROWS(hist.setSharedX(points.cowData()), std::logic_error); + TS_ASSERT_THROWS(hist.setSharedX(points.cowData()), + const std::logic_error &); } void test_y() { @@ -868,7 +899,7 @@ public: auto data2 = Mantid::Kernel::make_cow<HistogramY>(2); Histogram hist{BinEdges(0)}; hist.setCounts(data1); - TS_ASSERT_THROWS(hist.setSharedY(data2), std::logic_error); + TS_ASSERT_THROWS(hist.setSharedY(data2), const std::logic_error &); } void test_e() { @@ -931,7 +962,7 @@ public: auto data2 = Mantid::Kernel::make_cow<HistogramE>(2); Histogram hist{BinEdges(0)}; hist.setCountStandardDeviations(data1); - TS_ASSERT_THROWS(hist.setSharedE(data2), std::logic_error); + TS_ASSERT_THROWS(hist.setSharedE(data2), const std::logic_error &); } void test_setPointStandardDeviations_point_data() { @@ -947,13 +978,13 @@ public: Histogram hist(Points(2)); TS_ASSERT_THROWS( hist.setPointStandardDeviations(PointStandardDeviations(0)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS( hist.setPointStandardDeviations(PointStandardDeviations(1)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS( hist.setPointStandardDeviations(PointStandardDeviations(3)), - std::logic_error); + const std::logic_error &); } void test_setPointStandardDeviations_histogram_data() { @@ -969,13 +1000,13 @@ public: Histogram hist(BinEdges(3)); TS_ASSERT_THROWS( hist.setPointStandardDeviations(PointStandardDeviations(0)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS( hist.setPointStandardDeviations(PointStandardDeviations(1)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS( hist.setPointStandardDeviations(PointStandardDeviations(3)), - std::logic_error); + const std::logic_error &); } void test_setPointStandardDeviations_can_set_null() { @@ -1045,22 +1076,24 @@ public: void test_yMode_cannot_be_changed_by_Count_setters() { Histogram h(Points(1), Counts(1)); - TS_ASSERT_THROWS(h.setFrequencies(1), std::logic_error); - TS_ASSERT_THROWS(h.setFrequencyVariances(1), std::logic_error); - TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(1), std::logic_error); + TS_ASSERT_THROWS(h.setFrequencies(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setFrequencyVariances(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setFrequencyStandardDeviations(1), + const std::logic_error &); } void test_yMode_cannot_be_changed_by_Frequency_setters() { Histogram h(Points(1), Frequencies(1)); - TS_ASSERT_THROWS(h.setCounts(1), std::logic_error); - TS_ASSERT_THROWS(h.setCountVariances(1), std::logic_error); - TS_ASSERT_THROWS(h.setCountStandardDeviations(1), std::logic_error); + TS_ASSERT_THROWS(h.setCounts(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setCountVariances(1), const std::logic_error &); + TS_ASSERT_THROWS(h.setCountStandardDeviations(1), const std::logic_error &); } void test_setSharedY_fails_for_YMode_Uninitialized() { Histogram hist(Points(1)); Counts counts(1); - TS_ASSERT_THROWS(hist.setSharedY(counts.cowData()), std::logic_error); + TS_ASSERT_THROWS(hist.setSharedY(counts.cowData()), + const std::logic_error &); } void test_that_can_change_histogram_size_for_points_with_dx() { diff --git a/Framework/HistogramData/test/InterpolateTest.h b/Framework/HistogramData/test/InterpolateTest.h index f158d7845e4..39011654638 100644 --- a/Framework/HistogramData/test/InterpolateTest.h +++ b/Framework/HistogramData/test/InterpolateTest.h @@ -258,33 +258,33 @@ public: void test_interpolatelinear_throws_for_undefined_ymode_type() { TS_ASSERT_THROWS( interpolateLinear(Histogram(Points(10, LinearGenerator(0, 0.5))), 10), - std::runtime_error); + const std::runtime_error &); } void test_interpolatelinear_throws_if_number_points_less_than_3() { TS_ASSERT_THROWS( interpolateLinear(Histogram(Points(2, LinearGenerator(0, 0.5))), 1), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( interpolateLinear(Histogram(Points(2, LinearGenerator(0, 0.5))), 1), - std::runtime_error); + const std::runtime_error &); } void test_interpolatelinearinplace_throws_if_input_has_less_than_2_points() { Histogram input(Points(1, LinearGenerator(0.1, 0.1))); Histogram output(Points(1, LinearGenerator(0.1, 0.1))); TS_ASSERT_THROWS(interpolateLinearInplace(input, output), - std::runtime_error) + const std::runtime_error &) } void test_interpolatelinear_throws_if_stepsize_greater_or_equal_number_points() { TS_ASSERT_THROWS( interpolateLinear(Histogram(Points(6, LinearGenerator(0, 0.5))), 6), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( interpolateLinear(Histogram(Points(6, LinearGenerator(0, 0.5))), 7), - std::runtime_error); + const std::runtime_error &); } // --------------------------------------------------------------------------- @@ -293,33 +293,33 @@ public: void test_interpolatecspline_throws_for_undefined_ymode_type() { TS_ASSERT_THROWS( interpolateCSpline(Histogram(Points(10, LinearGenerator(0, 0.5))), 10), - std::runtime_error); + const std::runtime_error &); } void test_interpolatecspline_throws_if_less_than_4_calculated_points() { TS_ASSERT_THROWS( interpolateCSpline(Histogram(Points(2, LinearGenerator(0, 0.5))), 1), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( interpolateCSpline(Histogram(Points(3, LinearGenerator(0, 0.5))), 1), - std::runtime_error); + const std::runtime_error &); } void test_interpolatecsplineinplace_throws_if_input_has_less_than_3_points() { Histogram input(Points(2, LinearGenerator(0, 1.0))); Histogram output(Points(5, LinearGenerator(0.1, 0.1))); TS_ASSERT_THROWS(interpolateCSplineInplace(input, output), - std::runtime_error) + const std::runtime_error &) } void test_interpolatecspline_throws_if_stepsize_greater_or_equal_number_points() { TS_ASSERT_THROWS( interpolateCSpline(Histogram(Points(6, LinearGenerator(0, 0.5))), 6), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS( interpolateCSpline(Histogram(Points(6, LinearGenerator(0, 0.5))), 7), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/HistogramData/test/MultipliableTest.h b/Framework/HistogramData/test/MultipliableTest.h index af1c6335f58..877d4da6d2e 100644 --- a/Framework/HistogramData/test/MultipliableTest.h +++ b/Framework/HistogramData/test/MultipliableTest.h @@ -79,10 +79,10 @@ public: void test_length_mismatch() { MultipliableTester rhs1{1, 2}; const MultipliableTester rhs2{1, 2, 3}; - TS_ASSERT_THROWS(rhs1 * rhs2, std::runtime_error); - TS_ASSERT_THROWS(rhs1 / rhs2, std::runtime_error); - TS_ASSERT_THROWS(rhs1 *= rhs2, std::runtime_error); - TS_ASSERT_THROWS(rhs1 /= rhs2, std::runtime_error); + TS_ASSERT_THROWS(rhs1 * rhs2, const std::runtime_error &); + TS_ASSERT_THROWS(rhs1 / rhs2, const std::runtime_error &); + TS_ASSERT_THROWS(rhs1 *= rhs2, const std::runtime_error &); + TS_ASSERT_THROWS(rhs1 /= rhs2, const std::runtime_error &); } void test_with_FixedLengthVector() { diff --git a/Framework/HistogramData/test/PointsTest.h b/Framework/HistogramData/test/PointsTest.h index 433462dca33..f2581c52dca 100644 --- a/Framework/HistogramData/test/PointsTest.h +++ b/Framework/HistogramData/test/PointsTest.h @@ -53,7 +53,7 @@ public: void test_construct_from_invalid_BinEdges() { const BinEdges edges(1); - TS_ASSERT_THROWS(Points points(edges), std::logic_error); + TS_ASSERT_THROWS(Points points(edges), const std::logic_error &); } void test_construct_from_BinEdges() { diff --git a/Framework/HistogramData/test/RebinTest.h b/Framework/HistogramData/test/RebinTest.h index 990f562e7fd..b13c3a342de 100644 --- a/Framework/HistogramData/test/RebinTest.h +++ b/Framework/HistogramData/test/RebinTest.h @@ -43,32 +43,35 @@ public: Counts counts{10, 1, 3, 4, 7}; // X Mode Points TS_ASSERT_THROWS(rebin(Histogram(points, counts), edges), - std::runtime_error); + const std::runtime_error &); // No YMode set TS_ASSERT_THROWS( rebin(Histogram(BinEdges(10, LinearGenerator(0, 0.5))), edges), - std::runtime_error); + const std::runtime_error &); } void testRebinFailsCentralBinEdgesInvalid() { std::vector<double> binEdges{1, 2, 3, 3, 5, 7}; BinEdges edges(binEdges); - TS_ASSERT_THROWS(rebin(getCountsHistogram(), edges), InvalidBinEdgesError); + TS_ASSERT_THROWS(rebin(getCountsHistogram(), edges), + const InvalidBinEdgesError &); } void testRebinFailsStartBinEdgesInvalid() { std::vector<double> binEdges{1, 1, 3, 4, 5, 7}; BinEdges edges(binEdges); - TS_ASSERT_THROWS(rebin(getCountsHistogram(), edges), InvalidBinEdgesError); + TS_ASSERT_THROWS(rebin(getCountsHistogram(), edges), + const InvalidBinEdgesError &); } void testRebinEndCentralBinEdgesInvalid() { std::vector<double> binEdges{1, 2, 3, 4, 5, 5}; BinEdges edges(binEdges); - TS_ASSERT_THROWS(rebin(getCountsHistogram(), edges), InvalidBinEdgesError); + TS_ASSERT_THROWS(rebin(getCountsHistogram(), edges), + const InvalidBinEdgesError &); } void testNegativeBinEdges() { @@ -85,7 +88,7 @@ public: Histogram hist(BinEdges(std::move(binEdges)), Counts(5, 10)); BinEdges edges{1, 2, 3, 4, 5, 6}; - TS_ASSERT_THROWS(rebin(hist, edges), InvalidBinEdgesError); + TS_ASSERT_THROWS(rebin(hist, edges), const InvalidBinEdgesError &); } void testRebinFailsInputAndOutputBinEdgesInvalid() { @@ -93,7 +96,7 @@ public: Histogram hist(BinEdges(binEdges), Counts(5, 10)); BinEdges edges(std::move(binEdges)); - TS_ASSERT_THROWS(rebin(hist, edges), InvalidBinEdgesError); + TS_ASSERT_THROWS(rebin(hist, edges), const InvalidBinEdgesError &); } void testRebinIdenticalBins() { diff --git a/Framework/ICat/test/CatalogLoginTest.h b/Framework/ICat/test/CatalogLoginTest.h index 580e9c7782f..ed9d73d3060 100644 --- a/Framework/ICat/test/CatalogLoginTest.h +++ b/Framework/ICat/test/CatalogLoginTest.h @@ -37,7 +37,7 @@ public: loginobj.initialize(); // Should fail because mandatory parameter has not been set - TS_ASSERT_THROWS(loginobj.execute(), std::runtime_error); + TS_ASSERT_THROWS(loginobj.execute(), const std::runtime_error &); } void testLogin() { diff --git a/Framework/ICat/test/CatalogSearchTest.h b/Framework/ICat/test/CatalogSearchTest.h index c2c5936b683..5e3c6f43fc4 100644 --- a/Framework/ICat/test/CatalogSearchTest.h +++ b/Framework/ICat/test/CatalogSearchTest.h @@ -127,13 +127,13 @@ public: ": Invalid Date:date format must be DD/MM/YYYY"; TS_ASSERT_THROWS(searchobj.setPropertyValue("StartDate", "sssss"), - std::invalid_argument(errorMsg)); + const std::invalid_argument &); errorMsg = "Invalid value for property EndDate (string) " "aaaaa" ": Invalid Date:date format must be DD/MM/YYYY"; TS_ASSERT_THROWS(searchobj.setPropertyValue("EndDate", "aaaaa"), - std::invalid_argument(errorMsg)); + const std::invalid_argument &); ICatTestHelper::logout(); } @@ -152,14 +152,14 @@ public: ": Invalid Date:Day part of the Date parameter must " "be between 1 and 31"; TS_ASSERT_THROWS(searchobj.setPropertyValue("StartDate", "39/22/2009"), - std::invalid_argument(errorMsg)); + const std::invalid_argument &); errorMsg = "Invalid value for property EndDate (string) " "1/22/2009" ": Invalid Date:Month part of the Date parameter must be " "between 1 and 12"; TS_ASSERT_THROWS(searchobj.setPropertyValue("EndDate", "1/22/2009"), - std::invalid_argument(errorMsg)); + const std::invalid_argument &); ICatTestHelper::logout(); } diff --git a/Framework/Indexing/inc/MantidIndexing/SpectrumNumberTranslator.h b/Framework/Indexing/inc/MantidIndexing/SpectrumNumberTranslator.h index 1d1eef6c645..0bfdf8ea65f 100644 --- a/Framework/Indexing/inc/MantidIndexing/SpectrumNumberTranslator.h +++ b/Framework/Indexing/inc/MantidIndexing/SpectrumNumberTranslator.h @@ -67,7 +67,9 @@ private: spectrumNumbers(const std::vector<GlobalSpectrumIndex> &globalIndices) const; struct SpectrumNumberHash { - std::size_t operator()(const SpectrumNumber &spectrumNumber) const { + // Pass-by-value as qualifiers ignored on cast result type and + // SpectrumNumber is a trivial type (int32_t). + std::size_t operator()(SpectrumNumber spectrumNumber) const { return std::hash<std::int32_t>()(static_cast<int32_t>(spectrumNumber)); } }; diff --git a/Framework/Indexing/test/GroupTest.h b/Framework/Indexing/test/GroupTest.h index 89393faf5c5..aeae435b69c 100644 --- a/Framework/Indexing/test/GroupTest.h +++ b/Framework/Indexing/test/GroupTest.h @@ -28,7 +28,7 @@ public: std::vector<std::vector<size_t>> grouping{{0}, {1}, {2}}; std::vector<SpectrumNumber> specNums{4, 5}; TS_ASSERT_THROWS(group(source, std::move(specNums), grouping), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_EQUALS(specNums.size(), 2); } diff --git a/Framework/Indexing/test/IndexInfoTest.h b/Framework/Indexing/test/IndexInfoTest.h index 64c57662fb3..696459151c6 100644 --- a/Framework/Indexing/test/IndexInfoTest.h +++ b/Framework/Indexing/test/IndexInfoTest.h @@ -61,7 +61,7 @@ void run_StorageMode_MasterOnly(const Parallel::Communicator &comm) { TS_ASSERT_EQUALS(i.spectrumNumber(2), 3); } else { TS_ASSERT_THROWS(IndexInfo(3, Parallel::StorageMode::MasterOnly, comm), - std::runtime_error); + const std::runtime_error &); } } @@ -246,7 +246,7 @@ public: void test_setSpectrumNumbers_size_mismatch() { IndexInfo t(3); - TS_ASSERT_THROWS(t.setSpectrumNumbers({1, 2}), std::runtime_error); + TS_ASSERT_THROWS(t.setSpectrumNumbers({1, 2}), const std::runtime_error &); } void test_setSpectrumDefinitions_size_mismatch() { @@ -283,13 +283,13 @@ public: // break some things, so we forbid this for now. IndexInfo info(3); Kernel::cow_ptr<std::vector<SpectrumDefinition>> defs{nullptr}; - TS_ASSERT_THROWS(info.setSpectrumDefinitions(defs), std::runtime_error); + TS_ASSERT_THROWS(info.setSpectrumDefinitions(defs), const std::runtime_error &); } void test_setSpectrumDefinitions_size_mismatch_cow_ptr() { IndexInfo info(3); const auto defs = Kernel::make_cow<std::vector<SpectrumDefinition>>(2); - TS_ASSERT_THROWS(info.setSpectrumDefinitions(defs), std::runtime_error); + TS_ASSERT_THROWS(info.setSpectrumDefinitions(defs), const std::runtime_error &); } void test_setSpectrumDefinitions_cow_ptr() { diff --git a/Framework/Indexing/test/IndexSetTest.h b/Framework/Indexing/test/IndexSetTest.h index 7108f6770e5..67c477c65e2 100644 --- a/Framework/Indexing/test/IndexSetTest.h +++ b/Framework/Indexing/test/IndexSetTest.h @@ -43,13 +43,13 @@ public: void test_rangeConstructorErrorCases() { // min negative - TS_ASSERT_THROWS(IndexSetTester set(-1, 2, 3), std::logic_error); + TS_ASSERT_THROWS(IndexSetTester set(-1, 2, 3), const std::logic_error &); // min > max - TS_ASSERT_THROWS(IndexSetTester set(2, 1, 3), std::logic_error); + TS_ASSERT_THROWS(IndexSetTester set(2, 1, 3), const std::logic_error &); // max above count - TS_ASSERT_THROWS(IndexSetTester set(1, 3, 3), std::out_of_range); + TS_ASSERT_THROWS(IndexSetTester set(1, 3, 3), const std::out_of_range &); // does it still fail if both are wrong? - TS_ASSERT_THROWS(IndexSetTester set(3, 3, 3), std::logic_error); + TS_ASSERT_THROWS(IndexSetTester set(3, 3, 3), const std::logic_error &); } void test_indexListConstructor() { @@ -59,7 +59,7 @@ public: } void test_indexListConstructorErrorCases() { - TS_ASSERT_THROWS(IndexSetTester set({3}, 3), std::out_of_range); + TS_ASSERT_THROWS(IndexSetTester set({3}, 3), const std::out_of_range &); } void test_size() { diff --git a/Framework/Indexing/test/PartitionerTest.h b/Framework/Indexing/test/PartitionerTest.h index 14970ba936a..898554ebaf4 100644 --- a/Framework/Indexing/test/PartitionerTest.h +++ b/Framework/Indexing/test/PartitionerTest.h @@ -40,8 +40,8 @@ public: static void destroySuite(PartitionerTest *suite) { delete suite; } void test_constructor_failures() { - TS_ASSERT_THROWS(PartitionerHelper(-1), std::logic_error); - TS_ASSERT_THROWS(PartitionerHelper(0), std::logic_error); + TS_ASSERT_THROWS(PartitionerHelper(-1), const std::logic_error &); + TS_ASSERT_THROWS(PartitionerHelper(0), const std::logic_error &); TS_ASSERT_THROWS_NOTHING(PartitionerHelper( 1, PartitionIndex(13), Partitioner::MonitorStrategy::CloneOnEachPartition, @@ -51,7 +51,7 @@ public: 1, PartitionIndex(13), Partitioner::MonitorStrategy::DedicatedPartition, std::vector<GlobalSpectrumIndex>{GlobalSpectrumIndex(3)}), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS_NOTHING(PartitionerHelper( 2, PartitionIndex(13), Partitioner::MonitorStrategy::DedicatedPartition, std::vector<GlobalSpectrumIndex>{GlobalSpectrumIndex(3)})); @@ -67,10 +67,12 @@ public: void test_checkValid() { PartitionerHelper p(42); - TS_ASSERT_THROWS(p.checkValid(PartitionIndex(-1)), std::out_of_range); + TS_ASSERT_THROWS(p.checkValid(PartitionIndex(-1)), + const std::out_of_range &); TS_ASSERT_THROWS_NOTHING(p.checkValid(PartitionIndex(0))); TS_ASSERT_THROWS_NOTHING(p.checkValid(PartitionIndex(41))); - TS_ASSERT_THROWS(p.checkValid(PartitionIndex(42)), std::out_of_range); + TS_ASSERT_THROWS(p.checkValid(PartitionIndex(42)), + const std::out_of_range &); } void test_numberOfPartitions() { diff --git a/Framework/Indexing/test/SpectrumNumberTranslatorTest.h b/Framework/Indexing/test/SpectrumNumberTranslatorTest.h index 84e0e850b03..f4fa0435a7e 100644 --- a/Framework/Indexing/test/SpectrumNumberTranslatorTest.h +++ b/Framework/Indexing/test/SpectrumNumberTranslatorTest.h @@ -148,7 +148,7 @@ public: spectrumNumbers[1] = 7; // 7 is not in parent. TS_ASSERT_THROWS(SpectrumNumberTranslator(spectrumNumbers, parent), - std::out_of_range); + const std::out_of_range &); } void test_access_bad_spectrum_numbers() { @@ -169,9 +169,9 @@ public: // Access via spectrum numbers fails. TS_ASSERT_THROWS( translator.makeIndexSet(SpectrumNumber(2), SpectrumNumber(3)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS(translator.makeIndexSet(makeSpectrumNumbers({1})), - std::logic_error); + const std::logic_error &); // Access via global spectrum index works. TS_ASSERT_THROWS_NOTHING(translator.makeIndexSet(GlobalSpectrumIndex(1), GlobalSpectrumIndex(2))); @@ -249,11 +249,11 @@ public: void test_makeIndexSet_minmax_range_failures() { auto t = makeTranslator(1, 0); TS_ASSERT_THROWS(t->makeIndexSet(SpectrumNumber(0), SpectrumNumber(5)), - std::out_of_range); + const std::out_of_range &); TS_ASSERT_THROWS(t->makeIndexSet(SpectrumNumber(1), SpectrumNumber(6)), - std::out_of_range); + const std::out_of_range &); TS_ASSERT_THROWS(t->makeIndexSet(SpectrumNumber(1), SpectrumNumber(3)), - std::out_of_range); + const std::out_of_range &); } void test_makeIndexSet_minmax_full_1_rank() { @@ -314,21 +314,21 @@ public: auto t = makeTranslator(3, 1); TS_ASSERT_THROWS( t->makeIndexSet(GlobalSpectrumIndex(1), GlobalSpectrumIndex(0)), - std::logic_error); + const std::logic_error &); TS_ASSERT_THROWS( t->makeIndexSet(GlobalSpectrumIndex(0), GlobalSpectrumIndex(4)), - std::out_of_range); + const std::out_of_range &); TS_ASSERT_THROWS( t->makeIndexSet(GlobalSpectrumIndex(5), GlobalSpectrumIndex(4)), - std::logic_error); + const std::logic_error &); // -1 converted to size_t is positive and >> 1 TS_ASSERT_THROWS( t->makeIndexSet(GlobalSpectrumIndex(-1), GlobalSpectrumIndex(1)), - std::logic_error); + const std::logic_error &); // -1 converted to size_t is > 0 but out of range TS_ASSERT_THROWS( t->makeIndexSet(GlobalSpectrumIndex(0), GlobalSpectrumIndex(-1)), - std::out_of_range); + const std::out_of_range &); } void test_makeIndexSet_minmax_GlobalSpectrumIndex_3_ranks() { @@ -360,7 +360,7 @@ public: void test_makeIndexSet_partial_3_ranks_range_checks() { auto translator = makeTranslator(3, 1); TS_ASSERT_THROWS(translator->makeIndexSet(makeSpectrumNumbers({0})), - std::out_of_range); + const std::out_of_range &); // Index is not on this rank but it is correct. TS_ASSERT_THROWS_NOTHING( translator->makeIndexSet(makeSpectrumNumbers({2}))); @@ -393,9 +393,9 @@ public: void test_makeIndexSet_GlobalSpectrumIndex_partial_3_ranks_range_checks() { auto t = makeTranslator(3, 0); TS_ASSERT_THROWS(t->makeIndexSet(makeGlobalSpectrumIndices({-1})), - std::out_of_range); + const std::out_of_range &); TS_ASSERT_THROWS(t->makeIndexSet(makeGlobalSpectrumIndices({4})), - std::out_of_range); + const std::out_of_range &); // Index is not on this rank but it is correct. TS_ASSERT_THROWS_NOTHING(t->makeIndexSet(makeGlobalSpectrumIndices({1}))); TS_ASSERT_EQUALS(t->makeIndexSet(makeGlobalSpectrumIndices({1})).size(), 0); diff --git a/Framework/Kernel/test/ArrayPropertyTest.h b/Framework/Kernel/test/ArrayPropertyTest.h index 9dad1852424..efd130e652a 100644 --- a/Framework/Kernel/test/ArrayPropertyTest.h +++ b/Framework/Kernel/test/ArrayPropertyTest.h @@ -149,9 +149,12 @@ public: TS_ASSERT(!s.operator()()[1].compare("b")) TS_ASSERT(!s.operator()()[2].compare("c")) - TS_ASSERT_THROWS(ArrayProperty<int> ii("ii", "aa,bb"), std::bad_cast) - TS_ASSERT_THROWS(ArrayProperty<int> ii("ii", "5.5,6.6"), std::bad_cast) - TS_ASSERT_THROWS(ArrayProperty<double> dd("dd", "aa,bb"), std::bad_cast) + TS_ASSERT_THROWS(ArrayProperty<int> ii("ii", "aa,bb"), + const std::bad_cast &) + TS_ASSERT_THROWS(ArrayProperty<int> ii("ii", "5.5,6.6"), + const std::bad_cast &) + TS_ASSERT_THROWS(ArrayProperty<double> dd("dd", "aa,bb"), + const std::bad_cast &) } void testConstructorByString_long() { diff --git a/Framework/Kernel/test/AtomTest.h b/Framework/Kernel/test/AtomTest.h index 42008454e22..f72ae778a25 100644 --- a/Framework/Kernel/test/AtomTest.h +++ b/Framework/Kernel/test/AtomTest.h @@ -37,8 +37,8 @@ public: } void testError() { - TS_ASSERT_THROWS(getAtom(1, 15), std::runtime_error); - TS_ASSERT_THROWS(getAtom("garbage"), std::runtime_error); + TS_ASSERT_THROWS(getAtom(1, 15), const std::runtime_error &); + TS_ASSERT_THROWS(getAtom("garbage"), const std::runtime_error &); } }; diff --git a/Framework/Kernel/test/BinaryFileTest.h b/Framework/Kernel/test/BinaryFileTest.h index 9c396fd78a9..cb160d0f8cc 100644 --- a/Framework/Kernel/test/BinaryFileTest.h +++ b/Framework/Kernel/test/BinaryFileTest.h @@ -62,13 +62,13 @@ public: BinaryFileTest() { dummy_file = "dummy.bin"; } void testFileNotFound() { - TS_ASSERT_THROWS(file.open("nonexistentfile.dat"), std::invalid_argument); + TS_ASSERT_THROWS(file.open("nonexistentfile.dat"), const std::invalid_argument &); } void testFileWrongSize() { MakeDummyFile(dummy_file, 3); - TS_ASSERT_THROWS(file.open(dummy_file), std::runtime_error); + TS_ASSERT_THROWS(file.open(dummy_file), const std::runtime_error &); file.close(); Poco::File(dummy_file).remove(); } @@ -184,9 +184,9 @@ public: std::vector<DasEvent> data; DasEvent *buffer = nullptr; TS_ASSERT_EQUALS(file2.getNumElements(), 0); - TS_ASSERT_THROWS(file2.loadAll(), std::runtime_error); - TS_ASSERT_THROWS(data = file2.loadAllIntoVector(), std::runtime_error); - TS_ASSERT_THROWS(file2.loadBlock(buffer, 10), std::runtime_error); + TS_ASSERT_THROWS(file2.loadAll(), const std::runtime_error &); + TS_ASSERT_THROWS(data = file2.loadAllIntoVector(), const std::runtime_error &); + TS_ASSERT_THROWS(file2.loadBlock(buffer, 10), const std::runtime_error &); } }; diff --git a/Framework/Kernel/test/BinaryStreamReaderTest.h b/Framework/Kernel/test/BinaryStreamReaderTest.h index da50c83fadb..dd915b98f00 100644 --- a/Framework/Kernel/test/BinaryStreamReaderTest.h +++ b/Framework/Kernel/test/BinaryStreamReaderTest.h @@ -239,7 +239,7 @@ public: int i(0); m_bytes >> i; TSM_ASSERT_THROWS("Expected a runtime_error when given a bad stream", - BinaryStreamReader reader(m_bytes), std::runtime_error); + BinaryStreamReader reader(m_bytes), const std::runtime_error &); } private: diff --git a/Framework/Kernel/test/BoseEinsteinDistributionTest.h b/Framework/Kernel/test/BoseEinsteinDistributionTest.h index 2822f7714bc..53b54ab9f5a 100644 --- a/Framework/Kernel/test/BoseEinsteinDistributionTest.h +++ b/Framework/Kernel/test/BoseEinsteinDistributionTest.h @@ -29,9 +29,9 @@ public: const double temperature = 35.0; TS_ASSERT_THROWS(BoseEinsteinDistribution::n(energy, temperature), - std::domain_error); + const std::domain_error &); TS_ASSERT_THROWS(BoseEinsteinDistribution::n(temperature, energy), - std::domain_error); + const std::domain_error &); } void diff --git a/Framework/Kernel/test/ComputeResourceInfoTest.h b/Framework/Kernel/test/ComputeResourceInfoTest.h index 46d975db7e2..607157e8ec6 100644 --- a/Framework/Kernel/test/ComputeResourceInfoTest.h +++ b/Framework/Kernel/test/ComputeResourceInfoTest.h @@ -32,7 +32,7 @@ public: boost::shared_ptr<FacilityInfo> another; TS_ASSERT_THROWS(another = createCRInfoInMinimalFacility( "<computeResource fooAtt=\"barVal\"/>"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT(!another); } @@ -44,7 +44,7 @@ public: "</computeResource>"; boost::shared_ptr<FacilityInfo> fac; TS_ASSERT_THROWS(fac = createCRInfoInMinimalFacility(crTxt), - std::runtime_error); + const std::runtime_error &); TS_ASSERT(!fac); } @@ -56,7 +56,7 @@ public: "</compResource>"; boost::shared_ptr<FacilityInfo> fac; TS_ASSERT_THROWS(fac = createCRInfoInMinimalFacility(crTxt), - Poco::XML::XMLException); + const Poco::XML::XMLException &); TS_ASSERT(!fac); } @@ -103,7 +103,7 @@ public: boost::shared_ptr<FacilityInfo> fac; TS_ASSERT_THROWS(fac = createCRInfoInMinimalFacility(fermi), - std::runtime_error); + const std::runtime_error &); TS_ASSERT(!fac); } diff --git a/Framework/Kernel/test/ConfigServiceTest.h b/Framework/Kernel/test/ConfigServiceTest.h index 29acf971f64..003c46cc302 100644 --- a/Framework/Kernel/test/ConfigServiceTest.h +++ b/Framework/Kernel/test/ConfigServiceTest.h @@ -146,10 +146,6 @@ public: ConfigService::Instance().setFacility("SNS"); const FacilityInfo &fac1 = ConfigService::Instance().getFacility(); TS_ASSERT_EQUALS(fac1.name(), "SNS"); - - // // Non existent facility - // TS_ASSERT_THROWS(ConfigService::Instance().setFacility(""), - // Mantid::Kernel::Exception::NotFoundError); } void testFacilityList() { @@ -187,7 +183,7 @@ public: // Check we throw the correct error for a nonsense beamline. // TS_ASSERT_THROWS(ConfigService::Instance().getInstrument("MyBeamline").name(), - // NotFoundError); + // const NotFoundError &); // Now find by using short name TS_ASSERT_EQUALS(ConfigService::Instance().getInstrument("BSS").name(), diff --git a/Framework/Kernel/test/DataServiceTest.h b/Framework/Kernel/test/DataServiceTest.h index f99466732b3..8324c564a7b 100644 --- a/Framework/Kernel/test/DataServiceTest.h +++ b/Framework/Kernel/test/DataServiceTest.h @@ -72,12 +72,12 @@ public: TS_ASSERT_EQUALS(svc.retrieve("anotherOne"), one); // Can't re-add the same name - TS_ASSERT_THROWS(svc.add("one", one), std::runtime_error); + TS_ASSERT_THROWS(svc.add("one", one), const std::runtime_error &); // Can't add blank name - TS_ASSERT_THROWS(svc.add("", one), std::runtime_error); + TS_ASSERT_THROWS(svc.add("", one), const std::runtime_error &); // Can't add empty pointer TS_ASSERT_THROWS(svc.add("Null", boost::shared_ptr<int>()), - std::runtime_error); + const std::runtime_error &); svc.add("__hidden", boost::make_shared<int>(99)); TS_ASSERT_EQUALS(notificationFlag, 3) @@ -133,10 +133,10 @@ public: TS_ASSERT_EQUALS(*svc.retrieve("one"), 2); // Can't add blank names - TS_ASSERT_THROWS(svc.addOrReplace("", two), std::runtime_error); + TS_ASSERT_THROWS(svc.addOrReplace("", two), const std::runtime_error &); // Can't add empty pointer TS_ASSERT_THROWS(svc.addOrReplace("one", boost::shared_ptr<int>()), - std::runtime_error); + const std::runtime_error &); } void handleBeforeReplaceNotification( @@ -175,7 +175,7 @@ public: "anotherOne"); // Note: Rename is case-insensitive on the old name TS_ASSERT_EQUALS(svc.size(), 2); TSM_ASSERT_THROWS("One should have been renamed to anotherOne", - svc.retrieve("one"), Exception::NotFoundError); + svc.retrieve("one"), const Exception::NotFoundError &); TSM_ASSERT_EQUALS("One should have been renamed to anotherOne", svc.retrieve("anotherOne"), one); @@ -186,7 +186,7 @@ public: svc.rename("Two", "anotherOne"); TS_ASSERT_EQUALS(svc.size(), 1); TSM_ASSERT_THROWS("Two should have been renamed to anotherOne", - svc.retrieve("two"), Exception::NotFoundError); + svc.retrieve("two"), const Exception::NotFoundError &); TSM_ASSERT_EQUALS("Two should have been renamed to anotherOne", svc.retrieve("anotherOne"), two); // As we are renaming to an existing workspace there should be 2 @@ -197,7 +197,7 @@ public: svc.notificationCenter.removeObserver(observer); svc.notificationCenter.removeObserver(observer2); - TS_ASSERT_THROWS(svc.rename("anotherOne", ""), std::runtime_error); + TS_ASSERT_THROWS(svc.rename("anotherOne", ""), const std::runtime_error &); TSM_ASSERT_THROWS_NOTHING("'AnotherOne' should still be there", svc.retrieve("anotherOne")); } @@ -232,7 +232,7 @@ public: TS_ASSERT_EQUALS(svc.retrieve("one"), one); TSM_ASSERT_EQUALS("Retrieval should be case-insensitive", svc.retrieve("oNE"), one); - TS_ASSERT_THROWS(svc.retrieve("NOTone"), Exception::NotFoundError); + TS_ASSERT_THROWS(svc.retrieve("NOTone"), const Exception::NotFoundError &); TS_ASSERT(svc.doesExist("one")); TSM_ASSERT("doesExist should be case-insensitive", svc.doesExist("oNE")); diff --git a/Framework/Kernel/test/DateAndTimeHelpersTest.h b/Framework/Kernel/test/DateAndTimeHelpersTest.h index 06ec77df032..be317414557 100644 --- a/Framework/Kernel/test/DateAndTimeHelpersTest.h +++ b/Framework/Kernel/test/DateAndTimeHelpersTest.h @@ -43,7 +43,7 @@ public: void test_average() { std::vector<DateAndTime> times; - TS_ASSERT_THROWS(averageSorted(times), std::invalid_argument); + TS_ASSERT_THROWS(averageSorted(times), const std::invalid_argument &); times.push_back( createFromSanitizedISO8601("1977-05-25T00:00Z")); // Star Wars IV diff --git a/Framework/Kernel/test/DateAndTimeTest.h b/Framework/Kernel/test/DateAndTimeTest.h index 53b6a699350..655b89a291f 100644 --- a/Framework/Kernel/test/DateAndTimeTest.h +++ b/Framework/Kernel/test/DateAndTimeTest.h @@ -64,11 +64,11 @@ public: } void test_constructor_fails_invalid_string() { - TS_ASSERT_THROWS(DateAndTime("invalid time string"), std::invalid_argument); + TS_ASSERT_THROWS(DateAndTime("invalid time string"), const std::invalid_argument &); TS_ASSERT_THROWS(DateAndTime("1909-01-31 22:59:59"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(DateAndTime("2017-09-27T 07:03:49+00:00"), - std::invalid_argument); + const std::invalid_argument &); } void test_limits_on_construction() { @@ -422,7 +422,7 @@ public: void testNotADateTime() { boost::posix_time::ptime time(boost::posix_time::not_a_date_time); DateAndTime dt(time); - TS_ASSERT_THROWS(boost::posix_time::to_tm(time), std::out_of_range); + TS_ASSERT_THROWS(boost::posix_time::to_tm(time), const std::out_of_range &); TS_ASSERT_THROWS_NOTHING(dt.to_tm()); } diff --git a/Framework/Kernel/test/DiskBufferTest.h b/Framework/Kernel/test/DiskBufferTest.h index 1636b18a105..10a6d30ef31 100644 --- a/Framework/Kernel/test/DiskBufferTest.h +++ b/Framework/Kernel/test/DiskBufferTest.h @@ -511,7 +511,7 @@ public: freeSpaceBlocksArray + sizeof(freeSpaceBlocksArray) / sizeof(uint64_t)); TS_ASSERT_THROWS(dbuf.setFreeSpaceVector(freeSpaceBlocksVector), - std::length_error); + const std::length_error &); } //// Test for setting the DiskBuffer with a zero sized vector diff --git a/Framework/Kernel/test/DynamicFactoryTest.h b/Framework/Kernel/test/DynamicFactoryTest.h index d9042e4bc10..2aaa564606c 100644 --- a/Framework/Kernel/test/DynamicFactoryTest.h +++ b/Framework/Kernel/test/DynamicFactoryTest.h @@ -46,7 +46,7 @@ public: } void testCreate() { - TS_ASSERT_THROWS(factory.create("testEntry"), std::runtime_error) + TS_ASSERT_THROWS(factory.create("testEntry"), const std::runtime_error &) factory.subscribe<int>("testEntry"); TS_ASSERT_THROWS_NOTHING(int_ptr i = factory.create("testEntry")); TS_ASSERT_THROWS_NOTHING(int_ptr i = factory.create("TESTENTRY")); @@ -55,11 +55,11 @@ public: void testCreateCaseSensitive() { TS_ASSERT_THROWS(caseSensitiveFactory.create("testEntryCaseSensitive"), - std::runtime_error) + const std::runtime_error &) caseSensitiveFactory.subscribe<int>("testEntryCaseSensitive"); TS_ASSERT_THROWS( int_ptr i = caseSensitiveFactory.create("testEntryCaseSENSITIVE"), - std::runtime_error); // case error on a case sensitive dynamic factory + const std::runtime_error &); // case error on a case sensitive dynamic factory TS_ASSERT_THROWS_NOTHING( int_ptr i2 = caseSensitiveFactory.create("testEntryCaseSensitive")); caseSensitiveFactory.unsubscribe("testEntryCaseSensitive"); @@ -67,7 +67,7 @@ public: void testCreateUnwrapped() { TS_ASSERT_THROWS(factory.createUnwrapped("testUnrappedEntry"), - std::runtime_error) + const std::runtime_error &) factory.subscribe<int>("testUnwrappedEntry"); int *i = nullptr; TS_ASSERT_THROWS_NOTHING(i = factory.createUnwrapped("testUnwrappedEntry")); @@ -82,13 +82,13 @@ public: void testCreateUnwrappedCaseSensitive() { TS_ASSERT_THROWS( caseSensitiveFactory.create("testUnrappedEntryCaseSensitive"), - std::runtime_error) + const std::runtime_error &) caseSensitiveFactory.subscribe<int>("testUnrappedEntryCaseSensitive"); int *i = nullptr; TS_ASSERT_THROWS( i = caseSensitiveFactory.createUnwrapped( "testUnrappedentrycaseSENSITIVE"), - std::runtime_error); // case error on a case sensitive dynamic factory + const std::runtime_error &); // case error on a case sensitive dynamic factory TS_ASSERT_THROWS_NOTHING(i = caseSensitiveFactory.createUnwrapped( "testUnrappedEntryCaseSensitive")); delete i; @@ -96,7 +96,7 @@ public: } void testSubscribeWithEmptyNameThrowsInvalidArgument() { - TS_ASSERT_THROWS(factory.subscribe<int>(""), std::invalid_argument); + TS_ASSERT_THROWS(factory.subscribe<int>(""), const std::invalid_argument &); } void @@ -105,7 +105,7 @@ public: factory.subscribe("int", new Instantiator<int, int>)); TS_ASSERT_THROWS(factory.subscribe("int", new Instantiator<int, int>, IntFactory::ErrorIfExists), - std::runtime_error); + const std::runtime_error &); factory.unsubscribe("int"); } @@ -135,7 +135,7 @@ public: } void testUnsubscribeByDefaultDoesNotNotify() { - TS_ASSERT_THROWS(factory.unsubscribe("tester"), std::runtime_error); + TS_ASSERT_THROWS(factory.unsubscribe("tester"), const std::runtime_error &); factory.subscribe<int>("tester"); m_updateNoticeReceived = false; TS_ASSERT_THROWS_NOTHING(factory.unsubscribe("tester")); @@ -163,7 +163,7 @@ public: void testGetKeys() { std::string testKey = "testGetKeys"; // check it is not already present - TS_ASSERT_THROWS(factory.create(testKey), std::runtime_error) + TS_ASSERT_THROWS(factory.create(testKey), const std::runtime_error &) factory.subscribe<int>(testKey); std::vector<std::string> keys = factory.getKeys(); @@ -180,7 +180,7 @@ public: void testGetKeysRetainsCase() { std::string testKey = "testGetKeysRetainsCase"; // check it is not already present - TS_ASSERT_THROWS(factory.create(testKey), std::runtime_error) + TS_ASSERT_THROWS(factory.create(testKey), const std::runtime_error &) factory.subscribe<int>(testKey); std::vector<std::string> keys = factory.getKeys(); diff --git a/Framework/Kernel/test/FacilitiesTest.h b/Framework/Kernel/test/FacilitiesTest.h index b6b690b2f72..815f823514d 100644 --- a/Framework/Kernel/test/FacilitiesTest.h +++ b/Framework/Kernel/test/FacilitiesTest.h @@ -32,7 +32,7 @@ public: " </facility>" "</facilities>"; - TS_ASSERT_THROWS(getFacility(xmlStr), std::runtime_error); + TS_ASSERT_THROWS(getFacility(xmlStr), const std::runtime_error &); } void test_throws_if_no_file_extensions() { @@ -42,7 +42,7 @@ public: " </facility>" "</facilities>"; - TS_ASSERT_THROWS(getFacility(xmlStr), std::runtime_error); + TS_ASSERT_THROWS(getFacility(xmlStr), const std::runtime_error &); } void test_throws_if_no_instruments() { @@ -53,7 +53,7 @@ public: " </facility>" "</facilities>"; - TS_ASSERT_THROWS(getFacility(xmlStr), std::runtime_error); + TS_ASSERT_THROWS(getFacility(xmlStr), const std::runtime_error &); } void test_minimal() { @@ -86,7 +86,8 @@ public: "AnInst"); TS_ASSERT(fac->instruments("Nonsense").empty()); TS_ASSERT_EQUALS(fac->instrument("AnInst").name(), "AnInst"); - TS_ASSERT_THROWS(fac->instrument("NoInst"), Exception::NotFoundError); + TS_ASSERT_THROWS(fac->instrument("NoInst"), + const Exception::NotFoundError &); delete fac; } diff --git a/Framework/Kernel/test/FileDescriptorTest.h b/Framework/Kernel/test/FileDescriptorTest.h index 8aa8ab0f363..374b516a408 100644 --- a/Framework/Kernel/test/FileDescriptorTest.h +++ b/Framework/Kernel/test/FileDescriptorTest.h @@ -140,9 +140,9 @@ public: //===================== Failure cases //============================================ void test_IsAscii_Throws_For_Inaccessible_Filename() { - TS_ASSERT_THROWS(FileDescriptor::isAscii(""), std::invalid_argument); + TS_ASSERT_THROWS(FileDescriptor::isAscii(""), const std::invalid_argument &); TS_ASSERT_THROWS(FileDescriptor::isAscii("__not_a_File.txt__"), - std::invalid_argument); + const std::invalid_argument &); } void @@ -161,12 +161,12 @@ public: } void test_Constructor_Throws_With_Empty_filename() { - TS_ASSERT_THROWS(FileDescriptor(""), std::invalid_argument); + TS_ASSERT_THROWS(FileDescriptor(""), const std::invalid_argument &); } void test_Constructor_Throws_With_NonExistant_filename() { TS_ASSERT_THROWS(FileDescriptor("__ThisShouldBeANonExistantFile.txt"), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/Kernel/test/FunctionTaskTest.h b/Framework/Kernel/test/FunctionTaskTest.h index 879c4cd09c7..e7983935809 100644 --- a/Framework/Kernel/test/FunctionTaskTest.h +++ b/Framework/Kernel/test/FunctionTaskTest.h @@ -31,7 +31,7 @@ class FunctionTaskTest : public CxxTest::TestSuite { public: void test_NullFunction_throws() { FunctionTask mytask(nullptr); - TS_ASSERT_THROWS(mytask.run(), std::runtime_error); + TS_ASSERT_THROWS(mytask.run(), const std::runtime_error &); } void test_VoidFunction() { diff --git a/Framework/Kernel/test/IndexSetTest.h b/Framework/Kernel/test/IndexSetTest.h index cce738306e6..b81ef08e6a3 100644 --- a/Framework/Kernel/test/IndexSetTest.h +++ b/Framework/Kernel/test/IndexSetTest.h @@ -34,13 +34,13 @@ public: void test_rangeConstructorErrorCases() { // min negative - TS_ASSERT_THROWS(IndexSet set(-1, 2, 3), Exception::IndexError); + TS_ASSERT_THROWS(IndexSet set(-1, 2, 3), const Exception::IndexError &); // min > max - TS_ASSERT_THROWS(IndexSet set(2, 1, 3), Exception::IndexError); + TS_ASSERT_THROWS(IndexSet set(2, 1, 3), const Exception::IndexError &); // max above count - TS_ASSERT_THROWS(IndexSet set(1, 3, 3), Exception::IndexError); + TS_ASSERT_THROWS(IndexSet set(1, 3, 3), const Exception::IndexError &); // does it still fail if both are wrong? - TS_ASSERT_THROWS(IndexSet set(3, 3, 3), Exception::IndexError); + TS_ASSERT_THROWS(IndexSet set(3, 3, 3), const Exception::IndexError &); } void test_indexListConstructor() { @@ -50,7 +50,7 @@ public: } void test_indexListConstructorErrorCases() { - TS_ASSERT_THROWS(IndexSet set({3}, 3), Exception::IndexError); + TS_ASSERT_THROWS(IndexSet set({3}, 3), const Exception::IndexError &); } void test_size() { diff --git a/Framework/Kernel/test/InstrumentInfoTest.h b/Framework/Kernel/test/InstrumentInfoTest.h index 1811e83dd9f..cd8042b7f3f 100644 --- a/Framework/Kernel/test/InstrumentInfoTest.h +++ b/Framework/Kernel/test/InstrumentInfoTest.h @@ -23,13 +23,13 @@ class InstrumentInfoTest : public CxxTest::TestSuite { public: void test_throws_if_unnamed_instrument() { TS_ASSERT_THROWS(createInstInfoInMinimalFacility("<instrument />"), - std::runtime_error); + const std::runtime_error &); } void test_throws_if_no_techinque_given() { TS_ASSERT_THROWS( createInstInfoInMinimalFacility("<instrument name=\"inst\"/>"), - std::runtime_error); + const std::runtime_error &); } void test_mostly_default_instrument() { @@ -187,7 +187,7 @@ public: "</instrument>"; TS_ASSERT_THROWS(createInstInfoInMinimalFacility(instStr), - std::runtime_error); + const std::runtime_error &); } void test_error_1_in_multiple_zeropadding() { @@ -198,7 +198,7 @@ public: "</instrument>"; TS_ASSERT_THROWS(createInstInfoInMinimalFacility(instStr), - std::runtime_error); + const std::runtime_error &); } void test_error_2_in_multiple_zeropadding() { @@ -209,7 +209,7 @@ public: "</instrument>"; TS_ASSERT_THROWS(createInstInfoInMinimalFacility(instStr), - std::runtime_error); + const std::runtime_error &); } void test_error_3_in_multiple_zeropadding() { @@ -220,7 +220,7 @@ public: "</instrument>"; TS_ASSERT_THROWS(createInstInfoInMinimalFacility(instStr), - std::runtime_error); + const std::runtime_error &); } void test_equality_operator() { diff --git a/Framework/Kernel/test/InterpolationTest.h b/Framework/Kernel/test/InterpolationTest.h index 50e1e3ee2ad..ac1a6a0419c 100644 --- a/Framework/Kernel/test/InterpolationTest.h +++ b/Framework/Kernel/test/InterpolationTest.h @@ -200,15 +200,15 @@ public: // called. TS_ASSERT_THROWS( interpolation.findIndexOfNextLargerValue(m_tableXValues, 204.0), - std::range_error); + const std::range_error &); // outside interpolation limits - edge cases as well TS_ASSERT_THROWS( interpolation.findIndexOfNextLargerValue(m_tableXValues, 199), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS( interpolation.findIndexOfNextLargerValue(m_tableXValues, 2000.0), - std::range_error); + const std::range_error &); } void testInterpolationWithTooFewValues() { diff --git a/Framework/Kernel/test/ListValidatorTest.h b/Framework/Kernel/test/ListValidatorTest.h index 3c0bca5a92a..f1da70bf90f 100644 --- a/Framework/Kernel/test/ListValidatorTest.h +++ b/Framework/Kernel/test/ListValidatorTest.h @@ -99,7 +99,7 @@ public: TS_ASSERT_EQUALS(validator.getValueForAlias("2"), "two") TS_ASSERT_EQUALS(validator.getValueForAlias("3"), "three") - TS_ASSERT_THROWS(validator.getValueForAlias("4"), std::invalid_argument) + TS_ASSERT_THROWS(validator.getValueForAlias("4"), const std::invalid_argument &) } void testAliasInt() { @@ -121,14 +121,14 @@ public: TS_ASSERT_EQUALS(validator.getValueForAlias("33"), "3") TS_ASSERT_EQUALS(validator.getValueForAlias("55"), "5") - TS_ASSERT_THROWS(validator.getValueForAlias("13"), std::invalid_argument) + TS_ASSERT_THROWS(validator.getValueForAlias("13"), const std::invalid_argument &) } void test_wrong_alias() { std::vector<std::string> values{"one", "three"}; std::map<std::string, std::string> aliases{{"1", "one"}, {"2", "two"}}; TS_ASSERT_THROWS(StringListValidator validator(values, aliases), - std::invalid_argument); + const std::invalid_argument &); } void test_self_alias() { diff --git a/Framework/Kernel/test/LiveListenerInfoTest.h b/Framework/Kernel/test/LiveListenerInfoTest.h index e5ea6a793fe..d0a86cd67f6 100644 --- a/Framework/Kernel/test/LiveListenerInfoTest.h +++ b/Framework/Kernel/test/LiveListenerInfoTest.h @@ -86,7 +86,7 @@ public: TS_ASSERT_EQUALS(info.address(), "A"); TS_ASSERT_EQUALS(info.listener(), "L"); - TS_ASSERT_THROWS(inst.liveListenerInfo("n3"), std::runtime_error); + TS_ASSERT_THROWS(inst.liveListenerInfo("n3"), const std::runtime_error &); } void test_xml_two_connections_default() { @@ -116,7 +116,7 @@ public: TS_ASSERT_EQUALS(info.address(), "A"); TS_ASSERT_EQUALS(info.listener(), "L"); - TS_ASSERT_THROWS(inst.liveListenerInfo("n3"), std::runtime_error); + TS_ASSERT_THROWS(inst.liveListenerInfo("n3"), const std::runtime_error &); } void test_manual_construction() { diff --git a/Framework/Kernel/test/LogParserTest.h b/Framework/Kernel/test/LogParserTest.h index 055bb00cdc5..2aa7377411b 100644 --- a/Framework/Kernel/test/LogParserTest.h +++ b/Framework/Kernel/test/LogParserTest.h @@ -231,7 +231,7 @@ public: const auto &ti_dataLast = rv->first.to_tm(); TS_ASSERT_EQUALS(ti_dataLast.tm_hour, 14); TS_ASSERT_EQUALS(ti_dataLast.tm_min, 3); - TS_ASSERT_THROWS(timeMean(p1.get()), std::runtime_error); + TS_ASSERT_THROWS(timeMean(p1.get()), const std::runtime_error &); } // Test a variant of the log file containing CHANGE_PERIOD flags diff --git a/Framework/Kernel/test/MagneticIonTest.h b/Framework/Kernel/test/MagneticIonTest.h index a00ffb95d75..9f00b27b608 100644 --- a/Framework/Kernel/test/MagneticIonTest.h +++ b/Framework/Kernel/test/MagneticIonTest.h @@ -40,12 +40,12 @@ public: } void testErrors() { - TS_ASSERT_THROWS(getMagneticIon("O", 2), std::runtime_error); // no such ion + TS_ASSERT_THROWS(getMagneticIon("O", 2), const std::runtime_error &); // no such ion TS_ASSERT_THROWS(getMagneticIon("Am", 12), - std::runtime_error); // no such charge + const std::runtime_error &); // no such charge TS_ASSERT_THROWS(getJL("Am", 12), - std::runtime_error); // no such charge - pass to getJL - TS_ASSERT_THROWS(getJL("Am", 7, 3), std::runtime_error); // no such l + const std::runtime_error &); // no such charge - pass to getJL + TS_ASSERT_THROWS(getJL("Am", 7, 3), const std::runtime_error &); // no such l } void test_Copied_Object_Has_Same_Attributes() { diff --git a/Framework/Kernel/test/MaterialBuilderTest.h b/Framework/Kernel/test/MaterialBuilderTest.h index 6e4b0c0e9b6..ffc1ca54aa7 100644 --- a/Framework/Kernel/test/MaterialBuilderTest.h +++ b/Framework/Kernel/test/MaterialBuilderTest.h @@ -159,39 +159,39 @@ public: //---------------------------------------------------------------------------- void test_Empty_Name_Throws_Error_When_Set() { MaterialBuilder builder; - TS_ASSERT_THROWS(builder.setName(""), std::invalid_argument); + TS_ASSERT_THROWS(builder.setName(""), const std::invalid_argument &); } void test_Invalid_Formula_Throws_Error_When_Set() { MaterialBuilder builder; - TS_ASSERT_THROWS(builder.setFormula(""), std::invalid_argument); - TS_ASSERT_THROWS(builder.setFormula("Al-2"), std::invalid_argument); + TS_ASSERT_THROWS(builder.setFormula(""), const std::invalid_argument &); + TS_ASSERT_THROWS(builder.setFormula("Al-2"), const std::invalid_argument &); } void test_Setting_Neither_ChemicalFormula_And_AtomicNumber_Throws_Error() { MaterialBuilder builder; - TS_ASSERT_THROWS(builder.setName("Nickel").build(), std::runtime_error); + TS_ASSERT_THROWS(builder.setName("Nickel").build(), const std::runtime_error &); } void test_Setting_Both_ChemicalFormula_And_AtomicNumber_Throws_Error() { MaterialBuilder builder; TS_ASSERT_THROWS(builder.setFormula("Al2-O3").setAtomicNumber(28), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(builder.setAtomicNumber(28).setFormula("Al2-O3"), - std::runtime_error); + const std::runtime_error &); } void test_Setting_ZParameter_UnitCell_And_MassDensity_Throws_Error() { MaterialBuilder builder; TS_ASSERT_THROWS(builder.setMassDensity(4).setZParameter(6), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(builder.setMassDensity(4).setUnitCellVolume(250.), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(builder.setZParameter(6).setMassDensity(4), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(builder.setUnitCellVolume(6).setMassDensity(4), - std::runtime_error); + const std::runtime_error &); } void test_MultiAtom_with_no_number_density_throws() { @@ -210,7 +210,7 @@ public: .setCoherentXSection(0.5) .setIncoherentXSection(5.0) .setAbsorptionXSection(0.23); - TS_ASSERT_THROWS(builder.build(), std::runtime_error) + TS_ASSERT_THROWS(builder.build(), const std::runtime_error &) } void test_User_Defined_Material_Without_TotalScatterXSection_Throws() { @@ -219,7 +219,7 @@ public: .setCoherentXSection(0.5) .setIncoherentXSection(5.0) .setAbsorptionXSection(0.23); - TS_ASSERT_THROWS(builder.build(), std::runtime_error) + TS_ASSERT_THROWS(builder.build(), const std::runtime_error &) } void test_User_Defined_Material_Without_CoherentXSection_Throws() { @@ -228,7 +228,7 @@ public: .setTotalScatterXSection(2.3) .setIncoherentXSection(5.0) .setAbsorptionXSection(0.23); - TS_ASSERT_THROWS(builder.build(), std::runtime_error) + TS_ASSERT_THROWS(builder.build(), const std::runtime_error &) } void test_User_Defined_Material_Without_IncoherentXSection_Throws() { @@ -237,7 +237,7 @@ public: .setTotalScatterXSection(2.3) .setCoherentXSection(5.0) .setAbsorptionXSection(0.23); - TS_ASSERT_THROWS(builder.build(), std::runtime_error) + TS_ASSERT_THROWS(builder.build(), const std::runtime_error &) } void test_User_Defined_Material_Without_AbsorptionXSection_Throws() { @@ -246,7 +246,7 @@ public: .setTotalScatterXSection(2.3) .setCoherentXSection(5.0) .setIncoherentXSection(5.0); - TS_ASSERT_THROWS(builder.build(), std::runtime_error) + TS_ASSERT_THROWS(builder.build(), const std::runtime_error &) } }; diff --git a/Framework/Kernel/test/MaterialTest.h b/Framework/Kernel/test/MaterialTest.h index 37f2b37488d..bed1ce5732c 100644 --- a/Framework/Kernel/test/MaterialTest.h +++ b/Framework/Kernel/test/MaterialTest.h @@ -234,7 +234,7 @@ public: TS_ASSERT_EQUALS(cf[1].multiplicity, 1); TS_ASSERT_THROWS(cf = Material::parseChemicalFormula("H2*O"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_EQUALS(cf.size(), 2); TS_ASSERT_EQUALS(cf[0].atom->symbol, "H"); TS_ASSERT_EQUALS(cf[0].atom->a_number, 0); diff --git a/Framework/Kernel/test/MaterialXMLParserTest.h b/Framework/Kernel/test/MaterialXMLParserTest.h index c34c98beb30..8ee5c314adb 100644 --- a/Framework/Kernel/test/MaterialXMLParserTest.h +++ b/Framework/Kernel/test/MaterialXMLParserTest.h @@ -128,22 +128,22 @@ public: std::string xml; std::istringstream instream(xml); MaterialXMLParser parser; - TS_ASSERT_THROWS(parser.parse(instream), std::invalid_argument); + TS_ASSERT_THROWS(parser.parse(instream), const std::invalid_argument &); } void test_Missing_Or_Empty_Id_Tag_Throws_Error() { TS_ASSERT_THROWS(parseMaterial("<material formula=\"V\">" "</material>"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(parseMaterial("<material id=\"\" formula=\"V\">" "</material>"), - std::invalid_argument); + const std::invalid_argument &); } void test_Unknown_Attribute_Throws_Error() { TS_ASSERT_THROWS(parseMaterial("<material id=\"n\" atomic=\"28\">" "</material>"), - std::runtime_error); + const std::runtime_error &); } //---------------------------------------------------------------------------- diff --git a/Framework/Kernel/test/MatrixTest.h b/Framework/Kernel/test/MatrixTest.h index f7d448e6c36..730b6dd0a72 100644 --- a/Framework/Kernel/test/MatrixTest.h +++ b/Framework/Kernel/test/MatrixTest.h @@ -183,13 +183,13 @@ public: TSM_ASSERT_THROWS("building matrix by this construcor and data with wrong " "number of elements should throw", - (Matrix<double>(data)), std::invalid_argument); + (Matrix<double>(data)), const std::invalid_argument &); } void testFromVectorAndDimensions() { std::vector<int> data{1, 2, 3, 4, 5, 6}; TSM_ASSERT_THROWS("building matrix with worng dimension should fail", - (Matrix<int>(data, 4, 5)), std::invalid_argument); + (Matrix<int>(data, 4, 5)), const std::invalid_argument &); Matrix<int> myMat; TSM_ASSERT_THROWS_NOTHING("building matrix by this construcor and data " "with correct number of elements should not " @@ -307,11 +307,11 @@ public: DblMatrix rot; std::istringstream is; is.str("Matr(3,3)1,2,3,4,5,6,7,8,9"); - TS_ASSERT_THROWS(is >> rot, std::invalid_argument); + TS_ASSERT_THROWS(is >> rot, const std::invalid_argument &); is.str("Matrix3,3)1,2,3,4,5,6,7,8,9"); - TS_ASSERT_THROWS(is >> rot, std::invalid_argument); + TS_ASSERT_THROWS(is >> rot, const std::invalid_argument &); is.str("Matrix(3,31,2,3,4,5,6,7,8,9"); - TS_ASSERT_THROWS(is >> rot, std::invalid_argument); + TS_ASSERT_THROWS(is >> rot, const std::invalid_argument &); } void test_Input_Stream_On_Square_Matrix() { @@ -370,7 +370,7 @@ public: std::istringstream is; is.str("Matrix(3|3)1|2,3|4|5|6|7|8|9"); TS_ASSERT_THROWS(Mantid::Kernel::fillFromStream(is, rot, '|'), - std::invalid_argument); + const std::invalid_argument &); } void test_Construction_Non_Square_Matrix_From_Output_Stream() { @@ -451,11 +451,11 @@ public: DblMatrix M4(4, 4, true); TS_ASSERT_THROWS(M4.operator*(v), - Mantid::Kernel::Exception::MisMatch<size_t>); + const Mantid::Kernel::Exception::MisMatch<size_t> &); TS_ASSERT_THROWS(M4.operator*(stdvec), - Mantid::Kernel::Exception::MisMatch<size_t>); + const Mantid::Kernel::Exception::MisMatch<size_t> &); TS_ASSERT_THROWS(M4.multiplyPoint(stdvec, otherStdNewVec), - Mantid::Kernel::Exception::MisMatch<size_t>); + const Mantid::Kernel::Exception::MisMatch<size_t> &); DblMatrix M23 = boost::lexical_cast<DblMatrix>( "Matrix(2,3)-0.23,0.55,5.22,2.96,4.2,0.1"); @@ -480,7 +480,7 @@ public: DblMatrix M43 = boost::lexical_cast<DblMatrix>( "Matrix(4,3)-0.23,0.55,5.22,2.96,4.2,0.1,-0.23,0.55,5.22,2.96,4.2,0.1"); TS_ASSERT_THROWS(M43.operator*(v), - Mantid::Kernel::Exception::MisMatch<size_t>); // V3D only + const Mantid::Kernel::Exception::MisMatch<size_t> &); // V3D only } /// Test that the constructor taking preset sizes returns a zero matrix @@ -527,9 +527,9 @@ public: 7, -25, 8, 9, 42, -33, 15, 0}; DblMatrix original(data); TS_ASSERT_THROWS(DblMatrix badMat(original, nRows + 1, missingCol), - Mantid::Kernel::Exception::IndexError); + const Mantid::Kernel::Exception::IndexError &); TS_ASSERT_THROWS(DblMatrix badMat(original, missingRow, nCols + 1), - Mantid::Kernel::Exception::IndexError); + const Mantid::Kernel::Exception::IndexError &); DblMatrix mat(original, missingRow, missingCol); checkMatrixHasExpectedValuesForSquareMatrixTest(mat); } @@ -687,7 +687,8 @@ public: const std::vector<double> newCol{2, 5, 8}; DblMatrix mat(data); size_t badCol(3), goodCol(1); - TS_ASSERT_THROWS(mat.setColumn(badCol, newCol), std::invalid_argument); + TS_ASSERT_THROWS(mat.setColumn(badCol, newCol), + const std::invalid_argument &); mat.setColumn(goodCol, newCol); checkMatrixHasExpectedValuesForSquareMatrixTest(mat); } @@ -697,7 +698,7 @@ public: const std::vector<double> newRow{7, 8, 9}; DblMatrix mat(data); size_t badRow(3), goodRow(2); - TS_ASSERT_THROWS(mat.setRow(badRow, newRow), std::invalid_argument); + TS_ASSERT_THROWS(mat.setRow(badRow, newRow), const std::invalid_argument &); mat.setRow(goodRow, newRow); checkMatrixHasExpectedValuesForSquareMatrixTest(mat); } @@ -761,7 +762,8 @@ public: const std::vector<double> dataA{1, 2, 3, 4}, dataDiag{5, 6}, dataBad{5, 6, 7}; DblMatrix mat(dataA); - TS_ASSERT_THROWS(mat.preMultiplyByDiagonal(dataBad), std::runtime_error); + TS_ASSERT_THROWS(mat.preMultiplyByDiagonal(dataBad), + const std::runtime_error &); DblMatrix result = mat.preMultiplyByDiagonal(dataDiag); TS_ASSERT_EQUALS(result[0][0], 5); TS_ASSERT_EQUALS(result[0][1], 10); @@ -773,7 +775,8 @@ public: const std::vector<double> dataA{1, 2, 3, 4}, dataDiag{5, 6}, dataBad{5, 6, 7}; DblMatrix mat(dataA); - TS_ASSERT_THROWS(mat.postMultiplyByDiagonal(dataBad), std::runtime_error); + TS_ASSERT_THROWS(mat.postMultiplyByDiagonal(dataBad), + const std::runtime_error &); DblMatrix result = mat.postMultiplyByDiagonal(dataDiag); TS_ASSERT_EQUALS(result[0][0], 5); TS_ASSERT_EQUALS(result[0][1], 12); diff --git a/Framework/Kernel/test/NeutronAtomTest.h b/Framework/Kernel/test/NeutronAtomTest.h index cd69be769bc..d34e264bdd9 100644 --- a/Framework/Kernel/test/NeutronAtomTest.h +++ b/Framework/Kernel/test/NeutronAtomTest.h @@ -58,8 +58,8 @@ public: } void testError() { - TS_ASSERT_THROWS(getNeutronAtom(1, 15), std::runtime_error); - TS_ASSERT_THROWS(getNeutronAtom(97), std::runtime_error); + TS_ASSERT_THROWS(getNeutronAtom(1, 15), const std::runtime_error &); + TS_ASSERT_THROWS(getNeutronAtom(97), const std::runtime_error &); } }; diff --git a/Framework/Kernel/test/NexusDescriptorTest.h b/Framework/Kernel/test/NexusDescriptorTest.h index a6fb0553ff4..4715f36e604 100644 --- a/Framework/Kernel/test/NexusDescriptorTest.h +++ b/Framework/Kernel/test/NexusDescriptorTest.h @@ -93,7 +93,7 @@ public: } void test_isHDF_Throws_With_Invalid_Filename() { - TS_ASSERT_THROWS(NexusDescriptor::isHDF(""), std::invalid_argument); + TS_ASSERT_THROWS(NexusDescriptor::isHDF(""), const std::invalid_argument &); } //=================================== NexusDescriptor methods @@ -105,17 +105,17 @@ public: } void test_Constructor_Throws_With_Empty_filename() { - TS_ASSERT_THROWS(NexusDescriptor(""), std::invalid_argument); + TS_ASSERT_THROWS(NexusDescriptor(""), const std::invalid_argument &); } void test_Constructor_Throws_With_NonExistant_filename() { TS_ASSERT_THROWS(NexusDescriptor("__ThisShouldBeANonExistantFile.txt"), - std::invalid_argument); + const std::invalid_argument &); } void test_Constructor_Throws_When_Given_File_Not_Identified_As_HDF() { TS_ASSERT_THROWS(NexusDescriptor fd(m_testNonHDFPath), - std::invalid_argument); + const std::invalid_argument &); } void test_File_Handle_Returned_By_Data_Is_Valid() { diff --git a/Framework/Kernel/test/OptionalBoolTest.h b/Framework/Kernel/test/OptionalBoolTest.h index 190746330fa..ec3cfbe417b 100644 --- a/Framework/Kernel/test/OptionalBoolTest.h +++ b/Framework/Kernel/test/OptionalBoolTest.h @@ -131,10 +131,10 @@ public: } void testEncodeOptionalBoolPropertyThrows() { - using Mantid::Kernel::Exception::NotImplementedError; using Mantid::Kernel::OptionalBool; + using Mantid::Kernel::Exception::NotImplementedError; OptionalBool truth{OptionalBool::True}; - TS_ASSERT_THROWS(encodeAsJson(truth), NotImplementedError); + TS_ASSERT_THROWS(encodeAsJson(truth), const NotImplementedError &); } }; diff --git a/Framework/Kernel/test/PropertyManagerDataServiceTest.h b/Framework/Kernel/test/PropertyManagerDataServiceTest.h index fbef96affce..47becf55976 100644 --- a/Framework/Kernel/test/PropertyManagerDataServiceTest.h +++ b/Framework/Kernel/test/PropertyManagerDataServiceTest.h @@ -30,7 +30,7 @@ public: void testAdd() { // Adding an Instrument with empty name should throw TS_ASSERT_THROWS(PropertyManagerDataService::Instance().add("", inst1), - std::runtime_error); + const std::runtime_error &); // This should not throw, valid name TS_ASSERT_THROWS_NOTHING( PropertyManagerDataService::Instance().add("inst1", inst1)); @@ -40,7 +40,7 @@ public: // AddorReplace an Instrument with empty name should throw TS_ASSERT_THROWS( PropertyManagerDataService::Instance().addOrReplace("", inst2), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS_NOTHING( PropertyManagerDataService::Instance().addOrReplace("inst2", inst2)); TS_ASSERT_EQUALS(inst2.use_count(), 2); @@ -69,7 +69,7 @@ public: // Should throw if the instrument can not be retrieved TS_ASSERT_THROWS( PropertyManagerDataService::Instance().retrieve("notregistered"), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void testRemove() { // Removing a non-existing data Object should give a warning in the Log but diff --git a/Framework/Kernel/test/PropertyManagerPropertyTest.h b/Framework/Kernel/test/PropertyManagerPropertyTest.h index 0b8d08611fa..077824725f0 100644 --- a/Framework/Kernel/test/PropertyManagerPropertyTest.h +++ b/Framework/Kernel/test/PropertyManagerPropertyTest.h @@ -241,7 +241,7 @@ public: // Failure tests //---------------------------------------------------------------------------- void test_Empty_Name_Is_Not_Accepted() { - TS_ASSERT_THROWS(PropertyManagerProperty(""), std::invalid_argument); + TS_ASSERT_THROWS(PropertyManagerProperty(""), const std::invalid_argument &); } void test_String_Not_Holding_Valid_Json_or_Global_PM_Name_Returns_Error() { diff --git a/Framework/Kernel/test/PropertyManagerTest.h b/Framework/Kernel/test/PropertyManagerTest.h index 47595e48adf..57c6b8ce835 100644 --- a/Framework/Kernel/test/PropertyManagerTest.h +++ b/Framework/Kernel/test/PropertyManagerTest.h @@ -161,11 +161,11 @@ public: std::string("9.99")); TS_ASSERT_THROWS(mgr.declareProperty(std::move(copy)), - Exception::ExistsError); + const Exception::ExistsError &); TS_ASSERT_THROWS( mgr.declareProperty( Mantid::Kernel::make_unique<PropertyWithValue<int>>("", 0)), - std::invalid_argument); + const std::invalid_argument &); mgr.declareProperty( Mantid::Kernel::make_unique<PropertyWithValue<int>>("GoodIntProp", 1), "Test doc"); @@ -177,8 +177,9 @@ public: PropertyManagerHelper mgr; TS_ASSERT_THROWS_NOTHING(mgr.declareProperty("myProp", 1)); TS_ASSERT(!mgr.getPropertyValue("myProp").compare("1")); - TS_ASSERT_THROWS(mgr.declareProperty("MYPROP", 5), Exception::ExistsError); - TS_ASSERT_THROWS(mgr.declareProperty("", 5), std::invalid_argument); + TS_ASSERT_THROWS(mgr.declareProperty("MYPROP", 5), + const Exception::ExistsError &); + TS_ASSERT_THROWS(mgr.declareProperty("", 5), const std::invalid_argument &); } void testdeclareProperty_double() { @@ -198,8 +199,9 @@ public: TS_ASSERT_EQUALS(mgr.getPointerToProperty("withDoc")->documentation(), "Test doc doub"); TS_ASSERT_THROWS(mgr.declareProperty("MYPROP", 5.5), - Exception::ExistsError); - TS_ASSERT_THROWS(mgr.declareProperty("", 5.5), std::invalid_argument); + const Exception::ExistsError &); + TS_ASSERT_THROWS(mgr.declareProperty("", 5.5), + const std::invalid_argument &); } void testdeclareProperty_string() { @@ -213,8 +215,9 @@ public: TS_ASSERT_EQUALS(p->documentation(), "hello"); TS_ASSERT_THROWS(mgr.declareProperty("MYPROP", "aValue"), - Exception::ExistsError); - TS_ASSERT_THROWS(mgr.declareProperty("", "aValue"), std::invalid_argument); + const Exception::ExistsError &); + TS_ASSERT_THROWS(mgr.declareProperty("", "aValue"), + const std::invalid_argument &); } void testDeclareOrReplaceProperty() { @@ -300,17 +303,17 @@ public: TS_ASSERT(!manager->getPropertyValue("aProp").compare("10")); manager->setPropertyValue("aProp", "1"); TS_ASSERT_THROWS(manager->setPropertyValue("fhfjsdf", "0"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void testSetProperty() { TS_ASSERT_THROWS_NOTHING(manager->setProperty("AProp", 5)); TS_ASSERT_THROWS(manager->setProperty("wefhui", 5), - Exception::NotFoundError); + const Exception::NotFoundError &); TS_ASSERT_THROWS(manager->setProperty("APROP", 5.55), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(manager->setProperty("APROP", "value"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(manager->setProperty("AProp", 1)); } @@ -353,7 +356,7 @@ public: void testGetPropertyValue() { TS_ASSERT(!manager->getPropertyValue("APROP").compare("1")); TS_ASSERT_THROWS(manager->getPropertyValue("sdfshdu"), - Exception::NotFoundError); + const Exception::NotFoundError &); } void testGetProperty() { @@ -365,13 +368,14 @@ public: TS_ASSERT(typeid(int) == *p->type_info()); TS_ASSERT_THROWS(p = manager->getProperty("werhui"), - Exception::NotFoundError); + const Exception::NotFoundError &); int i(0); TS_ASSERT_THROWS_NOTHING(i = manager->getProperty("aprop")); TS_ASSERT_EQUALS(i, 1); double dd(0.0); - TS_ASSERT_THROWS(dd = manager->getProperty("aprop"), std::runtime_error); + TS_ASSERT_THROWS(dd = manager->getProperty("aprop"), + const std::runtime_error &); TS_ASSERT_EQUALS(dd, 0.0); // If dd is bot used you get a compiler warning std::string s = manager->getProperty("aprop"); TS_ASSERT(!s.compare("1")); @@ -380,7 +384,7 @@ public: TS_ASSERT_EQUALS(d, 1.11); int ii(0); TS_ASSERT_THROWS(ii = manager->getProperty("anotherprop"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_EQUALS(ii, 0); // Compiler warning if ii is not used std::string ss = manager->getProperty("anotherprop"); // Note that some versions of boost::lexical_cast > 1.34 give a string such diff --git a/Framework/Kernel/test/PropertyTest.h b/Framework/Kernel/test/PropertyTest.h index 8cb63837b7e..bfc19738634 100644 --- a/Framework/Kernel/test/PropertyTest.h +++ b/Framework/Kernel/test/PropertyTest.h @@ -46,7 +46,7 @@ public: void testName() { TS_ASSERT(!p->name().compare("Test")); } void testEmptyNameNotPermitted() { - TS_ASSERT_THROWS(PropertyHelper(""), std::invalid_argument); + TS_ASSERT_THROWS(PropertyHelper(""), const std::invalid_argument &); } void testDocumentation() { diff --git a/Framework/Kernel/test/PropertyWithValueJSONTest.h b/Framework/Kernel/test/PropertyWithValueJSONTest.h index 381993072b5..bd783446e9a 100644 --- a/Framework/Kernel/test/PropertyWithValueJSONTest.h +++ b/Framework/Kernel/test/PropertyWithValueJSONTest.h @@ -140,7 +140,7 @@ public: Json::Value root; TSM_ASSERT_THROWS("Expected decode to throw for empty value", decodeAsProperty("NullValue", root), - std::invalid_argument); + const std::invalid_argument &); } void testDecodeAsPropertyEmptyArrayValueThrows() { @@ -150,7 +150,7 @@ public: using Mantid::Kernel::decodeAsProperty; TSM_ASSERT_THROWS("Expected an empty json array to throw", decodeAsProperty("EmptyArray", root), - std::invalid_argument); + const std::invalid_argument &); } void testDecodeAsPropertyHeterogenousArrayValueThrows() { @@ -162,7 +162,7 @@ public: using Mantid::Kernel::decodeAsProperty; TSM_ASSERT_THROWS("Expected an empty json array to throw", decodeAsProperty("Mixed", mixedArray), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/Kernel/test/PropertyWithValueTest.h b/Framework/Kernel/test/PropertyWithValueTest.h index 3205644aa57..92dfeddf0ba 100644 --- a/Framework/Kernel/test/PropertyWithValueTest.h +++ b/Framework/Kernel/test/PropertyWithValueTest.h @@ -680,7 +680,7 @@ public: std::string value = prop; TS_ASSERT_EQUALS(value, "Hello"); - TS_ASSERT_THROWS(prop = "Mantid", std::invalid_argument); + TS_ASSERT_THROWS(prop = "Mantid", const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(prop = "1"); value = prop; diff --git a/Framework/Kernel/test/SLSQPMinimizerTest.h b/Framework/Kernel/test/SLSQPMinimizerTest.h index 0b399c7379c..1a6fc47ba6f 100644 --- a/Framework/Kernel/test/SLSQPMinimizerTest.h +++ b/Framework/Kernel/test/SLSQPMinimizerTest.h @@ -42,11 +42,11 @@ public: ObjFunction userFunc; TS_ASSERT_THROWS(SLSQPMinimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); equality = DblMatrix(1, nparams - 1); // cols < number parameters TS_ASSERT_THROWS(SLSQPMinimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); } void @@ -60,11 +60,11 @@ public: ObjFunction userFunc; TS_ASSERT_THROWS(SLSQPMinimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); inequality = DblMatrix(1, nparams - 1); // cols < number parameters TS_ASSERT_THROWS(SLSQPMinimizer(nparams, userFunc, equality, inequality), - std::invalid_argument); + const std::invalid_argument &); } void test_minimizer_calls_user_function() { diff --git a/Framework/Kernel/test/StatisticsTest.h b/Framework/Kernel/test/StatisticsTest.h index 1b6721fbaf8..aa1b6593572 100644 --- a/Framework/Kernel/test/StatisticsTest.h +++ b/Framework/Kernel/test/StatisticsTest.h @@ -254,7 +254,7 @@ public: // just declare so we can have test of exception handling vector<double> y; - TS_ASSERT_THROWS(getMomentsAboutOrigin(x, y), std::out_of_range); + TS_ASSERT_THROWS(getMomentsAboutOrigin(x, y), const std::out_of_range &); // now calculate the y-values for (size_t i = 0; i < numX; ++i) { diff --git a/Framework/Kernel/test/StringsTest.h b/Framework/Kernel/test/StringsTest.h index 2910b8c5f24..d0bb36184f8 100644 --- a/Framework/Kernel/test/StringsTest.h +++ b/Framework/Kernel/test/StringsTest.h @@ -120,7 +120,7 @@ public: TSM_ASSERT_EQUALS("should return empty path", 0, result.size()); TSM_ASSERT_THROWS(" this path should go out of range", split_path("/aaaa\\bbbbb/../../../", result), - std::invalid_argument); + const std::invalid_argument &); } void testSkipLine() { TS_ASSERT(skipLine("#blah blah")); diff --git a/Framework/Kernel/test/ThreadPoolRunnableTest.h b/Framework/Kernel/test/ThreadPoolRunnableTest.h index 8d78ae88079..6fb7f89821a 100644 --- a/Framework/Kernel/test/ThreadPoolRunnableTest.h +++ b/Framework/Kernel/test/ThreadPoolRunnableTest.h @@ -21,7 +21,7 @@ int ThreadPoolRunnableTest_value; class ThreadPoolRunnableTest : public CxxTest::TestSuite { public: void test_constructor() { - TS_ASSERT_THROWS(new ThreadPoolRunnable(0, nullptr), std::invalid_argument); + TS_ASSERT_THROWS(new ThreadPoolRunnable(0, nullptr), const std::invalid_argument &); } //======================================================================================= diff --git a/Framework/Kernel/test/ThreadPoolTest.h b/Framework/Kernel/test/ThreadPoolTest.h index f61d9afcbbb..d60289da1e1 100644 --- a/Framework/Kernel/test/ThreadPoolTest.h +++ b/Framework/Kernel/test/ThreadPoolTest.h @@ -432,7 +432,7 @@ public: p.schedule(new TaskThatThrows()); } // joinAll rethrows - TS_ASSERT_THROWS(p.joinAll(), std::runtime_error); + TS_ASSERT_THROWS(p.joinAll(), const std::runtime_error &); // And only one of the tasks actually ran (since we're on one core) TS_ASSERT_EQUALS(ThreadPoolTest_TaskThatThrows_counter, 1); } diff --git a/Framework/Kernel/test/TimeSeriesPropertyTest.h b/Framework/Kernel/test/TimeSeriesPropertyTest.h index 094e0e830d9..a3021375450 100644 --- a/Framework/Kernel/test/TimeSeriesPropertyTest.h +++ b/Framework/Kernel/test/TimeSeriesPropertyTest.h @@ -83,18 +83,18 @@ public: } void test_SetValueFromString() { - TS_ASSERT_THROWS(iProp->setValue("1"), Exception::NotImplementedError); - TS_ASSERT_THROWS(dProp->setValue("5.5"), Exception::NotImplementedError); - TS_ASSERT_THROWS(sProp->setValue("aValue"), Exception::NotImplementedError); + TS_ASSERT_THROWS(iProp->setValue("1"), const Exception::NotImplementedError &); + TS_ASSERT_THROWS(dProp->setValue("5.5"), const Exception::NotImplementedError &); + TS_ASSERT_THROWS(sProp->setValue("aValue"), const Exception::NotImplementedError &); } void test_SetValueFromJson() { TS_ASSERT_THROWS(iProp->setValueFromJson(Json::Value(1)), - Exception::NotImplementedError); + const Exception::NotImplementedError &); TS_ASSERT_THROWS(dProp->setValueFromJson(Json::Value(5.5)), - Exception::NotImplementedError); + const Exception::NotImplementedError &); TS_ASSERT_THROWS(sProp->setValueFromJson(Json::Value("aValue")), - Exception::NotImplementedError); + const Exception::NotImplementedError &); } void test_AddValue() { @@ -157,12 +157,12 @@ public: TS_ASSERT_EQUALS(derValues[2], 1); TSM_ASSERT_THROWS("derivative undefined for string property", - sProp->getDerivative(), std::runtime_error); + sProp->getDerivative(), const std::runtime_error &); iProp->addValue("2007-11-30T16:17:10", 10); TSM_ASSERT_THROWS( "derivative undefined for property with less then 2 values", - iProp->getDerivative(), std::runtime_error); + iProp->getDerivative(), const std::runtime_error &); iProp->addValue("2007-11-30T16:17:12", 12); derProp = iProp->getDerivative(); @@ -471,7 +471,7 @@ public: // Check throws if min > max TS_ASSERT_THROWS(log->makeFilterByValue(splitter, 2.0, 1.0, 0.0, true), - std::invalid_argument); + const std::invalid_argument &); delete log; } @@ -480,7 +480,7 @@ public: TimeSeriesProperty<std::string> log("StringTSP"); TimeSplitterType splitter; TS_ASSERT_THROWS(log.makeFilterByValue(splitter, 0.0, 0.0, 0.0, true), - Exception::NotImplementedError); + const Exception::NotImplementedError &); } void test_expandFilterToRange() { @@ -543,7 +543,7 @@ public: // Check throws if min > max TS_ASSERT_THROWS(log.expandFilterToRange(splitter, 2.0, 1.0, interval), - std::invalid_argument); + const std::invalid_argument &); // Test good at both ends, but interval narrower than log range TimeInterval narrowinterval(DateAndTime("2007-11-30T16:17:15"), @@ -562,7 +562,7 @@ public: TimeSplitterType splitter; TS_ASSERT_THROWS( log.expandFilterToRange(splitter, 0.0, 0.0, TimeInterval()), - Exception::NotImplementedError); + const Exception::NotImplementedError &); } void test_averageValueInFilter() { @@ -643,9 +643,9 @@ public: void test_averageValueInFilter_throws_for_string_property() { TimeSplitterType splitter; TS_ASSERT_THROWS(sProp->averageValueInFilter(splitter), - Exception::NotImplementedError); + const Exception::NotImplementedError &); TS_ASSERT_THROWS(sProp->averageAndStdDevInFilter(splitter), - Exception::NotImplementedError); + const Exception::NotImplementedError &); } //---------------------------------------------------------------------------- @@ -1154,9 +1154,9 @@ public: const TimeSeriesProperty<int> empty("Empty"); DateAndTime time("2013-01-30T16:17:23"); - TS_ASSERT_THROWS(empty.getSingleValue(time), std::runtime_error); + TS_ASSERT_THROWS(empty.getSingleValue(time), const std::runtime_error &); int i; - TS_ASSERT_THROWS(empty.getSingleValue(time, i), std::runtime_error); + TS_ASSERT_THROWS(empty.getSingleValue(time, i), const std::runtime_error &); } void test_firstLastTimeValue() { @@ -1185,10 +1185,10 @@ public: void test_firstLastTimeValue_emptyPropertyThrows() { const TimeSeriesProperty<int> empty("Empty"); - TS_ASSERT_THROWS(empty.firstTime(), std::runtime_error); - TS_ASSERT_THROWS(empty.lastTime(), std::runtime_error); - TS_ASSERT_THROWS(empty.firstValue(), std::runtime_error); - TS_ASSERT_THROWS(empty.lastValue(), std::runtime_error); + TS_ASSERT_THROWS(empty.firstTime(), const std::runtime_error &); + TS_ASSERT_THROWS(empty.lastTime(), const std::runtime_error &); + TS_ASSERT_THROWS(empty.firstValue(), const std::runtime_error &); + TS_ASSERT_THROWS(empty.lastValue(), const std::runtime_error &); } void test_min_max_value() { @@ -1756,7 +1756,7 @@ public: new TimeSeriesProperty<double>("doubleProp"); // 1. Test Throws - TS_ASSERT_THROWS(p->nthTime(1), std::runtime_error); + TS_ASSERT_THROWS(p->nthTime(1), const std::runtime_error &); // 2. Add entries TS_ASSERT_THROWS_NOTHING(p->addValue("2007-11-30T16:17:00", 1.00)); @@ -1800,7 +1800,7 @@ public: new TimeSeriesProperty<double>("doubleProp"); // 1. Test Throws - TS_ASSERT_THROWS(p->nthInterval(0), std::runtime_error); + TS_ASSERT_THROWS(p->nthInterval(0), const std::runtime_error &); // 2. Add entries TS_ASSERT_THROWS_NOTHING(p->addValue("2007-11-30T16:17:00", 1.00)); diff --git a/Framework/Kernel/test/TimeSplitterTest.h b/Framework/Kernel/test/TimeSplitterTest.h index a302b705080..1f7d4281d6c 100644 --- a/Framework/Kernel/test/TimeSplitterTest.h +++ b/Framework/Kernel/test/TimeSplitterTest.h @@ -143,14 +143,14 @@ public: stop_b = DateAndTime("2007-11-30T16:17:02"); b = SplittingInterval(start_b, stop_b, 0); TS_ASSERT(!a.overlaps(b)); - TS_ASSERT_THROWS(c = a | b;, std::invalid_argument); + TS_ASSERT_THROWS(c = a | b;, const std::invalid_argument &); // No overlap (a < b) start_b = DateAndTime("2007-11-30T16:17:30"); stop_b = DateAndTime("2007-11-30T16:17:42"); b = SplittingInterval(start_b, stop_b, 0); TS_ASSERT(!a.overlaps(b)); - TS_ASSERT_THROWS(c = a | b;, std::invalid_argument); + TS_ASSERT_THROWS(c = a | b;, const std::invalid_argument &); } //---------------------------------------------------------------------------- @@ -474,7 +474,7 @@ public: TS_ASSERT_EQUALS(i.index(), 2); // This fails since you can't add splitters together - TS_ASSERT_THROWS(b + b, std::invalid_argument); + TS_ASSERT_THROWS(b + b, const std::invalid_argument &); } //---------------------------------------------------------------------------- diff --git a/Framework/Kernel/test/UnitConversionTest.h b/Framework/Kernel/test/UnitConversionTest.h index eb050b19e79..812100fd57d 100644 --- a/Framework/Kernel/test/UnitConversionTest.h +++ b/Framework/Kernel/test/UnitConversionTest.h @@ -26,7 +26,7 @@ public: using Mantid::Kernel::DeltaEMode; TS_ASSERT_THROWS(UnitConversion::run("zxzxz", "Wavelength", 0.0, 0.0, 0.0, 0.0, DeltaEMode::Elastic, 0.0), - NotFoundError); + const NotFoundError &); } void test_Run_Throws_When_Dest_Unit_Is_Unknown() { @@ -34,7 +34,7 @@ public: using Mantid::Kernel::DeltaEMode; TS_ASSERT_THROWS(UnitConversion::run("Wavelength", "xszfsdf", 0.0, 0.0, 0.0, 0.0, DeltaEMode::Elastic, 0.0), - NotFoundError); + const NotFoundError &); } void diff --git a/Framework/Kernel/test/UnitFactoryTest.h b/Framework/Kernel/test/UnitFactoryTest.h index 75814f58241..3e2838c9f3e 100644 --- a/Framework/Kernel/test/UnitFactoryTest.h +++ b/Framework/Kernel/test/UnitFactoryTest.h @@ -27,7 +27,7 @@ public: void test_Create_With_Unknown_Unit_Throws_Exception() { TS_ASSERT_THROWS(UnitFactory::Instance().create("_NOT_A_REAL_UNIT"), - Exception::NotFoundError); + const Exception::NotFoundError &); } }; diff --git a/Framework/Kernel/test/UnitTest.h b/Framework/Kernel/test/UnitTest.h index 14ec629a60f..3b274421ded 100644 --- a/Framework/Kernel/test/UnitTest.h +++ b/Framework/Kernel/test/UnitTest.h @@ -850,7 +850,7 @@ public: // emode = 0 TS_ASSERT_THROWS(dE.toTOF(x, y, 1.5, 2.5, 0.0, 0, 4.0, 0.0), - std::invalid_argument) + const std::invalid_argument &) } void testDeltaE_fromTOF() { @@ -867,7 +867,7 @@ public: // emode = 0 TS_ASSERT_THROWS(dE.fromTOF(x, y, 1.5, 2.5, 0.0, 0, 4.0, 0.0), - std::invalid_argument) + const std::invalid_argument &) } void testDERange() { std::vector<double> sample, rezult; @@ -948,7 +948,7 @@ public: // emode = 0 TS_ASSERT_THROWS(dEk.toTOF(x, y, 1.5, 2.5, 0.0, 0, 4.0, 0.0), - std::invalid_argument) + const std::invalid_argument &) } void testDeltaEk_fromTOF() { @@ -965,7 +965,7 @@ public: // emode = 0 TS_ASSERT_THROWS(dEk.fromTOF(x, y, 1.5, 2.5, 0.0, 0, 4.0, 0.0), - std::invalid_argument) + const std::invalid_argument &) } void testDE_kRange() { std::vector<double> sample, rezult; @@ -1046,7 +1046,7 @@ public: // emode = 0 TS_ASSERT_THROWS(dEf.toTOF(x, y, 1.5, 2.5, 0.0, 0, 4.0, 0.0), - std::invalid_argument) + const std::invalid_argument &) } void testDeltaEf_fromTOF() { @@ -1063,7 +1063,7 @@ public: // emode = 0 TS_ASSERT_THROWS(dEf.fromTOF(x, y, 1.5, 2.5, 0.0, 0, 4.0, 0.0), - std::invalid_argument) + const std::invalid_argument &) } void testDE_fRange() { @@ -1407,11 +1407,11 @@ public: } void test_that_singleToTOF_throws_for_the_Degrees_unit() { - TS_ASSERT_THROWS(degrees.singleToTOF(1.0), std::runtime_error); + TS_ASSERT_THROWS(degrees.singleToTOF(1.0), const std::runtime_error &); } void test_that_singleFromTOF_throws_for_the_Degrees_unit() { - TS_ASSERT_THROWS(degrees.singleFromTOF(1.0), std::runtime_error); + TS_ASSERT_THROWS(degrees.singleFromTOF(1.0), const std::runtime_error &); } //---------------------------------------------------------------------- @@ -1433,11 +1433,12 @@ public: } void test_that_singleToTOF_throws_for_the_TemperatureKelvin_unit() { - TS_ASSERT_THROWS(temperature.singleToTOF(1.0), std::runtime_error); + TS_ASSERT_THROWS(temperature.singleToTOF(1.0), const std::runtime_error &); } void test_that_singleFromTOF_throws_for_the_TemperatureKelvin_unit() { - TS_ASSERT_THROWS(temperature.singleFromTOF(1.0), std::runtime_error); + TS_ASSERT_THROWS(temperature.singleFromTOF(1.0), + const std::runtime_error &); } //---------------------------------------------------------------------- diff --git a/Framework/Kernel/test/V3DTest.h b/Framework/Kernel/test/V3DTest.h index f5b6bfd8fb9..f9fedd509bf 100644 --- a/Framework/Kernel/test/V3DTest.h +++ b/Framework/Kernel/test/V3DTest.h @@ -468,7 +468,7 @@ public: void test_toCrystllographic() { V3D a0; - TS_ASSERT_THROWS(a0.toMillerIndexes(), std::invalid_argument); + TS_ASSERT_THROWS(a0.toMillerIndexes(), const std::invalid_argument &); V3D a1(0.1, 0.2, 5); TS_ASSERT_THROWS_NOTHING(a1.toMillerIndexes()); diff --git a/Framework/Kernel/test/VectorHelperTest.h b/Framework/Kernel/test/VectorHelperTest.h index dfa6af9609c..ee3c39239e2 100644 --- a/Framework/Kernel/test/VectorHelperTest.h +++ b/Framework/Kernel/test/VectorHelperTest.h @@ -170,21 +170,21 @@ public: const std::vector<double> rbParams = {1.0}; std::vector<double> axis; TS_ASSERT_THROWS(VectorHelper::createAxisFromRebinParams(rbParams, axis), - const std::runtime_error) + const std::runtime_error &) } void test_createAxisFromRebinParams_throwsOnInfiniteVal() { const std::vector<double> params = {1.0, INFINITY}; std::vector<double> axis; TS_ASSERT_THROWS(VectorHelper::createAxisFromRebinParams(params, axis), - const std::runtime_error); + const std::runtime_error &); } void test_createAxisFromRebinParams_throwsOnNaNVal() { const std::vector<double> params = {1.0, NAN}; std::vector<double> axis; TS_ASSERT_THROWS(VectorHelper::createAxisFromRebinParams(params, axis), - const std::runtime_error); + const std::runtime_error &); } void test_CreateAxisFromRebinParams_xMinXMaxHints() { @@ -331,19 +331,6 @@ public: TS_ASSERT_EQUALS(y.size(), 2); } - // TODO: Figure out proper behavior if given stupidity as inputs - // void test_splitStringIntoVector_badNumber_gives0() - // { - // std::vector<int> vec; - // vec = VectorHelper::splitStringIntoVector<int>("2, monkey, potato, - // 134"); - // TS_ASSERT_EQUALS( vec.size(), 4); - // TS_ASSERT_EQUALS( vec[0], 2); - // TS_ASSERT_EQUALS( vec[1], 0); - // TS_ASSERT_EQUALS( vec[2], 0); - // TS_ASSERT_EQUALS( vec[3], 134); - // } - void test_getBinIndex_Returns_Zero_For_Value_Lower_Than_Input_Range() { const double testValue = m_test_bins.front() - 1.1; int index(-1); @@ -410,7 +397,7 @@ public: std::vector<double> output; TS_ASSERT_THROWS( VectorHelper::smoothInRange(inputData, output, 6, &inputBoundaries), - std::invalid_argument); + const std::invalid_argument &); inputBoundaries.push_back(6); VectorHelper::smoothInRange(inputData, output, 6, &inputBoundaries); diff --git a/Framework/LiveData/src/ISIS/DAE/isisds_command.cpp b/Framework/LiveData/src/ISIS/DAE/isisds_command.cpp index aaa352571e9..a1c3674a36d 100644 --- a/Framework/LiveData/src/ISIS/DAE/isisds_command.cpp +++ b/Framework/LiveData/src/ISIS/DAE/isisds_command.cpp @@ -290,8 +290,9 @@ static int isisds_recv_command_helper(SOCKET s, char **command, void **data, return -1; } *command = reinterpret_cast<char *>(malloc(sizeof(comm.command) + 1)); - strncpy(*command, comm.command, sizeof(comm.command)); - (*command)[sizeof(comm.command)] = '\0'; + const auto commCommandSize = sizeof(comm.command); + strncpy(*command, comm.command, commCommandSize); + (*command)[commCommandSize] = '\0'; len_data = comm.len - sizeof(comm); /* in bytes */ if (len_data < 0) { return -1; /* error */ diff --git a/Framework/LiveData/test/FileEventDataListenerTest.h b/Framework/LiveData/test/FileEventDataListenerTest.h index 811202bd6ce..1499b59d57a 100644 --- a/Framework/LiveData/test/FileEventDataListenerTest.h +++ b/Framework/LiveData/test/FileEventDataListenerTest.h @@ -75,7 +75,7 @@ public: TS_ASSERT_EQUALS(listener->runStatus(), ILiveListener::EndRun) // Calling it again will throw as it's the end of the file - TS_ASSERT_THROWS(listener->extractData(), std::runtime_error) + TS_ASSERT_THROWS(listener->extractData(), const std::runtime_error &) } }; diff --git a/Framework/LiveData/test/ISISHistoDataListenerTest.h b/Framework/LiveData/test/ISISHistoDataListenerTest.h index a48de9c566b..677f550310a 100644 --- a/Framework/LiveData/test/ISISHistoDataListenerTest.h +++ b/Framework/LiveData/test/ISISHistoDataListenerTest.h @@ -387,7 +387,7 @@ public: return; TS_ASSERT_THROWS(auto outWS = listener->extractData(), - std::invalid_argument); + const std::invalid_argument &); dae.cancel(); res.wait(); @@ -417,7 +417,7 @@ public: TS_ASSERT_THROWS(auto listener = Mantid::API::LiveListenerFactory::Instance().create( "TESTHISTOLISTENER", true, &alg), - std::invalid_argument); + const std::invalid_argument &); dae.cancel(); res.wait(); diff --git a/Framework/LiveData/test/KafkaEventStreamDecoderTest.h b/Framework/LiveData/test/KafkaEventStreamDecoderTest.h index 45a51fc6c9f..318a7b2a30f 100644 --- a/Framework/LiveData/test/KafkaEventStreamDecoderTest.h +++ b/Framework/LiveData/test/KafkaEventStreamDecoderTest.h @@ -375,7 +375,7 @@ public: auto decoder = createTestDecoder(mockBroker); startCapturing(*decoder, 1); - TS_ASSERT_THROWS(decoder->extractData(), std::runtime_error); + TS_ASSERT_THROWS(decoder->extractData(), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(decoder->stopCapture()); TS_ASSERT(!decoder->isCapturing()); } @@ -393,7 +393,7 @@ public: auto decoder = createTestDecoder(mockBroker); startCapturing(*decoder, 1); - TS_ASSERT_THROWS(decoder->extractData(), std::runtime_error); + TS_ASSERT_THROWS(decoder->extractData(), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(decoder->stopCapture()); TS_ASSERT(!decoder->isCapturing()); } @@ -410,7 +410,7 @@ public: .WillOnce(Return(new FakeISISSpDetStreamSubscriber)); auto decoder = createTestDecoder(mockBroker); startCapturing(*decoder, 1); - TS_ASSERT_THROWS(decoder->extractData(), std::runtime_error); + TS_ASSERT_THROWS(decoder->extractData(), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(decoder->stopCapture()); TS_ASSERT(!decoder->isCapturing()); } diff --git a/Framework/MDAlgorithms/test/CachedExperimentInfoTest.h b/Framework/MDAlgorithms/test/CachedExperimentInfoTest.h index 28878a1be2e..a01529ce9b0 100644 --- a/Framework/MDAlgorithms/test/CachedExperimentInfoTest.h +++ b/Framework/MDAlgorithms/test/CachedExperimentInfoTest.h @@ -50,24 +50,24 @@ public: void test_trying_to_construct_object_with_unknown_id_throws_exception() { // createEmptyExptInfo(); auto expt = boost::make_shared<Mantid::API::ExperimentInfo>(); - TS_ASSERT_THROWS(CachedExperimentInfo(*expt, 1000), std::out_of_range); + TS_ASSERT_THROWS(CachedExperimentInfo(*expt, 1000), const std::out_of_range &); } void test_trying_to_construct_object_with_no_chopper_throws() { TS_ASSERT_THROWS(createTestCachedExperimentInfo(NoChopper), - std::invalid_argument); + const std::invalid_argument &); } void test_trying_to_construct_object_with_no_aperature_throws() { TS_ASSERT_THROWS(createTestCachedExperimentInfo(WithChopper, NoAperture), - std::invalid_argument); + const std::invalid_argument &); } void test_trying_to_construct_object_with_no_det_shape_throws() { TS_ASSERT_THROWS(createTestCachedExperimentInfo(WithChopper, WithAperture, DeltaEMode::Direct, V3D(1, 1, 1), NoDetShape), - std::invalid_argument); + const std::invalid_argument &); } void test_efixed_returns_Ei_for_direct_mode() { diff --git a/Framework/MDAlgorithms/test/CompositeImplicitFunctionParserTest.h b/Framework/MDAlgorithms/test/CompositeImplicitFunctionParserTest.h index 7ca6dba8afc..6cfd159b633 100644 --- a/Framework/MDAlgorithms/test/CompositeImplicitFunctionParserTest.h +++ b/Framework/MDAlgorithms/test/CompositeImplicitFunctionParserTest.h @@ -41,7 +41,7 @@ public: TSM_ASSERT_THROWS("Should have thrown invalid_argument exception as " "Function element was expected, but not found.", functionParser.createFunctionBuilder(pRootElem), - std::invalid_argument); + const std::invalid_argument &); } void disabled_testNoSuccessorFunctionParserThrows(void) { @@ -58,7 +58,7 @@ public: CompositeImplicitFunctionParser functionParser; TSM_ASSERT_THROWS( "There is no successor parser setup for the PlaneFunctionParser", - functionParser.createFunctionBuilder(pRootElem), std::runtime_error); + functionParser.createFunctionBuilder(pRootElem), const std::runtime_error &); } void disabled_testCallsFunctionParserChain() { diff --git a/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h b/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h index 28f0c8ca45c..6643bb0897d 100644 --- a/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h +++ b/Framework/MDAlgorithms/test/ConvertMDHistoToMatrixWorkspaceTest.h @@ -109,7 +109,7 @@ public: "_2"); // Not really required for child algorithm if (nonIntegr.size() > 2 || nonIntegr.empty()) { - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } else { try { alg->execute(); diff --git a/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h b/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h index 1df1489c617..f1a9de9bc47 100644 --- a/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h +++ b/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h @@ -129,7 +129,7 @@ public: // Ei is not defined TSM_ASSERT_THROWS("WS has to have input energy for indirect methods", pAlg->preprocessDetectorsPositions(ws2DNew), - std::invalid_argument); + const std::invalid_argument &); ws2DNew->mutableRun().addProperty("Ei", 130., "meV", true); auto TableWS6 = pAlg->preprocessDetectorsPositions(ws2DNew); @@ -143,7 +143,7 @@ public: TSM_ASSERT_THROWS("WS has to have input energy for indirect methods " "despite the table workspace is already calculated", pAlg->preprocessDetectorsPositions(ws2DNew), - std::invalid_argument); + const std::invalid_argument &); } void testUpdateMasksSkipped() { Mantid::API::MatrixWorkspace_sptr ws2Dp = diff --git a/Framework/MDAlgorithms/test/ConvertToMDTest.h b/Framework/MDAlgorithms/test/ConvertToMDTest.h index 2c101057175..10636c66ceb 100644 --- a/Framework/MDAlgorithms/test/ConvertToMDTest.h +++ b/Framework/MDAlgorithms/test/ConvertToMDTest.h @@ -109,7 +109,7 @@ public: pAlg->setPropertyValue("OutputWorkspace", "EnergyTransferND")); // unknown Q-dimension trows TS_ASSERT_THROWS(pAlg->setPropertyValue("QDimensions", "unknownQ"), - std::invalid_argument); + const std::invalid_argument &); // correct Q-dimension fine TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("QDimensions", "|Q|")); // additional dimensions requested -- fine diff --git a/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h b/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h index 13ea362fd01..9eb77a4f6a4 100644 --- a/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h +++ b/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h @@ -52,7 +52,7 @@ public: TSM_ASSERT_THROWS(" the workspace X axis does not have units ", pAlg->setPropertyValue("InputWorkspace", ws2D->getName()), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( pAlg->setPropertyValue("OutputWorkspace", "EnergyTransfer4DWS")); } diff --git a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h index 103d150cba1..a63363583ed 100644 --- a/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h +++ b/Framework/MDAlgorithms/test/ConvertToReflectometryQTest.h @@ -99,7 +99,7 @@ public: alg->setProperty("OverrideIncidentTheta", true); alg->setProperty("IncidentTheta", -0.0001); TSM_ASSERT_THROWS("Incident theta is negative, should throw", - alg->execute(), std::logic_error); + alg->execute(), const std::logic_error &); } void test_theta_initial_too_large_throws() { @@ -107,26 +107,26 @@ public: alg->setProperty("OverrideIncidentTheta", true); alg->setProperty("IncidentTheta", 90.001); TSM_ASSERT_THROWS("Incident theta is too large, should throw", - alg->execute(), std::logic_error); + alg->execute(), const std::logic_error &); } void test_wrong_number_of_extents_throws() { auto alg = make_standard_algorithm(); alg->setProperty("Extents", "-1"); TSM_ASSERT_THROWS("Should only accept 4 extents", alg->execute(), - std::runtime_error); + const std::runtime_error &); } void test_extents_with_qxmin_equals_qxmax_throws() { auto alg = make_standard_algorithm(); alg->setProperty("Extents", "-1,-1,-1,1"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_extents_with_qxmin_more_than_qxmax_throws() { auto alg = make_standard_algorithm(); alg->setProperty("Extents", "-1,-1.01,-1,1"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_extents_with_qxmin_less_than_qxmax() { @@ -138,13 +138,13 @@ public: void test_extents_with_qzmin_equals_qzmax_throws() { auto alg = make_standard_algorithm(); alg->setProperty("Extents", "-1,1,-1,-1"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_extents_with_qzmin_more_than_qzmax_throws() { auto alg = make_standard_algorithm(); alg->setProperty("Extents", "-1,1,-1,-1.01"); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_extents_with_qzmin_less_than_qzmax() { diff --git a/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h b/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h index fe99492472c..18bc860ab5b 100644 --- a/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h +++ b/Framework/MDAlgorithms/test/CreateMDHistoWorkspaceTest.h @@ -67,7 +67,7 @@ public: alg->setProperty( "SignalInput", "1"); // Only one signal value provided, but NumberOfBins set to 5! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); AnalysisDataService::Instance().remove(outWSName); } @@ -77,7 +77,7 @@ public: alg->setProperty( "ErrorInput", "1"); // Only one error value provided, but NumberOfBins set to 5! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); AnalysisDataService::Instance().remove(outWSName); } @@ -87,7 +87,7 @@ public: alg->setProperty("NumberOfEvents", "1"); // Only one number of events value // provided, but NumberOfBins set // to 5! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); AnalysisDataService::Instance().remove(outWSName); } diff --git a/Framework/MDAlgorithms/test/CreateMDTest.h b/Framework/MDAlgorithms/test/CreateMDTest.h index 3b895b7a863..cc3b027d014 100644 --- a/Framework/MDAlgorithms/test/CreateMDTest.h +++ b/Framework/MDAlgorithms/test/CreateMDTest.h @@ -63,7 +63,7 @@ public: alg.setRethrows(true); TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("DataSources", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_psi_right_size() { @@ -85,7 +85,7 @@ public: alg.setPropertyValue("Gl", "0"); // Right size alg.setPropertyValue("Gs", "0"); // Right size - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); // Clean up Mantid::API::AnalysisDataService::Instance().remove( @@ -111,7 +111,7 @@ public: alg.setPropertyValue("Gl", "0,0"); // Too large alg.setPropertyValue("Gs", "0"); // Right size - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); // Clean up Mantid::API::AnalysisDataService::Instance().remove( @@ -137,7 +137,7 @@ public: alg.setPropertyValue("Gl", "0"); // Right size alg.setPropertyValue("Gs", "0,0"); // Too large - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); // Clean up Mantid::API::AnalysisDataService::Instance().remove( diff --git a/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h b/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h index f21a9c10bfa..cf9534a5e7b 100644 --- a/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h +++ b/Framework/MDAlgorithms/test/CreateMDWorkspaceTest.h @@ -72,7 +72,7 @@ public: "simple_md", "Dimensions", "3", "Extents", "-1,1,-2,2,3,3", "Names", "One,Two,Three", "Units", "One,Two,Three", "Frames", "QSample, QTest, QSample"), - std::runtime_error); + const std::runtime_error &); // Wrong number of frames TS_ASSERT_THROWS(!FrameworkManager::Instance().exec( @@ -80,7 +80,7 @@ public: "simple_md", "Dimensions", "3", "Extents", "-1,1,-2,2,3,3", "Names", "One,Two,Three", "Units", "One,Two,Three", "Frames", "QSample, QSample"), - std::runtime_error); + const std::runtime_error &); // Uses too much memory TS_ASSERT(!FrameworkManager::Instance() diff --git a/Framework/MDAlgorithms/test/CutMDTest.h b/Framework/MDAlgorithms/test/CutMDTest.h index dab00176b94..10d8f150e92 100644 --- a/Framework/MDAlgorithms/test/CutMDTest.h +++ b/Framework/MDAlgorithms/test/CutMDTest.h @@ -174,7 +174,7 @@ public: algCutMD->setProperty("P2Bin", "0.1"); algCutMD->setProperty("P3Bin", "0.1"); algCutMD->setProperty("P4Bin", "0.1"); - TS_ASSERT_THROWS(algCutMD->execute(), std::runtime_error) + TS_ASSERT_THROWS(algCutMD->execute(), const std::runtime_error &) AnalysisDataService::Instance().remove(wsName); } diff --git a/Framework/MDAlgorithms/test/FindPeaksMDTest.h b/Framework/MDAlgorithms/test/FindPeaksMDTest.h index 313d7b3c03a..4c338361125 100644 --- a/Framework/MDAlgorithms/test/FindPeaksMDTest.h +++ b/Framework/MDAlgorithms/test/FindPeaksMDTest.h @@ -244,7 +244,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setProperty("PeakFindingStrategy", "NumberOfEventsNormalization")); TS_ASSERT_THROWS_NOTHING(alg.setProperty("SignalThresholdFactor", 1.3)); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); AnalysisDataService::Instance().remove("MDEWS"); } diff --git a/Framework/MDAlgorithms/test/FitResolutionConvolvedModelTest.h b/Framework/MDAlgorithms/test/FitResolutionConvolvedModelTest.h index ede2dc3a7b0..9041bffcfb9 100644 --- a/Framework/MDAlgorithms/test/FitResolutionConvolvedModelTest.h +++ b/Framework/MDAlgorithms/test/FitResolutionConvolvedModelTest.h @@ -43,7 +43,7 @@ public: testMatrixWS); TS_ASSERT_THROWS(alg->setPropertyValue("InputWorkspace", m_inputName), - std::invalid_argument); + const std::invalid_argument &); Mantid::API::AnalysisDataService::Instance().remove(m_inputName); } diff --git a/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h b/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h index 5db87887b6c..d6bd8968648 100644 --- a/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h +++ b/Framework/MDAlgorithms/test/ImportMDEventWorkspaceTest.h @@ -117,7 +117,7 @@ private: alg.setRethrows(true); alg.setPropertyValue("Filename", infile.getFileName()); alg.setPropertyValue("OutputWorkspace", "test_out"); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } public: diff --git a/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h b/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h index ddd5e7dcd5e..40b9a26b6a0 100644 --- a/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h +++ b/Framework/MDAlgorithms/test/ImportMDHistoWorkspaceTest.h @@ -108,7 +108,7 @@ public: 2 * 2); IAlgorithm_sptr alg = make_standard_algorithm(fileObject); TS_ASSERT_THROWS(alg->setProperty("Dimensionality", 0), - std::invalid_argument); + const std::invalid_argument &); } void test_throws_if_dimensionality_greater_than_nine() { @@ -116,7 +116,7 @@ public: 2 * 2); IAlgorithm_sptr alg = make_standard_algorithm(fileObject); TS_ASSERT_THROWS(alg->setProperty("Dimensionality", 10), - std::invalid_argument); + const std::invalid_argument &); } void test_set_dimensionality() { @@ -130,7 +130,7 @@ public: MDFileObject fileObject("test_file_for_load_md_histo_workspace_test_.txt", 2 * 2); IAlgorithm_sptr alg = make_standard_algorithm(fileObject); - TS_ASSERT_THROWS(alg->setProperty("Filename", ""), std::invalid_argument); + TS_ASSERT_THROWS(alg->setProperty("Filename", ""), const std::invalid_argument &); } void test_throws_with_non_existant_filename() { @@ -138,7 +138,7 @@ public: 2 * 2); IAlgorithm_sptr alg = make_standard_algorithm(fileObject); TS_ASSERT_THROWS(alg->setProperty("Filename", "does_not_exist.txt"), - std::invalid_argument); + const std::invalid_argument &); } void test_throws_when_wrong_number_of_extent_entries() { @@ -147,7 +147,7 @@ public: IAlgorithm_sptr alg = make_standard_algorithm(fileObject); alg->setPropertyValue("Extents", "1,-1"); // Extents only provided for 1Dimension! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_throws_when_wrong_number_of_name_entries() { @@ -155,7 +155,7 @@ public: 2 * 2); IAlgorithm_sptr alg = make_standard_algorithm(fileObject); alg->setPropertyValue("Names", "A"); // Names only provided for 1Dimension! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_throws_when_wrong_number_of_unit_entries() { @@ -163,7 +163,7 @@ public: 2 * 2); IAlgorithm_sptr alg = make_standard_algorithm(fileObject); alg->setPropertyValue("Units", "U1"); // Units only provided for 1Dimension! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_throws_when_wrong_number_of_bin_entries() { @@ -172,7 +172,7 @@ public: IAlgorithm_sptr alg = make_standard_algorithm(fileObject); alg->setPropertyValue("Names", "2"); // bin numbers only provided for 1Dimension! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_throws_when_more_bins_expected_than_entries_in_file() { @@ -188,7 +188,7 @@ public: alg->setPropertyValue("Units", "U1,U2,U3"); alg->setProperty("Dimensionality", 3); // but dimensionality has been set to 3 also! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_throws_when_less_bins_expected_than_entries_in_file() { @@ -206,7 +206,7 @@ public: alg->setPropertyValue("Units", "U1,U2,U3"); alg->setProperty("Dimensionality", 3); // but dimensionality has been set to 3 also! - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } /// Test execution with as specific output dimensionality required. diff --git a/Framework/MDAlgorithms/test/IntegrateFluxTest.h b/Framework/MDAlgorithms/test/IntegrateFluxTest.h index bcb99bf2f88..9e19580a86d 100644 --- a/Framework/MDAlgorithms/test/IntegrateFluxTest.h +++ b/Framework/MDAlgorithms/test/IntegrateFluxTest.h @@ -239,7 +239,7 @@ private: alg.initialize(); alg.setPropertyValue("InputWorkspace", inWSName); alg.setPropertyValue("OutputWorkspace", outWSName); - TS_ASSERT_THROWS(alg.setProperty("NPoints", 1), std::invalid_argument); + TS_ASSERT_THROWS(alg.setProperty("NPoints", 1), const std::invalid_argument &); // Remove workspace from the data service. AnalysisDataService::Instance().clear(); diff --git a/Framework/MDAlgorithms/test/InvalidParameterTest.h b/Framework/MDAlgorithms/test/InvalidParameterTest.h index c2263f315c7..5e1689ff37a 100644 --- a/Framework/MDAlgorithms/test/InvalidParameterTest.h +++ b/Framework/MDAlgorithms/test/InvalidParameterTest.h @@ -50,7 +50,7 @@ public: InvalidParameter invalidParam; TSM_ASSERT_THROWS("Should have thrown runtime_error exception as it is not " "possible to represent and invalid parameter in xml.", - invalidParam.toXMLString(), std::runtime_error); + invalidParam.toXMLString(), const std::runtime_error &); } }; diff --git a/Framework/MDAlgorithms/test/LoadDNSSCDTest.h b/Framework/MDAlgorithms/test/LoadDNSSCDTest.h index ca0ab99ca91..19d64a5c38d 100644 --- a/Framework/MDAlgorithms/test/LoadDNSSCDTest.h +++ b/Framework/MDAlgorithms/test/LoadDNSSCDTest.h @@ -817,7 +817,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.setProperty("Normalization", "monitor")); // algorithm should throw if no valid files is provided - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/MDAlgorithms/test/LoadSQW2Test.h b/Framework/MDAlgorithms/test/LoadSQW2Test.h index 595910611c8..0c3ce425fee 100644 --- a/Framework/MDAlgorithms/test/LoadSQW2Test.h +++ b/Framework/MDAlgorithms/test/LoadSQW2Test.h @@ -125,20 +125,20 @@ public: void test_Filename_Property_Throws_If_Not_Found() { auto alg = createAlgorithm(); TS_ASSERT_THROWS(alg->setPropertyValue("Filename", "x.sqw"), - std::invalid_argument); + const std::invalid_argument &); } void test_Unknown_Q3DFrame_Is_Not_Accepted() { auto alg = createAlgorithm(); TS_ASSERT_THROWS(alg->setPropertyValue("Q3DFrames", "Unknown"), - std::invalid_argument); + const std::invalid_argument &); } void test_Unsupported_SQW_Type_Throws_Error() { auto algm = createAlgorithm(); algm->setProperty("Filename", "horace_dnd_test_file.sqw"); algm->setRethrows(true); - TS_ASSERT_THROWS(algm->execute(), std::runtime_error); + TS_ASSERT_THROWS(algm->execute(), const std::runtime_error &); } private: diff --git a/Framework/MDAlgorithms/test/LoadSQWTest.h b/Framework/MDAlgorithms/test/LoadSQWTest.h index f3e46b62eae..dda6c0064eb 100644 --- a/Framework/MDAlgorithms/test/LoadSQWTest.h +++ b/Framework/MDAlgorithms/test/LoadSQWTest.h @@ -135,7 +135,7 @@ public: LoadSQW alg; alg.initialize(); TS_ASSERT_THROWS(alg.setPropertyValue("Filename", "x.sqw"), - std::invalid_argument); + const std::invalid_argument &); } void testAddDimensions() { diff --git a/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h b/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h index 65002ccb1bc..6f8ee0c6f35 100644 --- a/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h +++ b/Framework/MDAlgorithms/test/MDEventWSWrapperTest.h @@ -41,12 +41,12 @@ public: TSM_ASSERT_THROWS("too few dimensions", pws = pWSWrap->createEmptyMDWS(TWS0), - std::invalid_argument); + const std::invalid_argument &); TSM_ASSERT_THROWS("too many dimensions", pws = pWSWrap->createEmptyMDWS(TWS10), - std::invalid_argument); + const std::invalid_argument &); TSM_ASSERT_THROWS("dimensions have not been defined ", - pWSWrap->nDimensions(), std::invalid_argument); + pWSWrap->nDimensions(), const std::invalid_argument &); TSM_ASSERT_THROWS_NOTHING("should be fine", pws = pWSWrap->createEmptyMDWS(TWS5)); diff --git a/Framework/MDAlgorithms/test/MDResolutionConvolutionFactoryTest.h b/Framework/MDAlgorithms/test/MDResolutionConvolutionFactoryTest.h index 87f5ae837d9..04940d2a30a 100644 --- a/Framework/MDAlgorithms/test/MDResolutionConvolutionFactoryTest.h +++ b/Framework/MDAlgorithms/test/MDResolutionConvolutionFactoryTest.h @@ -30,7 +30,7 @@ public: TS_ASSERT_THROWS( MDResolutionConvolutionFactory::Instance().createConvolution( "__NOT_VALID", "FakeForeground", fakeFunction), - Exception::NotFoundError); + const Exception::NotFoundError &); } void diff --git a/Framework/MDAlgorithms/test/MDTransfFactoryTest.h b/Framework/MDAlgorithms/test/MDTransfFactoryTest.h index f44af1d98cd..b07079eda5c 100644 --- a/Framework/MDAlgorithms/test/MDTransfFactoryTest.h +++ b/Framework/MDAlgorithms/test/MDTransfFactoryTest.h @@ -40,7 +40,7 @@ public: void testWrongAlgThrows() { TS_ASSERT_THROWS( MDTransfFactory::Instance().create("Non_existing_ChildAlgorithm"), - Kernel::Exception::NotFoundError); + const Kernel::Exception::NotFoundError &); } void testGetAlg() { diff --git a/Framework/MDAlgorithms/test/MDTransfModQTest.h b/Framework/MDAlgorithms/test/MDTransfModQTest.h index 6bfc058e240..77215ff3c18 100644 --- a/Framework/MDAlgorithms/test/MDTransfModQTest.h +++ b/Framework/MDAlgorithms/test/MDTransfModQTest.h @@ -177,7 +177,7 @@ public: TSM_ASSERT_THROWS( "No detectors yet defined, so should thow run time error: ", - ModQTransf.initialize(WSDescr), std::runtime_error); + ModQTransf.initialize(WSDescr), const std::runtime_error &); // let's preprocess detectors positions to go any further WSDescr.m_PreprDetTable = diff --git a/Framework/MDAlgorithms/test/MDTransfQ3DTest.h b/Framework/MDAlgorithms/test/MDTransfQ3DTest.h index 1aeff7a5f9b..aee997b2d6e 100644 --- a/Framework/MDAlgorithms/test/MDTransfQ3DTest.h +++ b/Framework/MDAlgorithms/test/MDTransfQ3DTest.h @@ -113,7 +113,7 @@ public: TSM_ASSERT_THROWS( "No detectors yet defined, so should thow run time error: ", - Q3DTransf.initialize(WSDescr), std::runtime_error); + Q3DTransf.initialize(WSDescr), const std::runtime_error &); // let's preprocess detectors positions to go any further WSDescr.m_PreprDetTable = diff --git a/Framework/MDAlgorithms/test/MDWSDescriptionTest.h b/Framework/MDAlgorithms/test/MDWSDescriptionTest.h index 7619bb18b63..d6066217c32 100644 --- a/Framework/MDAlgorithms/test/MDWSDescriptionTest.h +++ b/Framework/MDAlgorithms/test/MDWSDescriptionTest.h @@ -33,7 +33,7 @@ public: // dimensions (min-max) have not been set TS_ASSERT_THROWS(WSD.buildFromMatrixWS(ws2D, "|Q|", "Direct"), - std::invalid_argument); + const std::invalid_argument &); std::vector<double> dimMin(2, -1); std::vector<double> dimMax(2, 1); WSD.setMinMax(dimMin, dimMax); @@ -59,7 +59,7 @@ public: int binNumWrong[] = {120, 60, 200}; nBins.assign(binNumWrong, binNumWrong + 3); - TS_ASSERT_THROWS(WSD.setNumBins(nBins), std::invalid_argument); + TS_ASSERT_THROWS(WSD.setNumBins(nBins), const std::invalid_argument &); } void testBuildFromMatrixWS4D() { MDWSDescription WSD; @@ -70,7 +70,7 @@ public: PropNamews[1] = "P"; // no property named "P" is attached to workspace TS_ASSERT_THROWS(WSD.buildFromMatrixWS(ws2D, "|Q|", "Direct", PropNamews), - Exception::NotFoundError); + const Exception::NotFoundError &); // H is attached PropNamews[1] = "H"; @@ -88,7 +88,7 @@ public: int binNumWrong[] = {120, 60}; nBins.assign(binNumWrong, binNumWrong + 2); - TS_ASSERT_THROWS(WSD.setNumBins(nBins), std::invalid_argument); + TS_ASSERT_THROWS(WSD.setNumBins(nBins), const std::invalid_argument &); int binNumRight[] = {120, 60, 200, 100}; nBins.assign(binNumRight, binNumRight + 4); diff --git a/Framework/MDAlgorithms/test/MDWSTransfTest.h b/Framework/MDAlgorithms/test/MDWSTransfTest.h index c7f67afb682..a65c140402b 100644 --- a/Framework/MDAlgorithms/test/MDWSTransfTest.h +++ b/Framework/MDAlgorithms/test/MDWSTransfTest.h @@ -93,13 +93,13 @@ public: "Forced HKL frame would not accept workspace without oriented lattice", Transf.getTransfMatrix(TargWSDescription, CnvrtToMD::HKLFrame, CnvrtToMD::HKLScale), - std::invalid_argument); + const std::invalid_argument &); TSM_ASSERT_THROWS("Forced SampleFrame frame would not accept workspace " "without goniometer defined", Transf.getTransfMatrix(TargWSDescription, CnvrtToMD::SampleFrame, CnvrtToMD::HKLScale), - std::invalid_argument); + const std::invalid_argument &); spws->mutableSample().setOrientedLattice(pLattice.get()); WorkspaceCreationHelper::setGoniometer(spws, 20, 0, 0); diff --git a/Framework/MDAlgorithms/test/MaskMDTest.h b/Framework/MDAlgorithms/test/MaskMDTest.h index 23a0e7221ef..9280c00c6be 100644 --- a/Framework/MDAlgorithms/test/MaskMDTest.h +++ b/Framework/MDAlgorithms/test/MaskMDTest.h @@ -183,7 +183,7 @@ public: alg.setPropertyValue("Dimensions", "UnknownId, Axis1, Axis2"); alg.setPropertyValue("Extents", "0,10,0,10,0,10"); TSM_ASSERT_THROWS("Using an unknown name/id should throw", alg.execute(), - std::runtime_error); + const std::runtime_error &); } void test_mask_everything() { diff --git a/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h b/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h index 11a5d6b314e..1f55515da09 100644 --- a/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h +++ b/Framework/MDAlgorithms/test/PreprocessDetectorsToMDTest.h @@ -288,7 +288,7 @@ public: TSM_ASSERT("can not interpet the workspace as table workspace", tws); TSM_ASSERT_THROWS("No such column", tws->getColVector<int>("detMask"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("GetMaskState", "1")); TS_ASSERT_THROWS_NOTHING(pAlg->setPropertyValue("UpdateMasksInfo", "1")); diff --git a/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h b/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h index 8736baddaf5..180115c41c1 100644 --- a/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h +++ b/Framework/MDAlgorithms/test/ReflectometryTransformKiKfTest.h @@ -35,7 +35,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformKiKf(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_kimin_equal_to_kimax_throws() { @@ -46,7 +46,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformKiKf(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_kfmin_greater_than_kfmax_throws() { @@ -57,7 +57,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformKiKf(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_kfmin_equal_to_kfmax_throws() { @@ -68,7 +68,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformKiKf(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_incident_theta_negative() { @@ -79,7 +79,7 @@ public: double incidentTheta = -0.001; // Negative TS_ASSERT_THROWS( ReflectometryTransformKiKf(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::out_of_range); + const std::out_of_range &); } void test_incident_theta_too_large() { @@ -90,7 +90,7 @@ public: double incidentTheta = 90.001; // Too large TS_ASSERT_THROWS( ReflectometryTransformKiKf(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::out_of_range); + const std::out_of_range &); } void test_valid_construction_inputs() { diff --git a/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h b/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h index 026c443fed1..77de7ce921e 100644 --- a/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h +++ b/Framework/MDAlgorithms/test/ReflectometryTransformPTest.h @@ -34,7 +34,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformP(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_kimin_equal_to_kimax_throws() { @@ -45,7 +45,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformP(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_kfmin_greater_than_kfmax_throws() { @@ -56,7 +56,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformP(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_kfmin_equal_to_kfmax_throws() { @@ -67,7 +67,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformP(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_incident_theta_negative() { @@ -78,7 +78,7 @@ public: double incidentTheta = -0.001; // Negative TS_ASSERT_THROWS( ReflectometryTransformP(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::out_of_range); + const std::out_of_range &); } void test_incident_theta_too_large() { @@ -89,7 +89,7 @@ public: double incidentTheta = 90.001; // Too large TS_ASSERT_THROWS( ReflectometryTransformP(kiMin, kiMax, kfMin, kfMax, incidentTheta), - std::out_of_range); + const std::out_of_range &); } void test_valid_construction_inputs() { diff --git a/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h b/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h index 4ffaf00d36b..4458a3c816f 100644 --- a/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h +++ b/Framework/MDAlgorithms/test/ReflectometryTransformQxQzTest.h @@ -38,7 +38,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformQxQz(qxMin, qxMax, qzMin, qzMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_qxmin_equal_to_qxmax_throws() { @@ -49,7 +49,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformQxQz(qxMin, qxMax, qzMin, qzMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_qzmin_greater_than_qzmax_throws() { @@ -60,7 +60,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformQxQz(qxMin, qxMax, qzMin, qzMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_qzmin_equal_to_qzmax_throws() { @@ -71,7 +71,7 @@ public: double incidentTheta = 1; TS_ASSERT_THROWS( ReflectometryTransformQxQz(qxMin, qxMax, qzMin, qzMax, incidentTheta), - std::invalid_argument); + const std::invalid_argument &); } void test_incident_theta_negative() { @@ -82,7 +82,7 @@ public: double incidentTheta = -0.001; // Negative TS_ASSERT_THROWS( ReflectometryTransformQxQz(qxMin, qxMax, qzMin, qzMax, incidentTheta), - std::out_of_range); + const std::out_of_range &); } void test_incident_theta_too_large() { @@ -93,7 +93,7 @@ public: double incidentTheta = 90.001; // Too large TS_ASSERT_THROWS( ReflectometryTransformQxQz(qxMin, qxMax, qzMin, qzMax, incidentTheta), - std::out_of_range); + const std::out_of_range &); } void test_valid_construction_inputs() { diff --git a/Framework/MDAlgorithms/test/ReplicateMDTest.h b/Framework/MDAlgorithms/test/ReplicateMDTest.h index b767172a196..ef46a7622cf 100644 --- a/Framework/MDAlgorithms/test/ReplicateMDTest.h +++ b/Framework/MDAlgorithms/test/ReplicateMDTest.h @@ -390,7 +390,7 @@ public: alg.setProperty("DataWorkspace", dataWSTranspose); alg.setProperty("ShapeWorkspace", shapeWS); alg.setPropertyValue("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_wrong_number_of_dimensions() { @@ -408,7 +408,7 @@ public: alg.setProperty("DataWorkspace", dataWSTranspose); alg.setProperty("ShapeWorkspace", shapeWS); alg.setPropertyValue("OutputWorkspace", "dummy"); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } }; diff --git a/Framework/MDAlgorithms/test/TobyFitResolutionModelTest.h b/Framework/MDAlgorithms/test/TobyFitResolutionModelTest.h index 35ee9ad7488..317a6a891af 100644 --- a/Framework/MDAlgorithms/test/TobyFitResolutionModelTest.h +++ b/Framework/MDAlgorithms/test/TobyFitResolutionModelTest.h @@ -39,7 +39,7 @@ public: ResolutionConvolvedCrossSection *conv = new ResolutionConvolvedCrossSection; TS_ASSERT_THROWS(TobyFitResolutionModel(*conv, "_NotAKnownModel"), - std::invalid_argument); + const std::invalid_argument &); delete conv; } diff --git a/Framework/MDAlgorithms/test/WeightedMeanMDTest.h b/Framework/MDAlgorithms/test/WeightedMeanMDTest.h index 50c8bfe60c7..de5c901f0c8 100644 --- a/Framework/MDAlgorithms/test/WeightedMeanMDTest.h +++ b/Framework/MDAlgorithms/test/WeightedMeanMDTest.h @@ -71,7 +71,7 @@ private: alg.setProperty("LHSWorkspace", a); alg.setProperty("RHSWorkspace", b); alg.setPropertyValue("OutputWorkspace", outName); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); } public: diff --git a/Framework/MPIAlgorithms/test/BroadcastWorkspaceTest.h b/Framework/MPIAlgorithms/test/BroadcastWorkspaceTest.h index 522f8f8cff1..12f3d19850e 100644 --- a/Framework/MPIAlgorithms/test/BroadcastWorkspaceTest.h +++ b/Framework/MPIAlgorithms/test/BroadcastWorkspaceTest.h @@ -43,7 +43,7 @@ public: TS_ASSERT_THROWS_NOTHING( broadcaster.setPropertyValue("OutputWorkspace", "blah")); TS_ASSERT_THROWS(broadcaster.setProperty("BroadcasterRank", 1), - std::invalid_argument); + const std::invalid_argument &); } void testExecute() { diff --git a/Framework/MPIAlgorithms/test/GatherWorkspacesTest.h b/Framework/MPIAlgorithms/test/GatherWorkspacesTest.h index 410e6d0c5de..78f131285f7 100644 --- a/Framework/MPIAlgorithms/test/GatherWorkspacesTest.h +++ b/Framework/MPIAlgorithms/test/GatherWorkspacesTest.h @@ -45,7 +45,7 @@ public: gatherer.setProperty("OutputWorkspace", "something")); // Haven't set InputWorkspace and this will be the root process, so it // should complain - TS_ASSERT_THROWS(gatherer.execute(), std::runtime_error); + TS_ASSERT_THROWS(gatherer.execute(), const std::runtime_error &); TS_ASSERT(!gatherer.isExecuted()); } diff --git a/Framework/Muon/src/MuonAlgorithmHelper.cpp b/Framework/Muon/src/MuonAlgorithmHelper.cpp index 90e1e698f16..2dff1b018b2 100644 --- a/Framework/Muon/src/MuonAlgorithmHelper.cpp +++ b/Framework/Muon/src/MuonAlgorithmHelper.cpp @@ -478,7 +478,7 @@ bool checkValidPair(const std::string &WSname1, const std::string &WSname2) { try { group1 = parseWorkspaceName(WSname1); group2 = parseWorkspaceName(WSname2); - } catch (std::invalid_argument) { + } catch (const std::invalid_argument &) { throw std::invalid_argument( "Ensure workspaces have the correctly formatted name (see " "documentation)."); diff --git a/Framework/Muon/test/ApplyDeadTimeCorrTest.h b/Framework/Muon/test/ApplyDeadTimeCorrTest.h index 9ac7ca16a89..1858993bcef 100644 --- a/Framework/Muon/test/ApplyDeadTimeCorrTest.h +++ b/Framework/Muon/test/ApplyDeadTimeCorrTest.h @@ -108,7 +108,7 @@ public: applyDeadTime.setProperty("DeadTimeTable", deadTimes)); TS_ASSERT_THROWS_NOTHING( applyDeadTime.setProperty("OutputWorkspace", "__NotUsed")); - TS_ASSERT_THROWS(applyDeadTime.execute(), std::logic_error); + TS_ASSERT_THROWS(applyDeadTime.execute(), const std::logic_error &); // Check new table wasn't created MatrixWorkspace_sptr output = applyDeadTime.getProperty("OutputWorkspace"); @@ -194,7 +194,7 @@ public: applyDT.initialize(); applyDT.setChild(true); TS_ASSERT_THROWS(applyDT.setProperty("InputWorkspace", rebinned), - std::invalid_argument); + const std::invalid_argument &); } // Test that algorithm throws if input workspace does not contain number of @@ -216,7 +216,7 @@ public: applyDeadTime.setProperty("DeadTimeTable", deadTimes)); TS_ASSERT_THROWS_NOTHING( applyDeadTime.setProperty("OutputWorkspace", "__NotUsed")); - TS_ASSERT_THROWS(applyDeadTime.execute(), std::invalid_argument); + TS_ASSERT_THROWS(applyDeadTime.execute(), const std::invalid_argument &); TS_ASSERT(!applyDeadTime.isExecuted()); } diff --git a/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h b/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h index 068febcfc13..f01ffe8358f 100644 --- a/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h +++ b/Framework/Muon/test/ApplyMuonDetectorGroupPairingTest.h @@ -122,7 +122,7 @@ public: ",", ";", ":"}; for (auto badName : badPairNames) { alg.setProperty("PairName", badName); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } } @@ -139,7 +139,7 @@ public: std::vector<double> badAlphas = {0.0, -1.0}; for (auto badAlpha : badAlphas) { alg.setProperty("Alpha", badAlpha); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } } @@ -159,7 +159,7 @@ public: for (size_t i = 0; i < badGroup1.size(); i++) { alg.setProperty("Group1", badGroup1[i]); alg.setProperty("Group2", badGroup2[i]); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } } @@ -175,7 +175,7 @@ public: alg.setProperty("TimeMin", 10.0); alg.setProperty("TimeMax", 5.0); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -198,14 +198,14 @@ public: for (auto &&badPeriod : badPeriods) { alg.setProperty("SummedPeriods", badPeriod); // This throw comes from MuonProcess - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } for (auto &&badPeriod : badPeriods) { alg.setProperty("SubtractedPeriods", badPeriod); // This throw comes from MuonProcess - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } } @@ -299,7 +299,7 @@ public: // Expects 10 IDs setPairAlgorithmProperties(alg, setup.inputWSName, setup.groupWSName); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_summingPeriodsGivesCorrectAsymmetryValues() { @@ -465,7 +465,7 @@ public: alg.setProperty("InputWorkspace1", groupWS1Name); alg.setProperty("InputWorkspace2", groupWS2Name); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } void test_inputWorkspaceWithDifferentTimeAxisFails() { @@ -493,7 +493,7 @@ public: alg.setProperty("InputWorkspace1", groupWS1Name); alg.setProperty("InputWorkspace2", groupWS2Name); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); } }; diff --git a/Framework/Muon/test/AsymmetryCalcTest.h b/Framework/Muon/test/AsymmetryCalcTest.h index 05e4a343a91..187535395a6 100644 --- a/Framework/Muon/test/AsymmetryCalcTest.h +++ b/Framework/Muon/test/AsymmetryCalcTest.h @@ -139,11 +139,11 @@ public: asymCalc.setPropertyValue("ForwardSpectra", "1"); asymCalc.setPropertyValue("BackwardSpectra", "3"); // Bad spectrum number for BackwardSpectra - TS_ASSERT_THROWS(asymCalc.execute(), std::runtime_error); + TS_ASSERT_THROWS(asymCalc.execute(), const std::runtime_error &); asymCalc.setPropertyValue("BackwardSpectra", "1"); asymCalc.setPropertyValue("ForwardSpectra", "3"); // Bad spectrum number for ForwardSpectra - TS_ASSERT_THROWS(asymCalc.execute(), std::runtime_error); + TS_ASSERT_THROWS(asymCalc.execute(), const std::runtime_error &); } /** diff --git a/Framework/Muon/test/CalMuonDeadTimeTest.h b/Framework/Muon/test/CalMuonDeadTimeTest.h index 96b5126ed83..edbecc2dcaf 100644 --- a/Framework/Muon/test/CalMuonDeadTimeTest.h +++ b/Framework/Muon/test/CalMuonDeadTimeTest.h @@ -89,7 +89,7 @@ public: calDeadTime.setPropertyValue("FirstGoodData", "1.0"); calDeadTime.setPropertyValue("LastGoodData", "2.0"); - TS_ASSERT_THROWS(calDeadTime.execute(), std::runtime_error); + TS_ASSERT_THROWS(calDeadTime.execute(), const std::runtime_error &); TS_ASSERT(!calDeadTime.isExecuted()); } diff --git a/Framework/Muon/test/CalMuonDetectorPhasesTest.h b/Framework/Muon/test/CalMuonDetectorPhasesTest.h index e50956b3f3d..c41fef69f87 100644 --- a/Framework/Muon/test/CalMuonDetectorPhasesTest.h +++ b/Framework/Muon/test/CalMuonDetectorPhasesTest.h @@ -74,7 +74,7 @@ public: calc->setProperty("ForwardSpectra", std::vector<int>{1}); calc->setProperty("BackwardSpectra", std::vector<int>{2}); - TS_ASSERT_THROWS(calc->execute(), std::runtime_error); + TS_ASSERT_THROWS(calc->execute(), const std::runtime_error &); TS_ASSERT(!calc->isExecuted()); } @@ -90,7 +90,7 @@ public: calc->setProperty("ForwardSpectra", std::vector<int>{1}); calc->setProperty("BackwardSpectra", std::vector<int>{2}); - TS_ASSERT_THROWS(calc->execute(), std::runtime_error); + TS_ASSERT_THROWS(calc->execute(), const std::runtime_error &); TS_ASSERT(!calc->isExecuted()); } diff --git a/Framework/Muon/test/CalculateMuonAsymmetryTest.h b/Framework/Muon/test/CalculateMuonAsymmetryTest.h index 76a88d6c95b..f770f0ae39e 100644 --- a/Framework/Muon/test/CalculateMuonAsymmetryTest.h +++ b/Framework/Muon/test/CalculateMuonAsymmetryTest.h @@ -224,7 +224,7 @@ public: IAlgorithm_sptr alg = setUpAlg(table, func, wsNames, wsOut); alg->setProperty("StartX", 10.); alg->setProperty("EndX", 1.); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); clearADS(); } @@ -237,7 +237,7 @@ public: auto table = genTable(); IAlgorithm_sptr alg = setUpAlg(table, func, wsNames, wsOut); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); clearADS(); } @@ -252,7 +252,7 @@ public: wsNames = {"ws1"}; IAlgorithm_sptr alg = setUpAlg(table, func, wsNames, wsOut); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); clearADS(); } diff --git a/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h b/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h index 1210ebe984a..761dec46c9a 100644 --- a/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h +++ b/Framework/Muon/test/EstimateMuonAsymmetryFromCountsTest.h @@ -199,7 +199,7 @@ public: alg->setProperty("StartX", 0.1); alg->setProperty("EndX", 0.1); alg->setProperty("OutputWorkspace", outputName); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_BackwardsRange() { auto ws = createWorkspace(1, 50); @@ -211,7 +211,7 @@ public: alg->setProperty("StartX", 0.9); alg->setProperty("EndX", 0.1); alg->setProperty("OutputWorkspace", outputName); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_NumberOfDataPoints() { diff --git a/Framework/Muon/test/LoadAndApplyMuonDetectorGroupingTest.h b/Framework/Muon/test/LoadAndApplyMuonDetectorGroupingTest.h index 389e5043090..412115eba1b 100644 --- a/Framework/Muon/test/LoadAndApplyMuonDetectorGroupingTest.h +++ b/Framework/Muon/test/LoadAndApplyMuonDetectorGroupingTest.h @@ -305,7 +305,7 @@ public: MuonGroupingXMLHelper::createGroupingXMLSingleGroup("group_", "1-2"); auto alg = algorithmWithPropertiesSet(ws->getName(), file.getFileName()); - TS_ASSERT_THROWS(alg->execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg->execute(), const std::invalid_argument &); } void test_throws_if_pair_contains_non_existant_group() { @@ -317,7 +317,8 @@ public: "pair1", "nonExistantGroup"); auto alg = algorithmWithPropertiesSet(ws->getName(), file.getFileName()); - TS_ASSERT_THROWS(alg->execute(), Mantid::Kernel::Exception::FileError); + TS_ASSERT_THROWS(alg->execute(), + const Mantid::Kernel::Exception::FileError &); } void test_throws_when_file_has_detectors_which_are_not_in_workspace() { @@ -329,7 +330,7 @@ public: MuonGroupingXMLHelper::createGroupingXMLSingleGroup("test", group); auto alg = algorithmWithPropertiesSet(ws->getName(), file.getFileName()); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_rebinning_applied_correctly() { diff --git a/Framework/Muon/test/MuonAlgorithmHelperTest.h b/Framework/Muon/test/MuonAlgorithmHelperTest.h index 9411faf945f..842459c45ca 100644 --- a/Framework/Muon/test/MuonAlgorithmHelperTest.h +++ b/Framework/Muon/test/MuonAlgorithmHelperTest.h @@ -476,7 +476,7 @@ public: for (auto &&invalidName : invalidWorkspaceNames) TS_ASSERT_THROWS(checkValidPair(validWorkspaceName, invalidName), - std::invalid_argument); + const std::invalid_argument &); } void test_checkValidPair_throws_if_ItemType_Asym() { @@ -485,7 +485,7 @@ public: const std::string invalidWorkspaceName = "EMU000015189; Group; fwd; Asym; 1+2; #1"; TS_ASSERT_THROWS(checkValidPair(validWorkspaceName, invalidWorkspaceName), - std::invalid_argument); + const std::invalid_argument &); } void test_checkValidPair_throws_if_different_instruments() { @@ -494,7 +494,7 @@ public: const std::string invalidWorkspaceName = "MUSR00015189; Group; fwd; Counts; 1+2; #1"; TS_ASSERT_THROWS(checkValidPair(validWorkspaceName, invalidWorkspaceName), - std::invalid_argument); + const std::invalid_argument &); } void test_checkValidPair_does_not_throw_if_same_group() { @@ -503,7 +503,7 @@ public: const std::string invalidWorkspaceName = "EMU000015189; Group; fwd; Counts; 1+2; #1"; TS_ASSERT_THROWS(checkValidPair(validWorkspaceName, invalidWorkspaceName), - std::invalid_argument); + const std::invalid_argument &); } void test_checkValidGroupPairName_invalid_names() { diff --git a/Framework/Muon/test/MuonGroupingAsymmetryTest.h b/Framework/Muon/test/MuonGroupingAsymmetryTest.h index 2d6c83b1117..a836c56a2ca 100644 --- a/Framework/Muon/test/MuonGroupingAsymmetryTest.h +++ b/Framework/Muon/test/MuonGroupingAsymmetryTest.h @@ -130,7 +130,7 @@ public: IAlgorithm_sptr alg = algorithmWithWorkspacePropertiesSet(setup.inputWSName); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -188,7 +188,7 @@ public: alg->setProperty("SummedPeriods", summedPeriods); alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -200,7 +200,7 @@ public: const std::vector<int> summedPeriods = {3}; alg->setProperty("SummedPeriods", summedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -212,7 +212,7 @@ public: const std::vector<int> subtractedPeriods = {3}; alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_algorithm_fails_if_summed_periods_has_negative_entry() { @@ -223,7 +223,7 @@ public: const std::vector<int> summedPeriods = {-1}; alg->setProperty("SummedPeriods", summedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_algorithm_fails_if_subtracted_periods_has_negative_entry() { @@ -234,7 +234,7 @@ public: const std::vector<int> subtractedPeriods = {-1}; alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } // -------------------------------------------------------------------------- diff --git a/Framework/Muon/test/MuonGroupingCountsTest.h b/Framework/Muon/test/MuonGroupingCountsTest.h index 2d3b2fc1d13..bd645bad540 100644 --- a/Framework/Muon/test/MuonGroupingCountsTest.h +++ b/Framework/Muon/test/MuonGroupingCountsTest.h @@ -152,7 +152,7 @@ public: IAlgorithm_sptr alg = algorithmWithoutOptionalPropertiesSet(setup.inputWSName); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -203,7 +203,7 @@ public: alg->setProperty("SummedPeriods", summedPeriods); alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -215,7 +215,7 @@ public: std::vector<int> summedPeriods = {3}; alg->setProperty("SummedPeriods", summedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -227,7 +227,7 @@ public: std::vector<int> subtractedPeriods = {3}; alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } // -------------------------------------------------------------------------- diff --git a/Framework/Muon/test/MuonPairingAsymmetryTest.h b/Framework/Muon/test/MuonPairingAsymmetryTest.h index 41c738a7174..e058ef11d51 100644 --- a/Framework/Muon/test/MuonPairingAsymmetryTest.h +++ b/Framework/Muon/test/MuonPairingAsymmetryTest.h @@ -230,7 +230,7 @@ public: IAlgorithm_sptr alg = algorithmWithoutOptionalPropertiesSet( setup.inputWSName, "", group1, group2); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -320,7 +320,7 @@ public: alg->setProperty("SummedPeriods", summedPeriods); alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -331,7 +331,7 @@ public: std::vector<int> summedPeriods = {3}; alg->setProperty("SummedPeriods", summedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -342,7 +342,7 @@ public: std::vector<int> subtractedPeriods = {3}; alg->setProperty("SubtractedPeriods", subtractedPeriods); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } // -------------------------------------------------------------------------- diff --git a/Framework/Muon/test/MuonPreProcessTest.h b/Framework/Muon/test/MuonPreProcessTest.h index 1dcf393af1f..d8e7c2234b0 100644 --- a/Framework/Muon/test/MuonPreProcessTest.h +++ b/Framework/Muon/test/MuonPreProcessTest.h @@ -152,7 +152,7 @@ public: alg->setProperty("TimeMin", 0.6); alg->setProperty("TimeMax", 0.4); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_that_negative_TimeMin_is_an_accepted_input() { @@ -173,7 +173,7 @@ public: alg->setProperty("TimeMin", 0.5); alg->setProperty("TimeMax", 0.5); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void test_that_TimeMin_and_TimeMax_both_in_same_bin_throws_logic_error() { @@ -189,7 +189,7 @@ public: alg->setProperty("TimeMax", 0.58); // Expect runtime error as alg is set to rethrow - TS_ASSERT_THROWS(alg->execute(), std::logic_error); + TS_ASSERT_THROWS(alg->execute(), const std::logic_error &); } // -------------------------------------------------------------------------- @@ -205,7 +205,7 @@ public: auto alg = setUpAlgorithmWithDeadTimeTable(ws, deadTimeTable); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } // -------------------------------------------------------------------------- @@ -415,7 +415,7 @@ public: WorkspaceGroup_sptr wsGroup = boost::make_shared<WorkspaceGroup>(); auto alg = setUpAlgorithmWithNoOptionalProperties(wsGroup); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } void @@ -428,7 +428,7 @@ public: wsGroup->addWorkspace(wsTwoSpectra); auto alg = setUpAlgorithmWithNoOptionalProperties(wsGroup); - TS_ASSERT_THROWS(alg->execute(), std::runtime_error); + TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &); } }; diff --git a/Framework/Muon/test/PhaseQuadMuonTest.h b/Framework/Muon/test/PhaseQuadMuonTest.h index 2d53354ca76..28dc4ba562a 100644 --- a/Framework/Muon/test/PhaseQuadMuonTest.h +++ b/Framework/Muon/test/PhaseQuadMuonTest.h @@ -258,23 +258,23 @@ public: void testNoPhase() { std::vector<std::string> names = {"ID", "Asym", "dummy"}; IAlgorithm_sptr phaseQuad = setupAlg(m_loadedData, true, names); - TS_ASSERT_THROWS(phaseQuad->execute(), std::runtime_error); + TS_ASSERT_THROWS(phaseQuad->execute(), const std::runtime_error &); } void testNoAsymm() { std::vector<std::string> names = {"ID", "AsYMg", "phase"}; MatrixWorkspace_sptr m_loadedData = loadMuonDataset(); IAlgorithm_sptr phaseQuad = setupAlg(m_loadedData, true, names); - TS_ASSERT_THROWS(phaseQuad->execute(), std::runtime_error); + TS_ASSERT_THROWS(phaseQuad->execute(), const std::runtime_error &); } void testTwoPhases() { std::vector<std::string> names = {"ID", "Phase", "phi"}; IAlgorithm_sptr phaseQuad = setupAlg(m_loadedData, true, names); - TS_ASSERT_THROWS(phaseQuad->execute(), std::runtime_error); + TS_ASSERT_THROWS(phaseQuad->execute(), const std::runtime_error &); } void testTwoAsymm() { std::vector<std::string> names = {"ID", "Asym", "Asymm"}; IAlgorithm_sptr phaseQuad = setupAlg(m_loadedData, true, names); - TS_ASSERT_THROWS(phaseQuad->execute(), std::runtime_error); + TS_ASSERT_THROWS(phaseQuad->execute(), const std::runtime_error &); } void testSwapOrder() { std::vector<std::string> names = {"ID", "phase", "Asymm"}; diff --git a/Framework/Muon/test/PlotAsymmetryByLogValueTest.h b/Framework/Muon/test/PlotAsymmetryByLogValueTest.h index af319ec7f00..8288e0936b9 100644 --- a/Framework/Muon/test/PlotAsymmetryByLogValueTest.h +++ b/Framework/Muon/test/PlotAsymmetryByLogValueTest.h @@ -445,7 +445,7 @@ public: alg.setPropertyValue("LastRun", firstRun); alg.setPropertyValue("OutputWorkspace", ws); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/Parallel/test/EventLoaderTest.h b/Framework/Parallel/test/EventLoaderTest.h index fc79ad2933c..c0e05123ea9 100644 --- a/Framework/Parallel/test/EventLoaderTest.h +++ b/Framework/Parallel/test/EventLoaderTest.h @@ -164,7 +164,7 @@ public: void test_throws_if_file_does_not_exist() { TS_ASSERT_THROWS( EventLoader::load(Communicator{}, "abcdefg", "", {}, {}, {}), - H5::FileIException); + const H5::FileIException &); } void test_H5DataType_parameter_pack_conversion() { diff --git a/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp b/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp index 8bc2dfe5dce..9f487fe82ac 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/DataProcessorAlgorithm.cpp @@ -16,10 +16,7 @@ using namespace boost::python; namespace { template <class Base> -using loadOverload1 = - Workspace_sptr (DataProcessorAdapter<Base>::*)(const std::string &); -template <class Base> -using loadOverload2 = Workspace_sptr (DataProcessorAdapter<Base>::*)( +using loadOverload = Workspace_sptr (DataProcessorAdapter<Base>::*)( const std::string &, const bool); template <class Base> void do_export(const std::string &name) { @@ -59,13 +56,8 @@ template <class Base> void do_export(const std::string &name) { .def("loadChunk", &Adapter::loadChunkProxy, (arg("self"), arg("row_index")), "Load a chunk of data") - .def("load", (loadOverload1<Base>)&Adapter::loadProxy, - (arg("self"), arg("input_data")), - "Loads the given file or workspace data and returns the workspace. " - "The output is not stored in the AnalysisDataService.") - - .def("load", (loadOverload2<Base>)&Adapter::loadProxy, - (arg("self"), arg("input_data"), arg("load_quite")), + .def("load", (loadOverload<Base>)&Adapter::loadProxy, + (arg("self"), arg("input_data"), arg("load_quiet") = false), "Loads the given file or workspace data and returns the workspace. " "If loadQuiet=True then output is not stored in the " "AnalysisDataService.") diff --git a/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp b/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp index 522254a7aa0..63d94644c54 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/IPeakFunction.cpp @@ -19,7 +19,7 @@ void export_IPeakFunction() { "IPeakFunction", "Base class for peak Fit functions") .def("functionLocal", (object(IPeakFunctionAdapter::*)(const object &) const) & - IPeakFunction::functionLocal, + IPeakFunctionAdapter::functionLocal, (arg("self"), arg("vec_x")), "Calculate the values of the function for the given x values. The " "output should be stored in the out array") diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp index 82b045e929a..c57fa35d0ea 100644 --- a/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp +++ b/Framework/PythonInterface/mantid/geometry/src/Exports/Instrument.cpp @@ -35,17 +35,18 @@ void export_Instrument() { "represents the source") .def("getComponentByName", - (boost::shared_ptr<IComponent>(Instrument::*)(const std::string &)) & + (boost::shared_ptr<const IComponent>(CompAssembly::*)( + const std::string &, int) const) & Instrument::getComponentByName, (arg("self"), arg("cname")), "Returns the named :class:`~mantid.geometry.Component`") - .def( - "getDetector", - (boost::shared_ptr<IDetector>(Instrument::*)(const detid_t &) const) & - Instrument::getDetector, - (arg("self"), arg("detector_id")), - "Returns the :class:`~mantid.geometry.Detector` with the given ID") + .def("getDetector", + (boost::shared_ptr<const IDetector>(Instrument::*)(const detid_t &) + const) & + Instrument::getDetector, + (arg("self"), arg("detector_id")), + "Returns the :class:`~mantid.geometry.Detector` with the given ID") .def("getReferenceFrame", (boost::shared_ptr<const ReferenceFrame>(Instrument::*)()) & diff --git a/Framework/PythonInterface/test/cpp/IFunction1DAdapterTest.h b/Framework/PythonInterface/test/cpp/IFunction1DAdapterTest.h index 5bd5492e899..17b9311878a 100644 --- a/Framework/PythonInterface/test/cpp/IFunction1DAdapterTest.h +++ b/Framework/PythonInterface/test/cpp/IFunction1DAdapterTest.h @@ -35,7 +35,7 @@ public: std::array<double, 1> xvalues{{10}}, retvalue{{0}}; TS_ASSERT_THROWS( badReturnFunc1D->function1D(retvalue.data(), xvalues.data(), 1), - std::runtime_error); + const std::runtime_error &); } void testfunction1D_Returning_Numpy_Array_With_NonFloat_Type_Throws() { @@ -52,7 +52,7 @@ public: std::array<double, 1> xvalues{{10}}, retvalue{{0}}; TS_ASSERT_THROWS( badNdArrayFunc1D->function1D(retvalue.data(), xvalues.data(), 1), - std::runtime_error); + const std::runtime_error &); } // -------------- Success tests ------------------------- diff --git a/Framework/PythonInterface/test/cpp/IPeakFunctionAdapterTest.h b/Framework/PythonInterface/test/cpp/IPeakFunctionAdapterTest.h index ec3d2157ad2..d5714e6d2af 100644 --- a/Framework/PythonInterface/test/cpp/IPeakFunctionAdapterTest.h +++ b/Framework/PythonInterface/test/cpp/IPeakFunctionAdapterTest.h @@ -36,7 +36,7 @@ public: std::array<double, 1> xvalues{{10}}, retvalue{{0}}; TS_ASSERT_THROWS( badReturnFunc->function1D(retvalue.data(), xvalues.data(), 1), - std::runtime_error); + const std::runtime_error &); } void testfunctionLocal_Returning_Numpy_Array_With_NonFloat_Type_Throws() { @@ -53,7 +53,7 @@ public: std::array<double, 1> xvalues{{10}}, retvalue{{0}}; TS_ASSERT_THROWS( badNdArrayFunc->function1D(retvalue.data(), xvalues.data(), 1), - std::runtime_error); + const std::runtime_error &); } // -------------- Success tests ------------------------- diff --git a/Framework/PythonInterface/test/cpp/PySequenceToVectorTest.h b/Framework/PythonInterface/test/cpp/PySequenceToVectorTest.h index 6fef58fa8ee..79900f8ca41 100644 --- a/Framework/PythonInterface/test/cpp/PySequenceToVectorTest.h +++ b/Framework/PythonInterface/test/cpp/PySequenceToVectorTest.h @@ -54,7 +54,7 @@ public: using PySequenceToVectorInt = PySequenceToVector<int>; std::vector<int> cvector; TS_ASSERT_THROWS(cvector = PySequenceToVectorInt(testlist)(), - boost::python::error_already_set); + const boost::python::error_already_set &); } /// Creates a python list where all of the types are the same diff --git a/Framework/PythonInterface/test/cpp/PythonAlgorithmInstantiatorTest.h b/Framework/PythonInterface/test/cpp/PythonAlgorithmInstantiatorTest.h index ab2fceed480..91e5ea84994 100644 --- a/Framework/PythonInterface/test/cpp/PythonAlgorithmInstantiatorTest.h +++ b/Framework/PythonInterface/test/cpp/PythonAlgorithmInstantiatorTest.h @@ -34,7 +34,7 @@ public: public: void test_Bare_Pointer_Throws_On_Creation() { TS_ASSERT_THROWS(instantiator().createUnwrappedInstance(), - std::runtime_error); + const std::runtime_error &); } void test_Shared_Pointer() { diff --git a/Framework/PythonInterface/test/cpp/ToPyListTest.h b/Framework/PythonInterface/test/cpp/ToPyListTest.h index fd94965ea44..d340afcd947 100644 --- a/Framework/PythonInterface/test/cpp/ToPyListTest.h +++ b/Framework/PythonInterface/test/cpp/ToPyListTest.h @@ -30,7 +30,7 @@ public: void test_unregistered_element_type_throws_runtime_error() { std::vector<UnregisteredType> unknownElements{UnregisteredType()}; TS_ASSERT_THROWS(ToPyList<UnregisteredType>()(unknownElements), - boost::python::error_already_set); + const boost::python::error_already_set &); } private: diff --git a/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp b/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp index bd57c037ee9..b6ff482701a 100644 --- a/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp +++ b/Framework/PythonInterface/test/testhelpers/WorkspaceCreationHelperModule.cpp @@ -55,7 +55,8 @@ BOOST_PYTHON_MODULE(WorkspaceCreationHelper) { //=================================== // Function pointers to disambiguate the calls - using Signature1_2D = Workspace2D_sptr (*)(int, int, bool, bool); + using Signature1_2D = Workspace2D_sptr (*)(int, int, bool, bool, bool, + const std::string &, bool); using Signature2_2D = Workspace2D_sptr (*)(int, int, int); using Signature3_2D = Workspace2D_sptr (*)(int, int, int, int); @@ -82,7 +83,7 @@ BOOST_PYTHON_MODULE(WorkspaceCreationHelper) { //=================================== def("createPeaksWorkspace", - reinterpret_cast<PeaksWorkspace_sptr (*)(const int)>( + reinterpret_cast<PeaksWorkspace_sptr (*)(const int, bool)>( createPeaksWorkspace), return_value_policy<AsType<Workspace_sptr>>()); def("createPeaksWorkspace", @@ -93,8 +94,9 @@ BOOST_PYTHON_MODULE(WorkspaceCreationHelper) { //=================================== // Typedef for function pointer to disabiguate references - using Signature1_MDHisto = MDHistoWorkspace_sptr (*)( - double, size_t, size_t, Mantid::coord_t, double, std::string, double); + using Signature1_MDHisto = + MDHistoWorkspace_sptr (*)(double, size_t, size_t, Mantid::coord_t, double, + const std::string &, double); def("makeFakeMDHistoWorkspace", (Signature1_MDHisto)&makeFakeMDHistoWorkspace, makeFakeMDHistoWorkspace_overloads() diff --git a/Framework/RemoteAlgorithms/test/AbortRemoteJob2Test.h b/Framework/RemoteAlgorithms/test/AbortRemoteJob2Test.h index 8ab884af9ed..c750685a4d9 100644 --- a/Framework/RemoteAlgorithms/test/AbortRemoteJob2Test.h +++ b/Framework/RemoteAlgorithms/test/AbortRemoteJob2Test.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); AbortRemoteJob2 alg3; @@ -75,7 +75,7 @@ public: // compute resource missing TS_ASSERT_THROWS_NOTHING(alg1.setPropertyValue("JobID", "john_missing")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); } @@ -83,11 +83,11 @@ public: AbortRemoteJob2 ab; TS_ASSERT_THROWS_NOTHING(ab.initialize();) TS_ASSERT_THROWS(ab.setPropertyValue("ComputeRes", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ab.setPropertyValue("username", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ab.setPropertyValue("sername", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_wrongResource() { @@ -95,7 +95,7 @@ public: TS_ASSERT_THROWS_NOTHING(ab.initialize()); // the compute resource given does not exist: TS_ASSERT_THROWS(ab.setPropertyValue("ComputeResource", "missing c r!"), - std::invalid_argument); + const std::invalid_argument &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/AbortRemoteJobTest.h b/Framework/RemoteAlgorithms/test/AbortRemoteJobTest.h index 3688923a6a8..8d08bc48543 100644 --- a/Framework/RemoteAlgorithms/test/AbortRemoteJobTest.h +++ b/Framework/RemoteAlgorithms/test/AbortRemoteJobTest.h @@ -63,9 +63,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); AbortRemoteJob alg3; @@ -73,7 +73,7 @@ public: // compute resource missing TS_ASSERT_THROWS_NOTHING(alg1.setPropertyValue("JobID", "john_missing")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); } @@ -81,11 +81,11 @@ public: AbortRemoteJob ab; TS_ASSERT_THROWS_NOTHING(ab.initialize();) TS_ASSERT_THROWS(ab.setPropertyValue("ComputeRes", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ab.setPropertyValue("username", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ab.setPropertyValue("sername", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_wrongResource() { @@ -93,7 +93,7 @@ public: TS_ASSERT_THROWS_NOTHING(ab.initialize()); // the compute resource given does not exist: TS_ASSERT_THROWS(ab.setPropertyValue("ComputeResource", "missing c r!"), - std::invalid_argument); + const std::invalid_argument &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/Authenticate2Test.h b/Framework/RemoteAlgorithms/test/Authenticate2Test.h index e8a39e62872..71b557a06f5 100644 --- a/Framework/RemoteAlgorithms/test/Authenticate2Test.h +++ b/Framework/RemoteAlgorithms/test/Authenticate2Test.h @@ -63,9 +63,9 @@ public: // password missing TS_ASSERT_THROWS_NOTHING(alg1.setPropertyValue("UserName", "john_missing")); TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); Authenticate2 alg2; @@ -73,9 +73,9 @@ public: // username missing TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("Password", "LogIn")); TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); Authenticate2 alg3; @@ -84,7 +84,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg3.setPropertyValue("UserName", "john_missing")); TS_ASSERT_THROWS_NOTHING(alg3.setPropertyValue("Password", "LogIn")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); } @@ -92,11 +92,11 @@ public: Authenticate2 auth; TS_ASSERT_THROWS_NOTHING(auth.initialize()); TS_ASSERT_THROWS(auth.setPropertyValue("usernam", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(auth.setPropertyValue("sername", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(auth.setPropertyValue("Passwo", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/AuthenticateTest.h b/Framework/RemoteAlgorithms/test/AuthenticateTest.h index d317c10560e..f3ec5bc35ca 100644 --- a/Framework/RemoteAlgorithms/test/AuthenticateTest.h +++ b/Framework/RemoteAlgorithms/test/AuthenticateTest.h @@ -63,9 +63,9 @@ public: // password missing TS_ASSERT_THROWS_NOTHING(alg1.setPropertyValue("UserName", "john_missing")); TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); Authenticate alg2; @@ -73,9 +73,9 @@ public: // username missing TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("Password", "LogIn")); TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); Authenticate alg3; @@ -84,7 +84,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg3.setPropertyValue("UserName", "john_missing")); TS_ASSERT_THROWS_NOTHING(alg3.setPropertyValue("Password", "LogIn")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); } @@ -92,11 +92,11 @@ public: Authenticate auth; TS_ASSERT_THROWS_NOTHING(auth.initialize()); TS_ASSERT_THROWS(auth.setPropertyValue("usernam", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(auth.setPropertyValue("sername", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(auth.setPropertyValue("Passwo", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/DownloadRemoteFile2Test.h b/Framework/RemoteAlgorithms/test/DownloadRemoteFile2Test.h index ff7e6a72de0..1c1adf0ddf7 100644 --- a/Framework/RemoteAlgorithms/test/DownloadRemoteFile2Test.h +++ b/Framework/RemoteAlgorithms/test/DownloadRemoteFile2Test.h @@ -65,21 +65,21 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // Transaction id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( alg1.setPropertyValue("RemoteFileName", "file name")); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); DownloadRemoteFile2 alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); // file name missing TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("TransactionID", "id001")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); DownloadRemoteFile2 alg3; @@ -89,7 +89,7 @@ public: alg3.setPropertyValue("RemoteFileName", "file name")); TS_ASSERT_THROWS_NOTHING(alg3.setPropertyValue("TransactionID", "id001")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); } @@ -97,11 +97,11 @@ public: DownloadRemoteFile2 dl; TS_ASSERT_THROWS_NOTHING(dl.initialize();) TS_ASSERT_THROWS(dl.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(dl.setPropertyValue("TransID", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(dl.setPropertyValue("FileName", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/DownloadRemoteFileTest.h b/Framework/RemoteAlgorithms/test/DownloadRemoteFileTest.h index df257dd891c..8dddb2d8c80 100644 --- a/Framework/RemoteAlgorithms/test/DownloadRemoteFileTest.h +++ b/Framework/RemoteAlgorithms/test/DownloadRemoteFileTest.h @@ -65,21 +65,21 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // Transaction id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING( alg1.setPropertyValue("RemoteFileName", "file name")); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); DownloadRemoteFile alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); // file name missing TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("TransactionID", "id001")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); DownloadRemoteFile alg3; @@ -89,7 +89,7 @@ public: alg3.setPropertyValue("RemoteFileName", "file name")); TS_ASSERT_THROWS_NOTHING(alg3.setPropertyValue("TransactionID", "id001")); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); } @@ -97,11 +97,11 @@ public: DownloadRemoteFile dl; TS_ASSERT_THROWS_NOTHING(dl.initialize();) TS_ASSERT_THROWS(dl.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(dl.setPropertyValue("TransID", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(dl.setPropertyValue("FileName", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/Logout2Test.h b/Framework/RemoteAlgorithms/test/Logout2Test.h index 4450d87d0e3..3d5a0f2ad3f 100644 --- a/Framework/RemoteAlgorithms/test/Logout2Test.h +++ b/Framework/RemoteAlgorithms/test/Logout2Test.h @@ -58,9 +58,9 @@ public: TS_ASSERT_THROWS_NOTHING(lo.initialize()); // username missing TS_ASSERT_THROWS(lo.setPropertyValue("ComputeResource", "anything"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(lo.execute(), std::runtime_error); + TS_ASSERT_THROWS(lo.execute(), const std::runtime_error &); TS_ASSERT(!lo.isExecuted()); } @@ -68,7 +68,7 @@ public: Logout2 lo; TS_ASSERT_THROWS_NOTHING(lo.initialize()); TS_ASSERT_THROWS(lo.setPropertyValue("usernam", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_runOK() { diff --git a/Framework/RemoteAlgorithms/test/QueryAllRemoteJobs2Test.h b/Framework/RemoteAlgorithms/test/QueryAllRemoteJobs2Test.h index f34042415ed..10c105ae88d 100644 --- a/Framework/RemoteAlgorithms/test/QueryAllRemoteJobs2Test.h +++ b/Framework/RemoteAlgorithms/test/QueryAllRemoteJobs2Test.h @@ -66,7 +66,7 @@ public: // compute resource missing TS_ASSERT_THROWS_NOTHING(qar.setPropertyValue("JobID", "john_missing")); - TS_ASSERT_THROWS(qar.execute(), std::runtime_error); + TS_ASSERT_THROWS(qar.execute(), const std::runtime_error &); TS_ASSERT(!qar.isExecuted()); } @@ -74,11 +74,11 @@ public: QueryAllRemoteJobs2 qar; TS_ASSERT_THROWS_NOTHING(qar.initialize();) TS_ASSERT_THROWS(qar.setPropertyValue("ComputeRes", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qar.setPropertyValue("TransactionID", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qar.setPropertyValue("ID", "whichever"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/QueryAllRemoteJobsTest.h b/Framework/RemoteAlgorithms/test/QueryAllRemoteJobsTest.h index 10ffb61fc81..dd2d09dd916 100644 --- a/Framework/RemoteAlgorithms/test/QueryAllRemoteJobsTest.h +++ b/Framework/RemoteAlgorithms/test/QueryAllRemoteJobsTest.h @@ -66,7 +66,7 @@ public: // compute resource missing TS_ASSERT_THROWS_NOTHING(qar.setPropertyValue("JobID", "john_missing")); - TS_ASSERT_THROWS(qar.execute(), std::runtime_error); + TS_ASSERT_THROWS(qar.execute(), const std::runtime_error &); TS_ASSERT(!qar.isExecuted()); } @@ -74,11 +74,11 @@ public: QueryAllRemoteJobs qar; TS_ASSERT_THROWS_NOTHING(qar.initialize();) TS_ASSERT_THROWS(qar.setPropertyValue("ComputeRes", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qar.setPropertyValue("TransactionID", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qar.setPropertyValue("ID", "whichever"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/QueryRemoteFile2Test.h b/Framework/RemoteAlgorithms/test/QueryRemoteFile2Test.h index 2bf0ba6575b..59d94d1a571 100644 --- a/Framework/RemoteAlgorithms/test/QueryRemoteFile2Test.h +++ b/Framework/RemoteAlgorithms/test/QueryRemoteFile2Test.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // Transaction id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); QueryRemoteFile2 alg2; @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("TransactionID", "trans0001")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -84,11 +84,11 @@ public: QueryRemoteFile2 qrf; TS_ASSERT_THROWS_NOTHING(qrf.initialize();) TS_ASSERT_THROWS(qrf.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qrf.setPropertyValue("TransID", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qrf.setPropertyValue("ComputeResourc", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/QueryRemoteFileTest.h b/Framework/RemoteAlgorithms/test/QueryRemoteFileTest.h index fd8ed889050..a8d99fa7a39 100644 --- a/Framework/RemoteAlgorithms/test/QueryRemoteFileTest.h +++ b/Framework/RemoteAlgorithms/test/QueryRemoteFileTest.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // Transaction id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); QueryRemoteFile alg2; @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("TransactionID", "trans0001")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -84,11 +84,11 @@ public: QueryRemoteFile qrf; TS_ASSERT_THROWS_NOTHING(qrf.initialize();) TS_ASSERT_THROWS(qrf.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qrf.setPropertyValue("TransID", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qrf.setPropertyValue("ComputeResourc", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/QueryRemoteJob2Test.h b/Framework/RemoteAlgorithms/test/QueryRemoteJob2Test.h index b983bb2c725..56af2dae1b0 100644 --- a/Framework/RemoteAlgorithms/test/QueryRemoteJob2Test.h +++ b/Framework/RemoteAlgorithms/test/QueryRemoteJob2Test.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); QueryRemoteJob2 alg2; @@ -75,7 +75,7 @@ public: // compute resource missing TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("JobID", "missing001")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -83,11 +83,11 @@ public: QueryRemoteJob2 qr; TS_ASSERT_THROWS_NOTHING(qr.initialize();) TS_ASSERT_THROWS(qr.setPropertyValue("job", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qr.setPropertyValue("id", "whichever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qr.setPropertyValue("ComputeRes", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/QueryRemoteJobTest.h b/Framework/RemoteAlgorithms/test/QueryRemoteJobTest.h index a19ffdf59dc..b30d9204422 100644 --- a/Framework/RemoteAlgorithms/test/QueryRemoteJobTest.h +++ b/Framework/RemoteAlgorithms/test/QueryRemoteJobTest.h @@ -63,9 +63,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); QueryRemoteJob alg2; @@ -73,7 +73,7 @@ public: // compute resource missing TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("JobID", "missing001")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -81,11 +81,11 @@ public: QueryRemoteJob qr; TS_ASSERT_THROWS_NOTHING(qr.initialize();) TS_ASSERT_THROWS(qr.setPropertyValue("job", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qr.setPropertyValue("id", "whichever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(qr.setPropertyValue("ComputeRes", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/SimpleJSONTest.h b/Framework/RemoteAlgorithms/test/SimpleJSONTest.h index e8a3059bb22..2394ecc9ea9 100644 --- a/Framework/RemoteAlgorithms/test/SimpleJSONTest.h +++ b/Framework/RemoteAlgorithms/test/SimpleJSONTest.h @@ -71,26 +71,26 @@ public: str = ""; JSONObject jo; - TS_ASSERT_THROWS(initFromStream(jo, input), JSONParseException); + TS_ASSERT_THROWS(initFromStream(jo, input), const JSONParseException &); TS_ASSERT_THROWS_NOTHING(jo["no_param"].getValue(res)); TS_ASSERT_EQUALS(false, jo["no_param"].getValue(res)); TS_ASSERT_EQUALS(res, ""); TS_ASSERT_EQUALS(false, jo["another_no_param"].getValue(res)); TS_ASSERT_EQUALS(res, ""); - TS_ASSERT_THROWS(initFromStream(jo, input), JSONParseException); + TS_ASSERT_THROWS(initFromStream(jo, input), const JSONParseException &); TS_ASSERT_THROWS_NOTHING(jo["doesnt_exist"].getValue(res)); TS_ASSERT_EQUALS(false, jo["doesnt_exist"].getValue(res)); TS_ASSERT_EQUALS(res, ""); str = "{ mistake: }"; - TS_ASSERT_THROWS(initFromStream(jo, input), JSONParseException); + TS_ASSERT_THROWS(initFromStream(jo, input), const JSONParseException &); TS_ASSERT_THROWS_NOTHING(jo["no no"].getValue(res)); TS_ASSERT_EQUALS(false, jo["it's not here"].getValue(res)); TS_ASSERT_EQUALS(res, ""); str = "{ "; - TS_ASSERT_THROWS(initFromStream(jo, input), JSONParseException); + TS_ASSERT_THROWS(initFromStream(jo, input), const JSONParseException &); TS_ASSERT_THROWS_NOTHING(jo["no no"].getValue(res)); TS_ASSERT_EQUALS(false, jo["it's not here"].getValue(res)); TS_ASSERT_EQUALS(res, ""); @@ -104,7 +104,7 @@ public: std::string res; JSONObject o; - TS_ASSERT_THROWS(initFromStream(o, input), JSONParseException); + TS_ASSERT_THROWS(initFromStream(o, input), const JSONParseException &); TS_ASSERT_THROWS_NOTHING(o["Err_Msg"].getValue(res)); TS_ASSERT_EQUALS(false, o["Err_Msg"].getValue(res)); TS_ASSERT_EQUALS(res, ""); @@ -206,7 +206,7 @@ public: std::string str = "json failure here"; std::istringstream istr(str); JSONObject jo; - TS_ASSERT_THROWS(initFromStream(jo, istr), JSONParseException); + TS_ASSERT_THROWS(initFromStream(jo, istr), const JSONParseException &); TS_ASSERT_THROWS_NOTHING(prettyPrint(jo, out, 0)); std::string strOK = R"({ "key1": "val1"})"; diff --git a/Framework/RemoteAlgorithms/test/StartRemoteTransaction2Test.h b/Framework/RemoteAlgorithms/test/StartRemoteTransaction2Test.h index f5308f9acd6..099121ea9bd 100644 --- a/Framework/RemoteAlgorithms/test/StartRemoteTransaction2Test.h +++ b/Framework/RemoteAlgorithms/test/StartRemoteTransaction2Test.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); StartRemoteTransaction2 alg2; @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("TransactionID", "john_missing")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -84,11 +84,11 @@ public: StartRemoteTransaction2 start; TS_ASSERT_THROWS_NOTHING(start.initialize();) TS_ASSERT_THROWS(start.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(start.setPropertyValue("Transaction", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(start.setPropertyValue("ID", "whichever"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/StartRemoteTransactionTest.h b/Framework/RemoteAlgorithms/test/StartRemoteTransactionTest.h index aef6a27885a..ef28d1ed2e0 100644 --- a/Framework/RemoteAlgorithms/test/StartRemoteTransactionTest.h +++ b/Framework/RemoteAlgorithms/test/StartRemoteTransactionTest.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); StartRemoteTransaction alg2; @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("TransactionID", "john_missing")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -84,11 +84,11 @@ public: StartRemoteTransaction start; TS_ASSERT_THROWS_NOTHING(start.initialize();) TS_ASSERT_THROWS(start.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(start.setPropertyValue("Transaction", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(start.setPropertyValue("ID", "whichever"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/StopRemoteTransaction2Test.h b/Framework/RemoteAlgorithms/test/StopRemoteTransaction2Test.h index 9337e07bf6a..fe32b43e6e7 100644 --- a/Framework/RemoteAlgorithms/test/StopRemoteTransaction2Test.h +++ b/Framework/RemoteAlgorithms/test/StopRemoteTransaction2Test.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // transaction id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); StopRemoteTransaction2 alg2; @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("TransactionID", "john_missing")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -84,13 +84,13 @@ public: StopRemoteTransaction2 stop; TS_ASSERT_THROWS_NOTHING(stop.initialize();) TS_ASSERT_THROWS(stop.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(stop.setPropertyValue("Transaction", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(stop.setPropertyValue("JobID", "whichever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(stop.setPropertyValue("ID", "whichever"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/StopRemoteTransactionTest.h b/Framework/RemoteAlgorithms/test/StopRemoteTransactionTest.h index a844fb85366..ecd6169e6a9 100644 --- a/Framework/RemoteAlgorithms/test/StopRemoteTransactionTest.h +++ b/Framework/RemoteAlgorithms/test/StopRemoteTransactionTest.h @@ -65,9 +65,9 @@ public: TS_ASSERT_THROWS_NOTHING(alg1.initialize()); // transaction id missing TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); StopRemoteTransaction alg2; @@ -76,7 +76,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("TransactionID", "john_missing")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); } @@ -84,13 +84,13 @@ public: StopRemoteTransaction stop; TS_ASSERT_THROWS_NOTHING(stop.initialize();) TS_ASSERT_THROWS(stop.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(stop.setPropertyValue("Transaction", "whatever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(stop.setPropertyValue("JobID", "whichever"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(stop.setPropertyValue("ID", "whichever"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/SubmitRemoteJob2Test.h b/Framework/RemoteAlgorithms/test/SubmitRemoteJob2Test.h index 0187f050bdc..573d7fff5f6 100644 --- a/Framework/RemoteAlgorithms/test/SubmitRemoteJob2Test.h +++ b/Framework/RemoteAlgorithms/test/SubmitRemoteJob2Test.h @@ -72,23 +72,23 @@ public: TS_ASSERT_THROWS_NOTHING( alg1.setPropertyValue("ScriptParams", "print 'hello world'")); TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); SubmitRemoteJob2 alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); // task name name missing TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("TransactionID", "id001")); TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("ScriptName", "test script")); TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("ScriptParams", "print 'hello world'")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); SubmitRemoteJob2 alg3; @@ -99,9 +99,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg3.setPropertyValue("ScriptParams", "print 'hello world'")); TS_ASSERT_THROWS(alg3.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); SubmitRemoteJob2 alg4; @@ -114,7 +114,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg4.setPropertyValue("ScriptParams", "print 'hello world'")); - TS_ASSERT_THROWS(alg4.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg4.execute(), const std::runtime_error &); TS_ASSERT(!alg4.isExecuted()); SubmitRemoteJob2 alg5; @@ -125,9 +125,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg5.setPropertyValue("ScriptName", "test script")); TS_ASSERT_THROWS(alg5.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg5.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg5.execute(), const std::runtime_error &); TS_ASSERT(!alg5.isExecuted()); } @@ -135,26 +135,26 @@ public: SubmitRemoteJob2 s; TS_ASSERT_THROWS_NOTHING(s.initialize();) TS_ASSERT_THROWS(s.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("NumNodes", "anything"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("NumNodes", "-3"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("CoresPerNode", "anything"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("Task", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("Name", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("Transaction", "anything"), - std::runtime_error); - TS_ASSERT_THROWS(s.setPropertyValue("ID", "anything"), std::runtime_error); + const std::runtime_error &); + TS_ASSERT_THROWS(s.setPropertyValue("ID", "anything"), const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("ScriptName", ""), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("Scrip", "any name"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("ScriptParams", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/SubmitRemoteJobTest.h b/Framework/RemoteAlgorithms/test/SubmitRemoteJobTest.h index a82e207c935..841537b11fc 100644 --- a/Framework/RemoteAlgorithms/test/SubmitRemoteJobTest.h +++ b/Framework/RemoteAlgorithms/test/SubmitRemoteJobTest.h @@ -72,23 +72,23 @@ public: TS_ASSERT_THROWS_NOTHING( alg1.setPropertyValue("PythonScript", "print 'hello world'")); TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); SubmitRemoteJob alg2; TS_ASSERT_THROWS_NOTHING(alg2.initialize()); // task name name missing TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg2.setPropertyValue("TransactionID", "id001")); TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("ScriptName", "test script")); TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("PythonScript", "print 'hello world'")); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); SubmitRemoteJob alg3; @@ -99,9 +99,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg3.setPropertyValue("PythonScript", "print 'hello world'")); TS_ASSERT_THROWS(alg3.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); SubmitRemoteJob alg4; @@ -114,7 +114,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg4.setPropertyValue("PythonScript", "print 'hello world'")); - TS_ASSERT_THROWS(alg4.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg4.execute(), const std::runtime_error &); TS_ASSERT(!alg4.isExecuted()); SubmitRemoteJob alg5; @@ -125,9 +125,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg5.setPropertyValue("ScriptName", "test script")); TS_ASSERT_THROWS(alg5.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg5.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg5.execute(), const std::runtime_error &); TS_ASSERT(!alg5.isExecuted()); } @@ -135,26 +135,26 @@ public: SubmitRemoteJob s; TS_ASSERT_THROWS_NOTHING(s.initialize();) TS_ASSERT_THROWS(s.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("NumNodes", "anything"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("NumNodes", "-3"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("CoresPerNode", "anything"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("Task", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("Name", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("Transaction", "anything"), - std::runtime_error); - TS_ASSERT_THROWS(s.setPropertyValue("ID", "anything"), std::runtime_error); + const std::runtime_error &); + TS_ASSERT_THROWS(s.setPropertyValue("ID", "anything"), const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("ScriptName", ""), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(s.setPropertyValue("Scrip", "any name"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(s.setPropertyValue("PythonScript", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/UploadRemoteFile2Test.h b/Framework/RemoteAlgorithms/test/UploadRemoteFile2Test.h index 9eb8a14d9bd..ee128c52a34 100644 --- a/Framework/RemoteAlgorithms/test/UploadRemoteFile2Test.h +++ b/Framework/RemoteAlgorithms/test/UploadRemoteFile2Test.h @@ -69,9 +69,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg1.setPropertyValue("LocalFileName", "local file name")); TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); UploadRemoteFile2 alg2; @@ -81,9 +81,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("LocalFileName", "local file name")); TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); UploadRemoteFile2 alg3; @@ -93,9 +93,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg3.setPropertyValue("RemoteFileName", "remote file name")); TS_ASSERT_THROWS(alg3.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); UploadRemoteFile2 alg4; @@ -105,7 +105,7 @@ public: alg4.setPropertyValue("RemoteFileName", "file name")); TS_ASSERT_THROWS_NOTHING(alg4.setPropertyValue("TransactionID", "id001")); - TS_ASSERT_THROWS(alg4.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg4.execute(), const std::runtime_error &); TS_ASSERT(!alg4.isExecuted()); } @@ -113,15 +113,15 @@ public: UploadRemoteFile2 ul; TS_ASSERT_THROWS_NOTHING(ul.initialize();) TS_ASSERT_THROWS(ul.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("TransID", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("RemoteFile", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("FileName", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("LocalFile", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteAlgorithms/test/UploadRemoteFileTest.h b/Framework/RemoteAlgorithms/test/UploadRemoteFileTest.h index 1295a84f750..62ca78e02ca 100644 --- a/Framework/RemoteAlgorithms/test/UploadRemoteFileTest.h +++ b/Framework/RemoteAlgorithms/test/UploadRemoteFileTest.h @@ -69,9 +69,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg1.setPropertyValue("LocalFileName", "local file name")); TS_ASSERT_THROWS(alg1.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg1.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg1.execute(), const std::runtime_error &); TS_ASSERT(!alg1.isExecuted()); UploadRemoteFile alg2; @@ -81,9 +81,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg2.setPropertyValue("LocalFileName", "local file name")); TS_ASSERT_THROWS(alg2.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg2.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg2.execute(), const std::runtime_error &); TS_ASSERT(!alg2.isExecuted()); UploadRemoteFile alg3; @@ -93,9 +93,9 @@ public: TS_ASSERT_THROWS_NOTHING( alg3.setPropertyValue("RemoteFileName", "remote file name")); TS_ASSERT_THROWS(alg3.setPropertyValue("ComputeResource", "missing!"), - std::invalid_argument); + const std::invalid_argument &); - TS_ASSERT_THROWS(alg3.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg3.execute(), const std::runtime_error &); TS_ASSERT(!alg3.isExecuted()); UploadRemoteFile alg4; @@ -105,7 +105,7 @@ public: alg4.setPropertyValue("RemoteFileName", "file name")); TS_ASSERT_THROWS_NOTHING(alg4.setPropertyValue("TransactionID", "id001")); - TS_ASSERT_THROWS(alg4.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg4.execute(), const std::runtime_error &); TS_ASSERT(!alg4.isExecuted()); } @@ -113,15 +113,15 @@ public: UploadRemoteFile ul; TS_ASSERT_THROWS_NOTHING(ul.initialize();) TS_ASSERT_THROWS(ul.setPropertyValue("Compute", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("TransID", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("RemoteFile", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("FileName", "anything"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(ul.setPropertyValue("LocalFile", "anything"), - std::runtime_error); + const std::runtime_error &); } void test_propertiesOK() { diff --git a/Framework/RemoteJobManagers/test/MantidWebServiceAPIJobManagerTest.h b/Framework/RemoteJobManagers/test/MantidWebServiceAPIJobManagerTest.h index 9a48e2a6e89..2e6ccae27fc 100644 --- a/Framework/RemoteJobManagers/test/MantidWebServiceAPIJobManagerTest.h +++ b/Framework/RemoteJobManagers/test/MantidWebServiceAPIJobManagerTest.h @@ -184,7 +184,7 @@ public: " should fail", IRemoteJobManager_sptr jobManager = RemoteJobManagerFactory::Instance().create(FermiName), - std::runtime_error); + const std::runtime_error &); // restore facility to what it was before test Mantid::Kernel::ConfigService::Instance().setFacility(prevFac.name()); @@ -226,21 +226,21 @@ public: // response is empty or inconsistent). MockMantidAPIStatusNotFound jm; TSM_ASSERT_THROWS("abort job without job ID should throw", - jm.abortRemoteJob(""), JSONParseException); + jm.abortRemoteJob(""), const JSONParseException &); TSM_ASSERT_THROWS("abort job with wrong job ID should throw", - jm.abortRemoteJob("anything_wrong"), JSONParseException); + jm.abortRemoteJob("anything_wrong"), const JSONParseException &); TSM_ASSERT_THROWS("download with wrong transaction ID should throw", jm.downloadRemoteFile("any_wrong_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); // Note that as an exception queryAllRemoteJobs does a bit more of // checking and throws std::runtime_error when something is wrong // in the server response. std::vector<IRemoteJobManager::RemoteJobInfo> infos; TSM_ASSERT_THROWS("query all jobs without logging in should throw", - infos = jm.queryAllRemoteJobs(), std::runtime_error); + infos = jm.queryAllRemoteJobs(), const std::runtime_error &); TSM_ASSERT_EQUALS( "there should not be any job information returned from the remote", infos.size(), 0); @@ -248,43 +248,43 @@ public: std::vector<std::string> files; TSM_ASSERT_THROWS( "query remote files with wrong transaction ID should throw", - files = jm.queryRemoteFile("any_wrong_transID"), JSONParseException); + files = jm.queryRemoteFile("any_wrong_transID"), const JSONParseException &); TSM_ASSERT_EQUALS("The file list for a wrong transaction should be empty", files.size(), 0); IRemoteJobManager::RemoteJobInfo info; TSM_ASSERT_THROWS("query job info should throw for wrong job ID", info = jm.queryRemoteJob("any_wrong_jobID"), - JSONParseException); + const JSONParseException &); std::string id; TSM_ASSERT_THROWS("start transaction without logging in should throw", - id = jm.startRemoteTransaction(), JSONParseException); + id = jm.startRemoteTransaction(), const JSONParseException &); TSM_ASSERT_EQUALS("failed start transaction should not return any ID", id, ""); TSM_ASSERT_THROWS("stop transaction without logging in should throw", jm.stopRemoteTransaction("a_wrong_transID"), - JSONParseException); + const JSONParseException &); std::string jobID; TSM_ASSERT_THROWS("submit job without logging in should throw", id = jm.submitRemoteJob("a_wrong_transID", "executable", "--params 0", "name_for_job"), - JSONParseException); + const JSONParseException &); TSM_ASSERT_EQUALS("failed submit job should not return any ID", jobID, ""); TSM_ASSERT_THROWS( "upload file without logging in should throw", jm.uploadRemoteFile("wrong_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); // and failed login at the end TSM_ASSERT_THROWS("authenticate with empty credentials should throw", - jm.authenticate("", ""), JSONParseException); + jm.authenticate("", ""), const JSONParseException &); TSM_ASSERT_THROWS("mocked authenticate should throw", jm.authenticate("wrong_user", "no_pass"), - JSONParseException); + const JSONParseException &); } private: @@ -305,24 +305,24 @@ private: std::vector<IRemoteJobManager::RemoteJobInfo> infos; TSM_ASSERT_THROWS("query all jobs with ok response code but no content " "from server should throw", - infos = jm.queryAllRemoteJobs(), std::runtime_error); + infos = jm.queryAllRemoteJobs(), const std::runtime_error &); std::vector<std::string> files; TSM_ASSERT_THROWS("query remote files with ok response code but no content " "from server should throw", - files = jm.queryRemoteFile("any"), JSONParseException); + files = jm.queryRemoteFile("any"), const JSONParseException &); TSM_ASSERT_EQUALS("The file list for a transaction should be empty", files.size(), 0); IRemoteJobManager::RemoteJobInfo info; TSM_ASSERT_THROWS("query job info with ok response code from but no " "content from server should throw", - info = jm.queryRemoteJob("any"), JSONParseException); + info = jm.queryRemoteJob("any"), const JSONParseException &); std::string id; TSM_ASSERT_THROWS("start transaction with ok response code but no content " "from server should throw", - id = jm.startRemoteTransaction(), JSONParseException); + id = jm.startRemoteTransaction(), const JSONParseException &); TSM_ASSERT_EQUALS("failed start transaction should not return any ID", id, ""); @@ -335,7 +335,7 @@ private: "server should throw", id = jm.submitRemoteJob("a_wrong_transID", "executable", "--params 0", "name_for_job"), - JSONParseException); + const JSONParseException &); TSM_ASSERT_EQUALS("mock submit job should not return non-empty ID", jobID, ""); @@ -343,7 +343,7 @@ private: "upload file with ok response code but no content from server should " "throw", jm.uploadRemoteFile("wrong_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); } // for when the server returns status != HTTP_OK and a correctly @@ -351,56 +351,56 @@ private: void checkJMWithErrResponse(MantidWebServiceAPIJobManager &jm) { TSM_ASSERT_THROWS( "abort job with error response code from server should throw", - jm.abortRemoteJob("anything"), JSONParseException); + jm.abortRemoteJob("anything"), const JSONParseException &); TSM_ASSERT_THROWS( "authenticate with error response code from server should throw", - jm.authenticate("any_user", "any_pass"), JSONParseException); + jm.authenticate("any_user", "any_pass"), const JSONParseException &); TSM_ASSERT_THROWS( "download with error response code from server should throw", jm.downloadRemoteFile("any_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); std::vector<IRemoteJobManager::RemoteJobInfo> infos; TSM_ASSERT_THROWS( "query all jobs with error response from server should throw", - infos = jm.queryAllRemoteJobs(), std::runtime_error); + infos = jm.queryAllRemoteJobs(), const std::runtime_error &); std::vector<std::string> files; TSM_ASSERT_THROWS( "query remote files with error response code from server should throw", - files = jm.queryRemoteFile("any"), JSONParseException); + files = jm.queryRemoteFile("any"), const JSONParseException &); TSM_ASSERT_EQUALS("The file list for a wrong transaction should be empty", files.size(), 0); IRemoteJobManager::RemoteJobInfo info; TSM_ASSERT_THROWS( "query job info with error response from server should throw", - info = jm.queryRemoteJob("any"), JSONParseException); + info = jm.queryRemoteJob("any"), const JSONParseException &); std::string id; TSM_ASSERT_THROWS( "start transaction with error response from server should throw", - id = jm.startRemoteTransaction(), JSONParseException); + id = jm.startRemoteTransaction(), const JSONParseException &); TSM_ASSERT_EQUALS("failed start transaction should not return any ID", id, ""); TSM_ASSERT_THROWS( "stop transaction with error response from server should throw", - jm.stopRemoteTransaction("a_wrong_transID"), JSONParseException); + jm.stopRemoteTransaction("a_wrong_transID"), const JSONParseException &); std::string jobID; TSM_ASSERT_THROWS("submit job with error response from server should throw", id = jm.submitRemoteJob("a_wrong_transID", "executable", "--params 0", "name_for_job"), - JSONParseException); + const JSONParseException &); TSM_ASSERT_EQUALS("failed submit job should not return any ID", jobID, ""); TSM_ASSERT_THROWS( "upload file with error response from server should throw", jm.uploadRemoteFile("wrong_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); } // for when the server returns an status code != HTTP_OK but the @@ -409,61 +409,61 @@ private: void checkJMErrWithoutErrMessage(MantidWebServiceAPIJobManager &jm) { TSM_ASSERT_THROWS("abort job with error response code but no content from " "server should throw", - jm.abortRemoteJob("anything"), JSONParseException); + jm.abortRemoteJob("anything"), const JSONParseException &); TSM_ASSERT_THROWS( "authenticate with error response code but no content from server but " "no content should throw", - jm.authenticate("any_user", "any_pass"), JSONParseException); + jm.authenticate("any_user", "any_pass"), const JSONParseException &); TSM_ASSERT_THROWS( "download with error response code but no content from server should " "throw", jm.downloadRemoteFile("any_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); std::vector<IRemoteJobManager::RemoteJobInfo> infos; TSM_ASSERT_THROWS("query all jobs with error response from but no content " "server should throw", - infos = jm.queryAllRemoteJobs(), std::runtime_error); + infos = jm.queryAllRemoteJobs(), const std::runtime_error &); std::vector<std::string> files; TSM_ASSERT_THROWS("query remote files with error response code but no " "content from server should throw", - files = jm.queryRemoteFile("any"), JSONParseException); + files = jm.queryRemoteFile("any"), const JSONParseException &); TSM_ASSERT_EQUALS("The file list for a wrong transaction should be empty", files.size(), 0); IRemoteJobManager::RemoteJobInfo info; TSM_ASSERT_THROWS("query job info with error response but no content from " "server should throw", - info = jm.queryRemoteJob("any"), JSONParseException); + info = jm.queryRemoteJob("any"), const JSONParseException &); std::string id; TSM_ASSERT_THROWS("start transaction with error response but no content " "from server should throw", - id = jm.startRemoteTransaction(), JSONParseException); + id = jm.startRemoteTransaction(), const JSONParseException &); TSM_ASSERT_EQUALS("failed start transaction should not return any ID", id, ""); TSM_ASSERT_THROWS("stop transaction with error response but no content " "from server should throw", jm.stopRemoteTransaction("a_wrong_transID"), - JSONParseException); + const JSONParseException &); std::string jobID; TSM_ASSERT_THROWS("submit job with error response but no content from " "server should throw", id = jm.submitRemoteJob("a_wrong_transID", "executable", "--params 0", "name_for_job"), - JSONParseException); + const JSONParseException &); TSM_ASSERT_EQUALS("failed submit job should not return any ID", jobID, ""); TSM_ASSERT_THROWS( "upload file with error response but no content from server should " "throw", jm.uploadRemoteFile("wrong_transID", "remote_fname", "local_fname"), - JSONParseException); + const JSONParseException &); } static const std::string SNSFac; diff --git a/Framework/SINQ/src/PoldiUtilities/PoldiBasicChopper.cpp b/Framework/SINQ/src/PoldiUtilities/PoldiBasicChopper.cpp index 45de06c905f..82238841208 100644 --- a/Framework/SINQ/src/PoldiUtilities/PoldiBasicChopper.cpp +++ b/Framework/SINQ/src/PoldiUtilities/PoldiBasicChopper.cpp @@ -32,7 +32,7 @@ void PoldiBasicChopper::loadConfiguration( std::vector<double> slitPositions(numberOfSlits); for (size_t i = 0; i < numberOfSlits; ++i) { slitPositions[i] = - chopperGroup->getChild(static_cast<const int>(i))->getPos().X(); + chopperGroup->getChild(static_cast<int>(i))->getPos().X(); } double distance = chopperGroup->getPos().norm() * 1000.0; diff --git a/Framework/SINQ/test/MillerIndicesIOTest.h b/Framework/SINQ/test/MillerIndicesIOTest.h index bb3af443eb0..02b20c20382 100644 --- a/Framework/SINQ/test/MillerIndicesIOTest.h +++ b/Framework/SINQ/test/MillerIndicesIOTest.h @@ -39,15 +39,15 @@ public: std::string hklInvalidStringLong("1 3 4 2"); TS_ASSERT_THROWS(MillerIndicesIO::fromString(hklInvalidStringLong), - std::runtime_error); + const std::runtime_error &); std::string hklInvalidStringShort("2 3"); TS_ASSERT_THROWS(MillerIndicesIO::fromString(hklInvalidStringShort), - std::runtime_error); + const std::runtime_error &); std::string hklInvalidStringGarbage("q43tn rufninc"); TS_ASSERT_THROWS(MillerIndicesIO::fromString(hklInvalidStringGarbage), - boost::bad_lexical_cast); + const boost::bad_lexical_cast &); } void testComplementarity() { diff --git a/Framework/SINQ/test/MillerIndicesTest.h b/Framework/SINQ/test/MillerIndicesTest.h index e6d9d73ec88..de277df69a2 100644 --- a/Framework/SINQ/test/MillerIndicesTest.h +++ b/Framework/SINQ/test/MillerIndicesTest.h @@ -43,7 +43,7 @@ public: hkl.push_back(3); - TS_ASSERT_THROWS(MillerIndices fails(hkl), std::runtime_error); + TS_ASSERT_THROWS(MillerIndices fails(hkl), const std::runtime_error &); } void testdirectAccess() { @@ -61,8 +61,8 @@ public: TS_ASSERT_EQUALS(hkl[1], 1); TS_ASSERT_EQUALS(hkl[2], 0); - TS_ASSERT_THROWS(hkl[-2], std::range_error); - TS_ASSERT_THROWS(hkl[3], std::range_error); + TS_ASSERT_THROWS(hkl[-2], const std::range_error &); + TS_ASSERT_THROWS(hkl[3], const std::range_error &); } void testvectorAccess() { diff --git a/Framework/SINQ/test/Poldi2DFunctionTest.h b/Framework/SINQ/test/Poldi2DFunctionTest.h index b3f033bf8ad..89e280e66a7 100644 --- a/Framework/SINQ/test/Poldi2DFunctionTest.h +++ b/Framework/SINQ/test/Poldi2DFunctionTest.h @@ -82,7 +82,7 @@ public: function2D->function(domain, values); for (size_t i = 0; i < values.size(); ++i) { - TS_ASSERT_THROWS(values.getFitWeight(i), std::runtime_error); + TS_ASSERT_THROWS(values.getFitWeight(i), const std::runtime_error &); } function2D->iterationFinished(); diff --git a/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h b/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h index 56f6867b07d..459fcbfa911 100644 --- a/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h +++ b/Framework/SINQ/test/PoldiAutoCorrelationCoreTest.h @@ -203,9 +203,9 @@ public: TS_ASSERT_EQUALS(autoCorrelationCore.getElementFromIndex(3), 40); TS_ASSERT_THROWS(autoCorrelationCore.getElementFromIndex(10), - std::range_error); + const std::range_error &); TS_ASSERT_THROWS(autoCorrelationCore.getElementFromIndex(-10), - std::range_error); + const std::range_error &); } void testgetTofFromIndex() { @@ -218,9 +218,10 @@ public: TS_ASSERT_EQUALS(autoCorrelationCore.getTofFromIndex(0), 345.0); TS_ASSERT_EQUALS(autoCorrelationCore.getTofFromIndex(3), 65765.2); - TS_ASSERT_THROWS(autoCorrelationCore.getTofFromIndex(10), std::range_error); + TS_ASSERT_THROWS(autoCorrelationCore.getTofFromIndex(10), + const std::range_error &); TS_ASSERT_THROWS(autoCorrelationCore.getTofFromIndex(-10), - std::range_error); + const std::range_error &); } void testgetCounts() { diff --git a/Framework/SINQ/test/PoldiConversionsTest.h b/Framework/SINQ/test/PoldiConversionsTest.h index b51808cdc6f..33b603a7a3a 100644 --- a/Framework/SINQ/test/PoldiConversionsTest.h +++ b/Framework/SINQ/test/PoldiConversionsTest.h @@ -30,11 +30,16 @@ public: TS_ASSERT_DELTA(d, 0.000606307, 1e-9); TS_ASSERT_EQUALS(Conversions::dtoTOF(d, distance, sinTheta), tof); - TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 0.0, 2.0), std::domain_error); - TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, -2.0, 2.0), std::domain_error); - TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 2.0, 0.0), std::domain_error); - TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 2.0, -2.0), std::domain_error); - TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 0.0, 0.0), std::domain_error); + TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 0.0, 2.0), + const std::domain_error &); + TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, -2.0, 2.0), + const std::domain_error &); + TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 2.0, 0.0), + const std::domain_error &); + TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 2.0, -2.0), + const std::domain_error &); + TS_ASSERT_THROWS(Conversions::TOFtoD(1.0, 0.0, 0.0), + const std::domain_error &); } void testDandQConversions() { @@ -43,8 +48,8 @@ public: TS_ASSERT_DELTA(Conversions::dToQ(d), 8.37758040957278196923, 1e-15); TS_ASSERT_EQUALS(Conversions::qToD(Conversions::dToQ(0.75)), 0.75); - TS_ASSERT_THROWS(Conversions::dToQ(0.0), std::domain_error); - TS_ASSERT_THROWS(Conversions::qToD(0.0), std::domain_error); + TS_ASSERT_THROWS(Conversions::dToQ(0.0), const std::domain_error &); + TS_ASSERT_THROWS(Conversions::qToD(0.0), const std::domain_error &); } void testDegAndRadConversions() { diff --git a/Framework/SINQ/test/PoldiDGridTest.h b/Framework/SINQ/test/PoldiDGridTest.h index 6a5d1f43052..f35188c8413 100644 --- a/Framework/SINQ/test/PoldiDGridTest.h +++ b/Framework/SINQ/test/PoldiDGridTest.h @@ -51,7 +51,7 @@ public: TS_ASSERT_EQUALS(grid.m_hasCachedCalculation, false); TS_ASSERT_EQUALS(grid.m_deltaD, 0.0); - TS_ASSERT_THROWS(grid.createGrid(), std::runtime_error); + TS_ASSERT_THROWS(grid.createGrid(), const std::runtime_error &); } void testdeltaD() { diff --git a/Framework/SINQ/test/PoldiDeadWireDecoratorTest.h b/Framework/SINQ/test/PoldiDeadWireDecoratorTest.h index fa78abaadcc..fd40630b7ac 100644 --- a/Framework/SINQ/test/PoldiDeadWireDecoratorTest.h +++ b/Framework/SINQ/test/PoldiDeadWireDecoratorTest.h @@ -73,7 +73,7 @@ public: PoldiDeadWireDecorator decorator(std::set<int>(), m_detector); TS_ASSERT_THROWS(decorator.setDeadWires(m_invalidDeadWires), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/Framework/SINQ/test/PoldiDetectorDecoratorTest.h b/Framework/SINQ/test/PoldiDetectorDecoratorTest.h index 63f93794ded..96f3c6bf692 100644 --- a/Framework/SINQ/test/PoldiDetectorDecoratorTest.h +++ b/Framework/SINQ/test/PoldiDetectorDecoratorTest.h @@ -70,12 +70,12 @@ public: void testForwardMethodsInvalidDetector() { PoldiDetectorDecorator decorator; - TS_ASSERT_THROWS(decorator.twoTheta(0), std::runtime_error); - TS_ASSERT_THROWS(decorator.distanceFromSample(0), std::runtime_error); - TS_ASSERT_THROWS(decorator.elementCount(), std::runtime_error); - TS_ASSERT_THROWS(decorator.centralElement(), std::runtime_error); - TS_ASSERT_THROWS(decorator.availableElements(), std::runtime_error); - TS_ASSERT_THROWS(decorator.qLimits(1.0, 5.0), std::runtime_error); + TS_ASSERT_THROWS(decorator.twoTheta(0), const std::runtime_error &); + TS_ASSERT_THROWS(decorator.distanceFromSample(0), const std::runtime_error &); + TS_ASSERT_THROWS(decorator.elementCount(), const std::runtime_error &); + TS_ASSERT_THROWS(decorator.centralElement(), const std::runtime_error &); + TS_ASSERT_THROWS(decorator.availableElements(), const std::runtime_error &); + TS_ASSERT_THROWS(decorator.qLimits(1.0, 5.0), const std::runtime_error &); } }; diff --git a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h index 6d1e598fcc3..67c9b5a17f7 100644 --- a/Framework/SINQ/test/PoldiFitPeaks1D2Test.h +++ b/Framework/SINQ/test/PoldiFitPeaks1D2Test.h @@ -134,13 +134,13 @@ public: // Null pointer does not work PoldiPeak_sptr nullPeak; TS_ASSERT_THROWS(RefinedRange invalid(nullPeak, 2.0), - std::invalid_argument); + const std::invalid_argument &); // 0 or fewer multiples does not work TS_ASSERT_THROWS(RefinedRange invalid(m_testPeak, 0.0), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(RefinedRange invalid(m_testPeak, -1.0), - std::invalid_argument); + const std::invalid_argument &); } void testRefinedRangeLimitConstructor() { @@ -148,9 +148,9 @@ public: TS_ASSERT_THROWS_NOTHING(RefinedRange range(0.0, 1.0, peaks)); TS_ASSERT_THROWS(RefinedRange invalid(1.0, 0.0, peaks), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(RefinedRange invalid(1.0, 1.0, peaks), - std::invalid_argument); + const std::invalid_argument &); RefinedRange range(3.0, 4.0, peaks); TS_ASSERT_EQUALS(range.getXStart(), 3.0); diff --git a/Framework/SINQ/test/PoldiFitPeaks2DTest.h b/Framework/SINQ/test/PoldiFitPeaks2DTest.h index 568da0f23a6..deed493624e 100644 --- a/Framework/SINQ/test/PoldiFitPeaks2DTest.h +++ b/Framework/SINQ/test/PoldiFitPeaks2DTest.h @@ -63,8 +63,8 @@ public: TS_ASSERT_THROWS_NOTHING(spectrumCalculator.setDeltaT(2.0)); TS_ASSERT_EQUALS(spectrumCalculator.m_deltaT, 2.0); - TS_ASSERT_THROWS(spectrumCalculator.setDeltaT(0.0), std::invalid_argument); - TS_ASSERT_THROWS(spectrumCalculator.setDeltaT(-1.0), std::invalid_argument); + TS_ASSERT_THROWS(spectrumCalculator.setDeltaT(0.0), const std::invalid_argument &); + TS_ASSERT_THROWS(spectrumCalculator.setDeltaT(-1.0), const std::invalid_argument &); } void testSetDeltaTFromWorkspace() { @@ -77,7 +77,7 @@ public: MatrixWorkspace_sptr invalidWs = WorkspaceCreationHelper::create2DWorkspace123(1, 1); TS_ASSERT_THROWS(spectrumCalculator.setDeltaTFromWorkspace(invalidWs), - std::invalid_argument); + const std::invalid_argument &); } void testIsValidDeltaT() { @@ -107,12 +107,12 @@ public: spectrumCalculator.initialize(); // deltaT is not set, so this must fail TS_ASSERT_THROWS(spectrumCalculator.getIntegratedPeakCollection(testPeaks), - std::invalid_argument); + const std::invalid_argument &); spectrumCalculator.setDeltaT(3.0); // still fails, because time transformer is required. TS_ASSERT_THROWS(spectrumCalculator.getIntegratedPeakCollection(testPeaks), - std::invalid_argument); + const std::invalid_argument &); spectrumCalculator.setTimeTransformer(m_timeTransformer); // peak collection with some peaks, intensities are described by maximum, @@ -168,7 +168,7 @@ public: PoldiPeakCollection_sptr invalidPeakCollection; TS_ASSERT_THROWS( spectrumCalculator.getIntegratedPeakCollection(invalidPeakCollection), - std::invalid_argument); + const std::invalid_argument &); } void testGetNormalizedPeakCollection() { @@ -178,14 +178,14 @@ public: PoldiPeakCollection_sptr invalidPeakCollection; TS_ASSERT_THROWS( spectrumCalculator.getNormalizedPeakCollection(invalidPeakCollection), - std::invalid_argument); + const std::invalid_argument &); // m_timeTransformer has not been assigned, so even a "good" PeakCollection // will throw PoldiPeakCollection_sptr testPeaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum(); TS_ASSERT_THROWS(spectrumCalculator.getNormalizedPeakCollection(testPeaks), - std::invalid_argument); + const std::invalid_argument &); spectrumCalculator.setTimeTransformer(m_timeTransformer); @@ -210,14 +210,14 @@ public: PoldiPeakCollection_sptr invalidPeakCollection; TS_ASSERT_THROWS( spectrumCalculator.getCountPeakCollection(invalidPeakCollection), - std::invalid_argument); + const std::invalid_argument &); // m_timeTransformer has not been assigned, so even a "good" PeakCollection // will throw PoldiPeakCollection_sptr testPeaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionNormalized(); TS_ASSERT_THROWS(spectrumCalculator.getCountPeakCollection(testPeaks), - std::invalid_argument); + const std::invalid_argument &); spectrumCalculator.setTimeTransformer(m_timeTransformer); @@ -361,11 +361,11 @@ public: TestablePoldiFitPeaks2D spectrumCalculator; TS_ASSERT_THROWS(spectrumCalculator.assignMillerIndices(from, invalid), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(spectrumCalculator.assignMillerIndices(invalid, from), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(spectrumCalculator.assignMillerIndices(invalid, invalid), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_DIFFERS(peak1->hkl(), peak2->hkl()); @@ -375,7 +375,7 @@ public: to->addPeak(peak1); TS_ASSERT_THROWS(spectrumCalculator.assignMillerIndices(from, to), - std::runtime_error); + const std::runtime_error &); } void testAddBackgroundFunctions() { @@ -473,7 +473,7 @@ public: PointGroup_sptr invalid; TS_ASSERT_THROWS(alg.getLatticeSystemFromPointGroup(invalid), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h b/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h index b286beca74b..38778141b92 100644 --- a/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h +++ b/Framework/SINQ/test/PoldiIndexKnownCompoundsTest.h @@ -160,7 +160,7 @@ public: TS_ASSERT_EQUALS(alg.m_indexedPeaks.size(), 0); TS_ASSERT_THROWS(alg.initializeIndexedPeaks(expectedPeaks), - std::runtime_error); + const std::runtime_error &); PoldiPeakCollection_sptr peaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum(); @@ -249,7 +249,7 @@ public: WorkspaceCreationHelper::create1DWorkspaceRand(10, true)); TS_ASSERT_THROWS(alg.getPeakCollections(badWorkspaces), - std::invalid_argument); + const std::invalid_argument &); } void testReshapeVector() { @@ -260,13 +260,14 @@ public: std::vector<double> empty; TestablePoldiIndexKnownCompounds alg; - TS_ASSERT_THROWS(alg.reshapeVector(empty, 1), std::invalid_argument); + TS_ASSERT_THROWS(alg.reshapeVector(empty, 1), + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(alg.reshapeVector(one, 1)); TS_ASSERT_THROWS_NOTHING(alg.reshapeVector(one, 2)); TS_ASSERT_THROWS_NOTHING(alg.reshapeVector(two, 1)); TS_ASSERT_THROWS_NOTHING(alg.reshapeVector(two, 2)); TS_ASSERT_THROWS_NOTHING(alg.reshapeVector(two, 3)); - TS_ASSERT_THROWS(alg.reshapeVector(one, 0), std::invalid_argument); + TS_ASSERT_THROWS(alg.reshapeVector(one, 0), const std::invalid_argument &); std::vector<double> t11 = alg.reshapeVector(one, 1); TS_ASSERT_EQUALS(t11.size(), 1); @@ -298,7 +299,7 @@ public: alg.initialize(); alg.setPropertyValue("Tolerances", ""); - TS_ASSERT_THROWS(alg.getTolerances(1), std::invalid_argument); + TS_ASSERT_THROWS(alg.getTolerances(1), const std::invalid_argument &); alg.setPropertyValue("Tolerances", "0.1"); TS_ASSERT_THROWS_NOTHING(alg.getTolerances(1)); @@ -309,7 +310,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.getTolerances(2)); TS_ASSERT_THROWS_NOTHING(alg.getTolerances(3)); - TS_ASSERT_THROWS(alg.getTolerances(0), std::invalid_argument); + TS_ASSERT_THROWS(alg.getTolerances(0), const std::invalid_argument &); } void testGetContributions() { @@ -317,7 +318,7 @@ public: alg.initialize(); alg.setPropertyValue("ScatteringContributions", ""); - TS_ASSERT_THROWS(alg.getContributions(1), std::invalid_argument); + TS_ASSERT_THROWS(alg.getContributions(1), const std::invalid_argument &); alg.setPropertyValue("ScatteringContributions", "0.1"); TS_ASSERT_THROWS_NOTHING(alg.getContributions(1)); @@ -328,7 +329,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.getContributions(2)); TS_ASSERT_THROWS_NOTHING(alg.getContributions(3)); - TS_ASSERT_THROWS(alg.getContributions(0), std::invalid_argument); + TS_ASSERT_THROWS(alg.getContributions(0), const std::invalid_argument &); } void testGetNormalizedContributions() { @@ -347,11 +348,11 @@ public: std::vector<double> empty; TS_ASSERT_THROWS(alg.getNormalizedContributions(empty), - std::invalid_argument); + const std::invalid_argument &); std::vector<double> negative(1, -2.0); TS_ASSERT_THROWS(alg.getNormalizedContributions(negative), - std::invalid_argument); + const std::invalid_argument &); } void testScaleIntensityEstimates() { @@ -360,7 +361,7 @@ public: PoldiPeakCollection_sptr null; TS_ASSERT_THROWS(alg.scaleIntensityEstimates(null, 0.1), - std::invalid_argument); + const std::invalid_argument &); PoldiPeakCollection_sptr indexedSilicon = PoldiPeakCollectionHelpers::createTheoreticalPeakCollectionSilicon(); @@ -382,7 +383,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.scaleIntensityEstimates(phases, goodContributions)); TS_ASSERT_THROWS(alg.scaleIntensityEstimates(phases, badContributions), - std::invalid_argument); + const std::invalid_argument &); } void testFwhmSigmaConversion() { @@ -402,7 +403,8 @@ public: alg.initialize(); PoldiPeakCollection_sptr null; - TS_ASSERT_THROWS(alg.assignFwhmEstimates(null, 0.1), std::invalid_argument); + TS_ASSERT_THROWS(alg.assignFwhmEstimates(null, 0.1), + const std::invalid_argument &); PoldiPeakCollection_sptr indexedSilicon = PoldiPeakCollectionHelpers::createTheoreticalPeakCollectionSilicon(); @@ -420,7 +422,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.assignFwhmEstimates(phases, goodFwhms)); TS_ASSERT_THROWS(alg.scaleIntensityEstimates(phases, badFwhms), - std::invalid_argument); + const std::invalid_argument &); } void testInPeakSet() { @@ -466,8 +468,10 @@ public: // throw if one of the peaks is invalid PoldiPeak_sptr null; - TS_ASSERT_THROWS(alg.isCandidate(null, candidate1), std::invalid_argument); - TS_ASSERT_THROWS(alg.isCandidate(peak, null), std::invalid_argument); + TS_ASSERT_THROWS(alg.isCandidate(null, candidate1), + const std::invalid_argument &); + TS_ASSERT_THROWS(alg.isCandidate(peak, null), + const std::invalid_argument &); } void testGetIndexCandidatePairs() { @@ -524,7 +528,7 @@ public: * is thrown. */ TS_ASSERT_THROWS(alg.getAllIndexCandidatePairs(measuredSi, theoreticalSi), - std::runtime_error); + const std::runtime_error &); // After initialization, everything is fine. alg.initializeUnindexedPeaks(); @@ -537,7 +541,8 @@ public: TestablePoldiIndexKnownCompounds alg; PoldiPeak_sptr peak = PoldiPeak::create(1.0); - TS_ASSERT_THROWS(alg.collectUnindexedPeak(peak), std::runtime_error); + TS_ASSERT_THROWS(alg.collectUnindexedPeak(peak), + const std::runtime_error &); alg.initializeUnindexedPeaks(); @@ -571,12 +576,14 @@ public: PoldiPeak::Relative); // Null peaks don't work - TS_ASSERT_THROWS(IndexCandidatePair(peak, null, 0), std::invalid_argument); + TS_ASSERT_THROWS(IndexCandidatePair(peak, null, 0), + const std::invalid_argument &); TS_ASSERT_THROWS(IndexCandidatePair(null, candidate1, 0), - std::invalid_argument); + const std::invalid_argument &); // Range error when no fwhm is set (division by zero). - TS_ASSERT_THROWS(IndexCandidatePair(peak, noFwhm, 0), std::range_error); + TS_ASSERT_THROWS(IndexCandidatePair(peak, noFwhm, 0), + const std::range_error &); IndexCandidatePair peakCandidate1(peak, candidate1, 1); TS_ASSERT_EQUALS(peakCandidate1.observed, peak); diff --git a/Framework/SINQ/test/PoldiInstrumentAdapterTest.h b/Framework/SINQ/test/PoldiInstrumentAdapterTest.h index c73c812baaf..8c1e37cd0a1 100644 --- a/Framework/SINQ/test/PoldiInstrumentAdapterTest.h +++ b/Framework/SINQ/test/PoldiInstrumentAdapterTest.h @@ -70,7 +70,7 @@ public: new VectorDoubleValueExtractor); TS_ASSERT_THROWS( (*extractorBad)(const_cast<const Run &>(m_run), "chopperspeed_double"), - std::invalid_argument); + const std::invalid_argument &); // check that the value comes out correctly TS_ASSERT_EQUALS( @@ -91,7 +91,7 @@ public: new VectorDoubleValueExtractor); TS_ASSERT_THROWS( (*extractorBad)(const_cast<const Run &>(m_run), "chopperspeed_double"), - std::invalid_argument); + const std::invalid_argument &); // check that the value comes out correctly TS_ASSERT_EQUALS((*extractorGood)(const_cast<const Run &>(m_run), @@ -110,7 +110,7 @@ public: new NumberDoubleValueExtractor); TS_ASSERT_THROWS( (*extractorBad)(const_cast<const Run &>(m_run), "chopperspeed_vector"), - std::invalid_argument); + const std::invalid_argument &); // check that the value comes out correctly TS_ASSERT_EQUALS( @@ -138,13 +138,13 @@ public: // Throws, because "chopperspeed" is missing TS_ASSERT_THROWS( instrumentAdapter.extractPropertyFromRun(m_run, "DOESNOTEXIST"), - std::runtime_error); + const std::runtime_error &); // Throws, because there is no extractor for supplied type const std::string propertyName = getChopperSpeedPropertyName(); TS_ASSERT_THROWS( instrumentAdapter.extractPropertyFromRun(m_stringRun, propertyName), - std::invalid_argument); + const std::invalid_argument &); // Should be ok. TS_ASSERT_THROWS_NOTHING( @@ -161,7 +161,7 @@ public: // caught in the method TS_ASSERT_THROWS( instrumentAdapter.chopperSpeedMatchesTarget(m_stringRun, 10000.0), - std::invalid_argument); + const std::invalid_argument &); // If the property is not present, it is an old file and there can't be any // comparison, so it's always true @@ -202,7 +202,7 @@ public: // Throw on null-pointer TS_ASSERT_THROWS(instrumentAdapter.getExtractorForProperty(nullptr), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS_NOTHING(instrumentAdapter.getExtractorForProperty( m_run.getProperty("chopperspeed_double"))); diff --git a/Framework/SINQ/test/PoldiPeakCollectionTest.h b/Framework/SINQ/test/PoldiPeakCollectionTest.h index 5eac2c3cc19..2ed9ec10062 100644 --- a/Framework/SINQ/test/PoldiPeakCollectionTest.h +++ b/Framework/SINQ/test/PoldiPeakCollectionTest.h @@ -214,7 +214,8 @@ public: TS_ASSERT_DIFFERS(peaks.pointGroup(), m3m); PointGroup_sptr invalid; - TS_ASSERT_THROWS(peaks.setPointGroup(invalid), std::invalid_argument); + TS_ASSERT_THROWS(peaks.setPointGroup(invalid), + const std::invalid_argument &); } void testUnitCell() { @@ -281,8 +282,8 @@ public: PoldiPeak_sptr peak = peaks.peak(0); TS_ASSERT_EQUALS(peak, newPeak); - TS_ASSERT_THROWS(peaks.peak(1), std::range_error); - TS_ASSERT_THROWS(peaks.peak(-2), std::range_error); + TS_ASSERT_THROWS(peaks.peak(1), const std::range_error &); + TS_ASSERT_THROWS(peaks.peak(-2), const std::range_error &); } void testPeaksVector() { @@ -385,7 +386,7 @@ public: dValues.pop_back(); TS_ASSERT_THROWS(p.setPeaks(hkls, dValues, fSquared), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/Framework/SINQ/test/PoldiPeakSearchTest.h b/Framework/SINQ/test/PoldiPeakSearchTest.h index 99c59b4b344..bc3f289c532 100644 --- a/Framework/SINQ/test/PoldiPeakSearchTest.h +++ b/Framework/SINQ/test/PoldiPeakSearchTest.h @@ -47,13 +47,13 @@ public: input.pop_back(); TS_ASSERT_THROWS(poldiPeakSearch.getNeighborSums(input), - std::runtime_error); + const std::runtime_error &); } void testSetMinimumDistance() { TestablePoldiPeakSearch poldiPeakSearch; - TS_ASSERT_THROWS(poldiPeakSearch.setMinimumDistance(0), std::runtime_error); + TS_ASSERT_THROWS(poldiPeakSearch.setMinimumDistance(0), const std::runtime_error &); poldiPeakSearch.setMinimumDistance(2); TS_ASSERT_EQUALS(poldiPeakSearch.m_minimumDistance, 2); @@ -197,7 +197,7 @@ public: std::list<std::vector<double>::const_iterator> tooManyPeaks(40); TS_ASSERT_THROWS(poldiPeakSearch.getNumberOfBackgroundPoints( tooManyPeaks, correlationCounts), - std::runtime_error); + const std::runtime_error &); } void testgetMedianFromSortedVector() { diff --git a/Framework/SINQ/test/PoldiPeakTest.h b/Framework/SINQ/test/PoldiPeakTest.h index 5eb63c384d5..9e73ad6ad21 100644 --- a/Framework/SINQ/test/PoldiPeakTest.h +++ b/Framework/SINQ/test/PoldiPeakTest.h @@ -38,7 +38,7 @@ public: TS_ASSERT_EQUALS(peak->fwhm(), 0.0); TS_ASSERT_EQUALS(peak->intensity(), 0.0); - TS_ASSERT_THROWS(PoldiPeak::create(0.0), std::domain_error) + TS_ASSERT_THROWS(PoldiPeak::create(0.0), const std::domain_error &) } void testCreateQIntensity() { @@ -49,7 +49,7 @@ public: TS_ASSERT_EQUALS(intensity.error(), 0.0); TS_ASSERT_EQUALS(peak->d(), 2.0 * M_PI); - TS_ASSERT_THROWS(PoldiPeak::create(0.0, 23.0), std::domain_error); + TS_ASSERT_THROWS(PoldiPeak::create(0.0, 23.0), const std::domain_error &); } void testQDConversion() { diff --git a/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h b/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h index 02309051f08..a1aba0aad46 100644 --- a/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h +++ b/Framework/SINQ/test/PoldiResidualCorrelationCoreTest.h @@ -127,7 +127,7 @@ public: TS_ASSERT_EQUALS(core.calculateAverage(numbers), 3.5); std::vector<double> empty; - TS_ASSERT_THROWS(core.calculateAverage(empty), std::runtime_error); + TS_ASSERT_THROWS(core.calculateAverage(empty), const std::runtime_error &); } void testCalculateAverageDeviationFromValue() { @@ -139,7 +139,7 @@ public: std::vector<double> empty; TS_ASSERT_THROWS(core.calculateAverageDeviationFromValue(empty, 3.5), - std::runtime_error); + const std::runtime_error &); } private: diff --git a/Framework/SINQ/test/PoldiSourceSpectrumTest.h b/Framework/SINQ/test/PoldiSourceSpectrumTest.h index d62593a521e..ba1d9521b7f 100644 --- a/Framework/SINQ/test/PoldiSourceSpectrumTest.h +++ b/Framework/SINQ/test/PoldiSourceSpectrumTest.h @@ -59,7 +59,7 @@ public: boost::shared_ptr<const PoldiAbstractFakeInstrument> badInstrument( new PoldiInvalidSourceFakeInstrument); TS_ASSERT_THROWS(spectrum.getSourceComponent(badInstrument), - std::runtime_error); + const std::runtime_error &); } void testGetSpectrumParameter() { @@ -75,7 +75,7 @@ public: ParameterMap_sptr badParameterMap(new PoldiInvalidFakeParameterMap); TS_ASSERT_THROWS(spectrum.getSpectrumParameter(source, badParameterMap), - std::runtime_error); + const std::runtime_error &); } void testSetSpectrum() { @@ -90,7 +90,7 @@ public: TS_ASSERT_THROWS_NOTHING(spectrum.setSpectrum(goodParameter)); TS_ASSERT_THROWS(spectrum.setSpectrum(Parameter_sptr()), - std::runtime_error); + const std::runtime_error &); } private: diff --git a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h index 2d0a60b0f1c..e3f06905b41 100644 --- a/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h +++ b/Framework/SINQ/test/PoldiSpectrumDomainFunctionTest.h @@ -214,11 +214,11 @@ public: } } - TS_ASSERT_THROWS(localJacobian.set(20, 3, 30.0), std::out_of_range); - TS_ASSERT_THROWS(localJacobian.set(10, 4, 30.0), std::out_of_range); + TS_ASSERT_THROWS(localJacobian.set(20, 3, 30.0), const std::out_of_range &); + TS_ASSERT_THROWS(localJacobian.set(10, 4, 30.0), const std::out_of_range &); - TS_ASSERT_THROWS(localJacobian.get(20, 3), std::out_of_range); - TS_ASSERT_THROWS(localJacobian.get(10, 4), std::out_of_range); + TS_ASSERT_THROWS(localJacobian.get(20, 3), const std::out_of_range &); + TS_ASSERT_THROWS(localJacobian.get(10, 4), const std::out_of_range &); } void testLocalJacobianRawValues() { diff --git a/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h b/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h index a2737e06495..459b185a49b 100644 --- a/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h +++ b/Framework/SINQ/test/PoldiSpectrumPawleyFunctionTest.h @@ -90,9 +90,9 @@ public: TS_ASSERT_THROWS_NOTHING(fn.setDecoratedFunction("PawleyFunction")); TS_ASSERT_THROWS(fn.setDecoratedFunction("Gaussian"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(fn.setDecoratedFunction("CompositeFunction"), - std::invalid_argument); + const std::invalid_argument &); } void test_getPawleyFunction() { diff --git a/Framework/SINQ/test/PoldiTimeTransformerTest.h b/Framework/SINQ/test/PoldiTimeTransformerTest.h index cab03039d40..26cdae87453 100644 --- a/Framework/SINQ/test/PoldiTimeTransformerTest.h +++ b/Framework/SINQ/test/PoldiTimeTransformerTest.h @@ -105,7 +105,7 @@ public: PoldiInstrumentAdapter_sptr invalid; TS_ASSERT_THROWS(transformer.initializeFromPoldiInstrument(invalid), - std::invalid_argument); + const std::invalid_argument &); } void TestCalculatedTotalIntensity() { diff --git a/Framework/SINQ/test/PoldiTruncateDataTest.h b/Framework/SINQ/test/PoldiTruncateDataTest.h index 9f615a5b0b8..881d3998313 100644 --- a/Framework/SINQ/test/PoldiTruncateDataTest.h +++ b/Framework/SINQ/test/PoldiTruncateDataTest.h @@ -88,14 +88,14 @@ public: MatrixWorkspace_sptr invalidSpectra; TS_ASSERT_THROWS(truncate.setTimeBinWidthFromWorkspace(invalidSpectra), - std::invalid_argument); + const std::invalid_argument &); // matrix workspace with one bin MatrixWorkspace_sptr invalidBins = WorkspaceCreationHelper::create2DWorkspace123(1, 1); TS_ASSERT_THROWS(truncate.setTimeBinWidthFromWorkspace(invalidBins), - std::invalid_argument); + const std::invalid_argument &); } void testCalculateBinCount() { @@ -103,16 +103,16 @@ public: EXPECT_CALL(*chopper, cycleTime()).Times(1).WillRepeatedly(Return(1500.0)); TestablePoldiTruncateData truncate; - TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), std::invalid_argument); + TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), const std::invalid_argument &); truncate.setChopper(chopper); - TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), std::invalid_argument); + TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), const std::invalid_argument &); truncate.setTimeBinWidth(-10.0); - TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), std::invalid_argument); + TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), const std::invalid_argument &); truncate.setTimeBinWidth(0.0); - TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), std::invalid_argument); + TS_ASSERT_THROWS(truncate.getCalculatedBinCount(), const std::invalid_argument &); truncate.setTimeBinWidth(3.0); @@ -135,7 +135,7 @@ public: // throws, because actual bin count is smaller than calculated bin count TS_ASSERT_THROWS(truncate.getMaximumTimeValue(calculatedBinCount), - std::invalid_argument); + const std::invalid_argument &); truncate.setActualBinCount(500); TS_ASSERT_EQUALS(truncate.getMaximumTimeValue(calculatedBinCount), @@ -154,12 +154,12 @@ public: // throws, because actual bin count is smaller than calculated bin count TS_ASSERT_THROWS(truncate.getMinimumExtraTimeValue(calculatedBinCount), - std::invalid_argument); + const std::invalid_argument &); // still throws - there are no extra bins. truncate.setActualBinCount(500); TS_ASSERT_THROWS(truncate.getMinimumExtraTimeValue(calculatedBinCount), - std::invalid_argument); + const std::invalid_argument &); // this must work truncate.setActualBinCount(550); @@ -193,7 +193,7 @@ public: truncate.setTimeBinWidthFromWorkspace(smallWorkspace); TS_ASSERT_THROWS(truncate.getCroppedWorkspace(smallWorkspace), - std::invalid_argument); + const std::invalid_argument &); } void testGetExtraCountsWorkspace() { @@ -223,7 +223,7 @@ public: truncate.setTimeBinWidthFromWorkspace(smallWorkspace); TS_ASSERT_THROWS(truncate.getExtraCountsWorkspace(smallWorkspace), - std::invalid_argument); + const std::invalid_argument &); } void testGetWorkspaceBelowX() { diff --git a/Framework/SINQ/test/UncertainValueIOTest.h b/Framework/SINQ/test/UncertainValueIOTest.h index 5a3d7a82563..ad698ac0f9d 100644 --- a/Framework/SINQ/test/UncertainValueIOTest.h +++ b/Framework/SINQ/test/UncertainValueIOTest.h @@ -49,11 +49,11 @@ public: std::string invalidOne("asdf"); TS_ASSERT_THROWS(UncertainValueIO::fromString(invalidOne), - boost::bad_lexical_cast); + const boost::bad_lexical_cast &); std::string invalidTwo("4.0 +/- 3.0 +/- 1.0"); TS_ASSERT_THROWS(UncertainValueIO::fromString(invalidTwo), - std::runtime_error); + const std::runtime_error &); } void testComplementarity() { diff --git a/Framework/SINQ/test/UncertainValueTest.h b/Framework/SINQ/test/UncertainValueTest.h index a740b45d8c6..03393067565 100644 --- a/Framework/SINQ/test/UncertainValueTest.h +++ b/Framework/SINQ/test/UncertainValueTest.h @@ -33,7 +33,7 @@ public: TS_ASSERT_EQUALS(noError.value(), 2.0); TS_ASSERT_EQUALS(noError.error(), 0.0); - TS_ASSERT_THROWS(UncertainValue(0.0, -3.0), std::domain_error); + TS_ASSERT_THROWS(UncertainValue(0.0, -3.0), const std::domain_error &); } void testPlainAddition() { @@ -61,7 +61,7 @@ public: UncertainValue invalid(2.0, 0.0); TS_ASSERT_THROWS(UncertainValue::valueToErrorRatio(invalid), - std::domain_error); + const std::domain_error &); } void testErrorToValueRatio() { @@ -73,7 +73,7 @@ public: UncertainValue invalid(0.0, 2.0); TS_ASSERT_THROWS(UncertainValue::errorToValueRatio(invalid), - std::domain_error); + const std::domain_error &); } void testdoubleOperator() { @@ -108,8 +108,8 @@ public: TS_ASSERT_EQUALS(newerValue.value(), 4.0); TS_ASSERT_EQUALS(newerValue.error(), 0.8); - TS_ASSERT_THROWS(newValue / 0.0, std::domain_error); - TS_ASSERT_THROWS(2.0 / UncertainValue(0.0), std::domain_error); + TS_ASSERT_THROWS(newValue / 0.0, const std::domain_error &); + TS_ASSERT_THROWS(2.0 / UncertainValue(0.0), const std::domain_error &); } void testadditionOperator() { diff --git a/Framework/Types/test/DateAndTimeTest.h b/Framework/Types/test/DateAndTimeTest.h index ea8e3c075ac..0714b55f7e8 100644 --- a/Framework/Types/test/DateAndTimeTest.h +++ b/Framework/Types/test/DateAndTimeTest.h @@ -63,11 +63,12 @@ public: } void test_constructor_fails_invalid_string() { - TS_ASSERT_THROWS(DateAndTime("invalid time string"), std::invalid_argument); + TS_ASSERT_THROWS(DateAndTime("invalid time string"), + const std::invalid_argument &); TS_ASSERT_THROWS(DateAndTime("1909-01-31 22:59:59"), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(DateAndTime("2017-09-27T 07:03:49+00:00"), - std::invalid_argument); + const std::invalid_argument &); } void test_limits_on_construction() { @@ -420,7 +421,7 @@ public: void testNotADateTime() { boost::posix_time::ptime time(boost::posix_time::not_a_date_time); DateAndTime dt(time); - TS_ASSERT_THROWS(boost::posix_time::to_tm(time), std::out_of_range); + TS_ASSERT_THROWS(boost::posix_time::to_tm(time), const std::out_of_range &); TS_ASSERT_THROWS_NOTHING(dt.to_tm()); } diff --git a/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp b/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp index 2b2ab6b110c..ca9ac1879e3 100644 --- a/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp +++ b/Framework/WorkflowAlgorithms/src/DgsConvertToEnergyTransfer.cpp @@ -235,7 +235,7 @@ void DgsConvertToEnergyTransfer::exec() { monPeak = getei->getProperty("FirstMonitorPeak"); const specnum_t monIndex = - static_cast<const specnum_t>(getei->getProperty("FirstMonitorIndex")); + static_cast<specnum_t>(getei->getProperty("FirstMonitorIndex")); // Why did the old way get it from the log? incidentEnergy = getei->getProperty("IncidentEnergy"); diff --git a/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h b/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h index 15c4eb13622..24db7842b0c 100644 --- a/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h +++ b/Framework/WorkflowAlgorithms/test/AlignAndFocusPowderTest.h @@ -58,7 +58,7 @@ public: void testException() { AlignAndFocusPowder align_and_focus; align_and_focus.initialize(); - TS_ASSERT_THROWS(align_and_focus.execute(), std::runtime_error); + TS_ASSERT_THROWS(align_and_focus.execute(), const std::runtime_error &); } /* Test AlignAndFocusPowder for HRP38692 raw data */ diff --git a/Framework/WorkflowAlgorithms/test/IMuonAsymmetryCalculatorTest.h b/Framework/WorkflowAlgorithms/test/IMuonAsymmetryCalculatorTest.h index 392ca383c9b..1c0f57edf4a 100644 --- a/Framework/WorkflowAlgorithms/test/IMuonAsymmetryCalculatorTest.h +++ b/Framework/WorkflowAlgorithms/test/IMuonAsymmetryCalculatorTest.h @@ -619,7 +619,7 @@ public: Mantid::Kernel::make_unique<MuonPairAsymmetryCalculator>( inputWSGroup, summed, subtracted, firstIndex, secondIndex); MatrixWorkspace_sptr ws; - TS_ASSERT_THROWS(ws = calc->calculate(), std::out_of_range); + TS_ASSERT_THROWS(ws = calc->calculate(), const std::out_of_range &); TS_ASSERT(!ws); } diff --git a/Framework/WorkflowAlgorithms/test/MuonProcessTest.h b/Framework/WorkflowAlgorithms/test/MuonProcessTest.h index ea780af6add..1874cccf96c 100644 --- a/Framework/WorkflowAlgorithms/test/MuonProcessTest.h +++ b/Framework/WorkflowAlgorithms/test/MuonProcessTest.h @@ -413,7 +413,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", output.name())); - TS_ASSERT_THROWS(alg.execute(), std::invalid_argument); + TS_ASSERT_THROWS(alg.execute(), const std::invalid_argument &); TS_ASSERT(!alg.isExecuted()); } @@ -424,7 +424,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT(alg.isInitialized()); TS_ASSERT_THROWS(alg.setProperty("InputWorkspace", emptyWS), - std::invalid_argument); + const std::invalid_argument &); } void test_errorReporting_badWSType() { @@ -453,7 +453,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", output.name())); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -484,7 +484,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", output.name())); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -513,7 +513,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", output.name())); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } @@ -545,7 +545,7 @@ public: TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", output.name())); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT(!alg.isExecuted()); } diff --git a/Framework/WorkflowAlgorithms/test/ProcessIndirectFitParametersTest.h b/Framework/WorkflowAlgorithms/test/ProcessIndirectFitParametersTest.h index 59a5a6bc52d..cdad69f51bc 100644 --- a/Framework/WorkflowAlgorithms/test/ProcessIndirectFitParametersTest.h +++ b/Framework/WorkflowAlgorithms/test/ProcessIndirectFitParametersTest.h @@ -97,7 +97,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("InputWorkspace", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_x_column_is_not_allowed() { @@ -105,7 +105,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("ColumnX", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_param_names_is_not_allowed() { @@ -113,7 +113,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("ParameterNames", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_empty_output_is_not_allowed() { @@ -121,7 +121,7 @@ public: TS_ASSERT_THROWS_NOTHING(alg.initialize()); TS_ASSERT_THROWS(alg.setPropertyValue("OutputWorkspace", ""), - std::invalid_argument); + const std::invalid_argument &); } void test_property_input() { diff --git a/Framework/WorkflowAlgorithms/test/StepScanTest.h b/Framework/WorkflowAlgorithms/test/StepScanTest.h index 7bdffe2ba20..83b3f0ef640 100644 --- a/Framework/WorkflowAlgorithms/test/StepScanTest.h +++ b/Framework/WorkflowAlgorithms/test/StepScanTest.h @@ -68,10 +68,10 @@ public: StepScan alg; alg.initialize(); TS_ASSERT(alg.isInitialized()); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName)); - TS_ASSERT_THROWS(alg.execute(), std::runtime_error); + TS_ASSERT_THROWS(alg.execute(), const std::runtime_error &); TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", inputWS)); TS_ASSERT(alg.execute()); } diff --git a/qt/icons/test/IconTest.h b/qt/icons/test/IconTest.h index 5b6bf71667d..62e04f46045 100644 --- a/qt/icons/test/IconTest.h +++ b/qt/icons/test/IconTest.h @@ -67,7 +67,7 @@ public: TS_ASSERT_THROWS( MantidQt::Icons::getIcon( {QString("mdi.run-fast"), QString("mdi.run-fast")}, options), - std::invalid_argument) + const std::invalid_argument &) } void testGetFont() { @@ -79,7 +79,7 @@ public: void testGetIconThrowsIfIconLibraryIsNotPresent() { TS_ASSERT_THROWS(MantidQt::Icons::getIcon(QString("fda.run-fast")), - std::invalid_argument); + const std::invalid_argument &); } }; diff --git a/qt/paraview_ext/VatesAPI/test/CompositePeaksPresenterVsiTest.h b/qt/paraview_ext/VatesAPI/test/CompositePeaksPresenterVsiTest.h index 8dfdb88fd34..75d565f6d8e 100644 --- a/qt/paraview_ext/VatesAPI/test/CompositePeaksPresenterVsiTest.h +++ b/qt/paraview_ext/VatesAPI/test/CompositePeaksPresenterVsiTest.h @@ -39,14 +39,14 @@ public: // Arrange CompositePeaksPresenterVsi presenter; // Assert - TS_ASSERT_THROWS(presenter.getPeaksWorkspace(), std::runtime_error); + TS_ASSERT_THROWS(presenter.getPeaksWorkspace(), const std::runtime_error &); } void testThatGettingPeaksWorkspaceNameDirectlyIsNotAllowed() { // Arrange CompositePeaksPresenterVsi presenter; // Assert - TS_ASSERT_THROWS(presenter.getPeaksWorkspaceName(), std::runtime_error); + TS_ASSERT_THROWS(presenter.getPeaksWorkspaceName(), const std::runtime_error &); } void testThatGetListOfNamesOfSubPresenters() { diff --git a/qt/paraview_ext/VatesAPI/test/EventNexusLoadingPresenterTest.h b/qt/paraview_ext/VatesAPI/test/EventNexusLoadingPresenterTest.h index 4d7e3638235..f893d107285 100644 --- a/qt/paraview_ext/VatesAPI/test/EventNexusLoadingPresenterTest.h +++ b/qt/paraview_ext/VatesAPI/test/EventNexusLoadingPresenterTest.h @@ -46,13 +46,13 @@ public: TSM_ASSERT_THROWS("Should throw if an empty file string is given.", EventNexusLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), ""), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithNullViewThrows() { TSM_ASSERT_THROWS("Should throw if a null view is given.", EventNexusLoadingPresenter(nullptr, "some_file"), - std::invalid_argument); + const std::invalid_argument &); } void testConstruct() { @@ -123,14 +123,14 @@ public: EventNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); } void testCallGetGeometryThrows() { EventNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); } void testExecuteLoadMetadata() { @@ -139,7 +139,7 @@ public: presenter.executeLoadMetadata(); TSM_ASSERT_THROWS( "Should always throw. Algorithm fixed to create 3 dimensions.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); TSM_ASSERT_THROWS_NOTHING("Should throw. Execute not yet run.", presenter.hasTDimensionAvailable()); TSM_ASSERT_THROWS_NOTHING("Should throw. Execute not yet run.", diff --git a/qt/paraview_ext/VatesAPI/test/FieldDataToMetadataTest.h b/qt/paraview_ext/VatesAPI/test/FieldDataToMetadataTest.h index b93df7e8ebd..f3d6b0e00f2 100644 --- a/qt/paraview_ext/VatesAPI/test/FieldDataToMetadataTest.h +++ b/qt/paraview_ext/VatesAPI/test/FieldDataToMetadataTest.h @@ -69,14 +69,14 @@ public: FieldDataToMetadata function; TSM_ASSERT_THROWS("Unknown id requested. Should have thrown.", - function.execute(fieldData, "x"), std::runtime_error); + function.execute(fieldData, "x"), const std::runtime_error &); } void testThrowsIfNullFieldData() { vtkFieldData *nullFieldData = nullptr; FieldDataToMetadata function; TSM_ASSERT_THROWS("Should not be able to execute with null field data.", - function.execute(nullFieldData, "x"), std::runtime_error); + function.execute(nullFieldData, "x"), const std::runtime_error &); } }; diff --git a/qt/paraview_ext/VatesAPI/test/MDEWEventNexusLoadingPresenterTest.h b/qt/paraview_ext/VatesAPI/test/MDEWEventNexusLoadingPresenterTest.h index d3abe385b0f..249a430feda 100644 --- a/qt/paraview_ext/VatesAPI/test/MDEWEventNexusLoadingPresenterTest.h +++ b/qt/paraview_ext/VatesAPI/test/MDEWEventNexusLoadingPresenterTest.h @@ -49,13 +49,13 @@ public: TSM_ASSERT_THROWS("Should throw if an empty file string is given.", MDEWEventNexusLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), ""), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithNullViewThrows() { TSM_ASSERT_THROWS("Should throw if a null view is given.", MDEWEventNexusLoadingPresenter(nullptr, "some_file"), - std::invalid_argument); + const std::invalid_argument &); } void testConstruct() { @@ -125,21 +125,21 @@ public: MDEWEventNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.hasTDimensionAvailable(), std::runtime_error); + presenter.hasTDimensionAvailable(), const std::runtime_error &); } void testCallGetTDimensionValuesThrows() { MDEWEventNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); } void testCallGetGeometryThrows() { MDEWEventNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); } void testGetWorkspaceTypeName() { diff --git a/qt/paraview_ext/VatesAPI/test/MDEWInMemoryLoadingPresenterTest.h b/qt/paraview_ext/VatesAPI/test/MDEWInMemoryLoadingPresenterTest.h index f54bd3403dc..91e52de80c9 100644 --- a/qt/paraview_ext/VatesAPI/test/MDEWInMemoryLoadingPresenterTest.h +++ b/qt/paraview_ext/VatesAPI/test/MDEWInMemoryLoadingPresenterTest.h @@ -66,7 +66,7 @@ public: TSM_ASSERT_THROWS( "Should throw with null view.", MDEWInMemoryLoadingPresenter(nullptr, new MockWorkspaceProvider, "_"), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithNullRepositoryThrows() { @@ -74,7 +74,7 @@ public: "Should throw with null repository.", MDEWInMemoryLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), nullptr, "_"), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithEmptyWsNameThrows() { @@ -83,7 +83,7 @@ public: MDEWInMemoryLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, emptyName), - std::invalid_argument); + const std::invalid_argument &); } void testConstruction() { @@ -159,7 +159,7 @@ public: // Test that it doesn't work when not setup. TSM_ASSERT_THROWS("::executeLoadMetadata is critical to setup, should " "throw if not run first.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); // Test that it does work when setup. presenter.executeLoadMetadata(); @@ -224,7 +224,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, "_"); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.hasTDimensionAvailable(), std::runtime_error); + presenter.hasTDimensionAvailable(), const std::runtime_error &); } void testCallGetTDimensionValuesThrows() { @@ -232,7 +232,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, "_"); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); } void testCallGetGeometryThrows() { @@ -240,7 +240,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, "_"); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); } void testGetWorkspaceTypeName() { diff --git a/qt/paraview_ext/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h b/qt/paraview_ext/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h index fbc97236cb8..11b741abe77 100644 --- a/qt/paraview_ext/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h +++ b/qt/paraview_ext/VatesAPI/test/MDHWInMemoryLoadingPresenterTest.h @@ -59,7 +59,7 @@ public: TSM_ASSERT_THROWS( "Should throw with null view.", MDHWInMemoryLoadingPresenter(nullptr, new MockWorkspaceProvider, "_"), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithNullRepositoryThrows() { @@ -67,7 +67,7 @@ public: "Should throw with null repository.", MDHWInMemoryLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), nullptr, "_"), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithEmptyWsNameThrows() { @@ -76,7 +76,7 @@ public: MDHWInMemoryLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, emptyName), - std::invalid_argument); + const std::invalid_argument &); } void testConstruction() { @@ -152,7 +152,7 @@ public: // Test that it doesn't work when not setup. TSM_ASSERT_THROWS("::executeLoadMetadata is critical to setup, should " "throw if not run first.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); // Test that it does work when setup. presenter.executeLoadMetadata(); @@ -220,7 +220,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, "_"); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.hasTDimensionAvailable(), std::runtime_error); + presenter.hasTDimensionAvailable(), const std::runtime_error &); } void testCallGetTDimensionValuesThrows() { @@ -228,7 +228,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, "_"); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); } void testCallGetGeometryThrows() { @@ -236,7 +236,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), new MockWorkspaceProvider, "_"); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); } void testGetWorkspaceTypeName() { diff --git a/qt/paraview_ext/VatesAPI/test/MDHWNexusLoadingPresenterTest.h b/qt/paraview_ext/VatesAPI/test/MDHWNexusLoadingPresenterTest.h index f2056e16f88..0f8a87ba8fe 100644 --- a/qt/paraview_ext/VatesAPI/test/MDHWNexusLoadingPresenterTest.h +++ b/qt/paraview_ext/VatesAPI/test/MDHWNexusLoadingPresenterTest.h @@ -108,13 +108,13 @@ public: TSM_ASSERT_THROWS("Should throw if an empty file string is given.", MDHWNexusLoadingPresenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), ""), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithNullViewThrows() { TSM_ASSERT_THROWS("Should throw if an empty file string is given.", MDHWNexusLoadingPresenter(nullptr, "some_file"), - std::invalid_argument); + const std::invalid_argument &); } void testConstruct() { @@ -253,21 +253,21 @@ public: MDHWNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.hasTDimensionAvailable(), std::runtime_error); + presenter.hasTDimensionAvailable(), const std::runtime_error &); } void testCallGetTDimensionValuesThrows() { MDHWNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); } void testCallGetGeometryThrows() { MDHWNexusLoadingPresenter presenter( Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFile()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); } void testGetWorkspaceTypeName() { diff --git a/qt/paraview_ext/VatesAPI/test/NullPeaksPresenterVsiTest.h b/qt/paraview_ext/VatesAPI/test/NullPeaksPresenterVsiTest.h index 8795aee13da..040d0e3b769 100644 --- a/qt/paraview_ext/VatesAPI/test/NullPeaksPresenterVsiTest.h +++ b/qt/paraview_ext/VatesAPI/test/NullPeaksPresenterVsiTest.h @@ -21,19 +21,19 @@ public: void testGettingPeaksWorkspaceThrows() { NullPeaksPresenterVsi presenter; TSM_ASSERT_THROWS("Should not implement this method", - presenter.getPeaksWorkspace(), std::runtime_error); + presenter.getPeaksWorkspace(), const std::runtime_error &); } void testGettingUsablePeaksThrows() { NullPeaksPresenterVsi presenter; TSM_ASSERT_THROWS("Should not implement this method", - presenter.getViewablePeaks(), std::runtime_error); + presenter.getViewablePeaks(), const std::runtime_error &); } void testGettingPeaksWorkspaceNameThrows() { NullPeaksPresenterVsi presenter; TSM_ASSERT_THROWS("Should not implement this method", - presenter.getViewablePeaks(), std::runtime_error); + presenter.getViewablePeaks(), const std::runtime_error &); } void testGettingPeaksInfoThrows() { @@ -47,7 +47,7 @@ public: TSM_ASSERT_THROWS( "Should not implement this method", presenter.getPeaksInfo(peaksWorkspace, row, position, radius, coord), - std::runtime_error); + const std::runtime_error &); } }; #endif diff --git a/qt/paraview_ext/VatesAPI/test/SQWLoadingPresenterTest.h b/qt/paraview_ext/VatesAPI/test/SQWLoadingPresenterTest.h index 2fe04c9f12c..b7624d840e1 100644 --- a/qt/paraview_ext/VatesAPI/test/SQWLoadingPresenterTest.h +++ b/qt/paraview_ext/VatesAPI/test/SQWLoadingPresenterTest.h @@ -58,13 +58,13 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(); TSM_ASSERT_THROWS("Should throw if an empty file string is given.", SQWLoadingPresenter(std::move(view), ""), - std::invalid_argument); + const std::invalid_argument &); } void testConstructWithNullViewThrows() { TSM_ASSERT_THROWS("Should throw if an empty file string is given.", SQWLoadingPresenter(nullptr, "some_file"), - std::invalid_argument); + const std::invalid_argument &); } void testConstruct() { @@ -156,7 +156,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFileNamePath()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.hasTDimensionAvailable(), std::runtime_error); + presenter.hasTDimensionAvailable(), const std::runtime_error &); } void testCallGetTDimensionValuesThrows() { @@ -164,7 +164,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFileNamePath()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getTimeStepValues(), std::runtime_error); + presenter.getTimeStepValues(), const std::runtime_error &); } void testCallGetGeometryThrows() { @@ -172,7 +172,7 @@ public: Mantid::Kernel::make_unique<MockMDLoadingView>(), getSuitableFileNamePath()); TSM_ASSERT_THROWS("Should throw. Execute not yet run.", - presenter.getGeometryXML(), std::runtime_error); + presenter.getGeometryXML(), const std::runtime_error &); } void testExecuteLoadMetadata() { diff --git a/qt/paraview_ext/VatesAPI/test/TimeToTimeStepTest.h b/qt/paraview_ext/VatesAPI/test/TimeToTimeStepTest.h index c9a2fa3d7b9..c9853065625 100644 --- a/qt/paraview_ext/VatesAPI/test/TimeToTimeStepTest.h +++ b/qt/paraview_ext/VatesAPI/test/TimeToTimeStepTest.h @@ -106,14 +106,14 @@ public: TSM_ASSERT_THROWS( "Range is negative, should throw.", TimeToTimeStep::construct(dimensionMin, dimensionMax, nBins), - std::runtime_error); + const std::runtime_error &); } void testUseWithDefaultConstructorThrows() { Mantid::VATES::TimeToTimeStep converter; TSM_ASSERT_THROWS( "Constructing via default constructor should throw when used.", - converter(1), std::runtime_error); + converter(1), const std::runtime_error &); } }; diff --git a/qt/paraview_ext/VatesAPI/test/VatesKnowledgeSerializerTest.h b/qt/paraview_ext/VatesAPI/test/VatesKnowledgeSerializerTest.h index bd4364ccdae..72977d73e21 100644 --- a/qt/paraview_ext/VatesAPI/test/VatesKnowledgeSerializerTest.h +++ b/qt/paraview_ext/VatesAPI/test/VatesKnowledgeSerializerTest.h @@ -45,7 +45,7 @@ public: new MockImplicitFunction); generator.setImplicitFunction(impFunction); TSM_ASSERT_THROWS("Cannot generate the xml without the workspace", - generator.createXMLString(), std::runtime_error); + generator.createXMLString(), const std::runtime_error &); } void testNoLocationDoesNotThrow() { @@ -79,7 +79,7 @@ public: generator.setWorkspace(*workspace); TSM_ASSERT_THROWS("Cannot create the xml without the workspace name", - generator.createXMLString(), std::runtime_error); + generator.createXMLString(), const std::runtime_error &); } void testCreateXMLWithComponents() // Uses individual setters for geometry, diff --git a/qt/paraview_ext/VatesAPI/test/ViewFrustumTest.h b/qt/paraview_ext/VatesAPI/test/ViewFrustumTest.h index 085f9070b7a..35c0519102e 100644 --- a/qt/paraview_ext/VatesAPI/test/ViewFrustumTest.h +++ b/qt/paraview_ext/VatesAPI/test/ViewFrustumTest.h @@ -103,7 +103,7 @@ public: // Assert TSM_ASSERT_THROWS("Frustum is not well defined, should throw error", - frustum.toExtents(), std::runtime_error); + frustum.toExtents(), const std::runtime_error &); } }; diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetFactoryTest.h index 5974048c143..bb059534c3c 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetFactoryTest.h @@ -83,7 +83,7 @@ public: TSM_ASSERT_THROWS("By default, should throw when successor type is the " "same as the container.", factory.setSuccessor(std::move(uniqueSuccessor)), - std::runtime_error); + const std::runtime_error &); TS_ASSERT(testing::Mock::VerifyAndClearExpectations(&factory)); TS_ASSERT(testing::Mock::VerifyAndClearExpectations(successor)); } diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetToImplicitFunctionTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetToImplicitFunctionTest.h index a9227c6d770..151c1f8ff0e 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetToImplicitFunctionTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetToImplicitFunctionTest.h @@ -26,7 +26,7 @@ public: void testThrowIfvtkDataSetNull() { vtkDataSet *nullArg = nullptr; TS_ASSERT_THROWS(vtkDataSetToImplicitFunction temp(nullArg), - std::runtime_error); + const std::runtime_error &); } void testNoImplcitFunction() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h index 2d8cec8ce71..0085b6f5e9a 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetToNonOrthogonalDataSetTest.h @@ -198,7 +198,7 @@ public: ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>(); TS_ASSERT_THROWS(vtkDataSetToNonOrthogonalDataSet temp( dataset, "", std::move(workspaceProvider)), - std::runtime_error); + const std::runtime_error &); } void testThrowsIfWorkspaceNameEmptyAndUsingADSWorkspaceProvider() { @@ -208,7 +208,7 @@ public: TS_ASSERT_THROWS( vtkDataSetToNonOrthogonalDataSet temp(dataset.GetPointer(), "", std::move(workspaceProvider)), - std::runtime_error); + const std::runtime_error &); } void testThrowIfVtkDatasetWrongType() { @@ -217,7 +217,7 @@ public: ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>(); vtkDataSetToNonOrthogonalDataSet converter(grid.GetPointer(), "name", std::move(workspaceProvider)); - TS_ASSERT_THROWS(converter.execute(), std::runtime_error); + TS_ASSERT_THROWS(converter.execute(), const std::runtime_error &); } void testSimpleDataset() { @@ -240,7 +240,7 @@ public: ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>(); vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider)); - TS_ASSERT_THROWS(converter.execute(), std::invalid_argument); + TS_ASSERT_THROWS(converter.execute(), const std::invalid_argument &); } void testThrowsSimpleDatasetNoUB() { @@ -251,7 +251,7 @@ public: ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>(); vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider)); - TS_ASSERT_THROWS(converter.execute(), std::invalid_argument); + TS_ASSERT_THROWS(converter.execute(), const std::invalid_argument &); } void testThrowsSimpleDatasetNoWMatrix() { @@ -262,7 +262,7 @@ public: ADSWorkspaceProvider<Mantid::API::IMDWorkspace>>(); vtkDataSetToNonOrthogonalDataSet converter(ds, wsName, std::move(workspaceProvider)); - TS_ASSERT_THROWS(converter.execute(), std::invalid_argument); + TS_ASSERT_THROWS(converter.execute(), const std::invalid_argument &); } void testNoThrowsSimpleDataSetNoAffineMatrix() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h index e919135dd2c..91cfa87eef4 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetToPeaksFilteredDataSetTest.h @@ -206,14 +206,14 @@ public: vtkUnstructuredGrid *in = nullptr; auto out = vtkSmartPointer<vtkUnstructuredGrid>::New(); TS_ASSERT_THROWS(vtkDataSetToPeaksFilteredDataSet peaksFilter(in, out), - std::runtime_error); + const std::runtime_error &); } void testThrowIfOutputNull() { auto in = vtkSmartPointer<vtkUnstructuredGrid>::New(); vtkUnstructuredGrid *out = nullptr; TS_ASSERT_THROWS(vtkDataSetToPeaksFilteredDataSet peaksFilter(in, out), - std::runtime_error); + const std::runtime_error &); } void testExecThrowIfNoInit() { @@ -221,7 +221,7 @@ public: auto out = vtkSmartPointer<vtkUnstructuredGrid>::New(); vtkDataSetToPeaksFilteredDataSet peaksFilter(in, out); FakeProgressAction updateProgress; - TS_ASSERT_THROWS(peaksFilter.execute(updateProgress), std::runtime_error); + TS_ASSERT_THROWS(peaksFilter.execute(updateProgress), const std::runtime_error &); } void testExecutionWithSingleSphericalPeakInQSample() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetToScaledDataSetTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetToScaledDataSetTest.h index 344fac3c16f..909f33b51b9 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetToScaledDataSetTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetToScaledDataSetTest.h @@ -99,7 +99,7 @@ public: vtkDataSetToScaledDataSet scaler; - TS_ASSERT_THROWS(scaler.execute(1, 1, 1, in), std::runtime_error); + TS_ASSERT_THROWS(scaler.execute(1, 1, 1, in), const std::runtime_error &); } void testExecution() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsLocationTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsLocationTest.h index 43a638a516c..e38c255252e 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsLocationTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsLocationTest.h @@ -34,7 +34,7 @@ private: public: void testThrowIfvtkDataSetNull() { vtkDataSet *nullArg = nullptr; - TS_ASSERT_THROWS(vtkDataSetToWsLocation temp(nullArg), std::runtime_error); + TS_ASSERT_THROWS(vtkDataSetToWsLocation temp(nullArg), const std::runtime_error &); } void testExecution() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsNameTest.h b/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsNameTest.h index 9a1d80f7dd4..7e12fe871f6 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsNameTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkDataSetToWsNameTest.h @@ -33,7 +33,7 @@ private: public: void testThrowIfvtkDataSetNull() { vtkDataSet *nullArg = nullptr; - TS_ASSERT_THROWS(vtkDataSetToWsName temp(nullArg), std::runtime_error); + TS_ASSERT_THROWS(vtkDataSetToWsName temp(nullArg), const std::runtime_error &); } void testExecution() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDHexFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDHexFactoryTest.h index 54764748141..acdea625b3e 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDHexFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDHexFactoryTest.h @@ -58,7 +58,7 @@ private: vtkMDHexFactory factory(VATES::VolumeNormalization); factory.setCheckDimensionality(doCheckDimensionality); if (doCheckDimensionality) { - TS_ASSERT_THROWS(factory.initialize(binned_ws), std::runtime_error); + TS_ASSERT_THROWS(factory.initialize(binned_ws), const std::runtime_error &); } else { TS_ASSERT_THROWS_NOTHING(factory.initialize(binned_ws)); vtkSmartPointer<vtkDataSet> product; @@ -73,7 +73,7 @@ public: FakeProgressAction progressUpdater; vtkMDHexFactory factory(VATES::VolumeNormalization); TSM_ASSERT_THROWS("Have NOT initalized object. Should throw.", - factory.create(progressUpdater), std::runtime_error); + factory.create(progressUpdater), const std::runtime_error &); } void testInitalizeWithNullWorkspaceThrows() { @@ -82,7 +82,7 @@ public: IMDEventWorkspace *ws = nullptr; TSM_ASSERT_THROWS("This is a NULL workspace. Should throw.", factory.initialize(Workspace_sptr(ws)), - std::invalid_argument); + const std::invalid_argument &); } void testGetFactoryTypeName() { @@ -137,14 +137,14 @@ public: // factory.SetSuccessor(mockSuccessor); No Successor set. auto ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>(); - TS_ASSERT_THROWS(factory.initialize(ws), std::runtime_error); + TS_ASSERT_THROWS(factory.initialize(ws), const std::runtime_error &); } void testCreateWithoutInitializeThrows() { FakeProgressAction progressUpdater; vtkMDHexFactory factory(VATES::VolumeNormalization); // initialize not called! - TS_ASSERT_THROWS(factory.create(progressUpdater), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdater), const std::runtime_error &); } void test_roundUp_positive_numbers() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h index e99909c9c39..c3f4546dd1a 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h @@ -88,7 +88,7 @@ public: TSM_ASSERT_THROWS( "No workspace, so should not be possible to complete initialization.", - factory.initialize(ws_sptr), std::invalid_argument); + factory.initialize(ws_sptr), const std::invalid_argument &); } void testCreateWithoutInitializeThrows() { @@ -96,7 +96,7 @@ public: vtkMDHistoHex4DFactory<TimeStepToTimeStep> factory( Mantid::VATES::VolumeNormalization, 1); - TS_ASSERT_THROWS(factory.create(progressAction), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressAction), const std::runtime_error &); } void testInitializationDelegates() { @@ -147,7 +147,7 @@ public: TSM_ASSERT_THROWS("Should have thrown an execption given that no successor " "was available.", - factory.initialize(ws_sptr), std::runtime_error); + factory.initialize(ws_sptr), const std::runtime_error &); } void testCreateDelegates() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDHistoHexFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDHistoHexFactoryTest.h index dc1901fc69d..1224ac1d681 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDHistoHexFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDHistoHexFactoryTest.h @@ -85,13 +85,13 @@ public: TSM_ASSERT_THROWS( "No workspace, so should not be possible to complete initialization.", - factory.initialize(ws_sptr), std::invalid_argument); + factory.initialize(ws_sptr), const std::invalid_argument &); } void testCreateWithoutInitializeThrows() { FakeProgressAction progressUpdate; vtkMDHistoHexFactory factory(Mantid::VATES::VolumeNormalization); - TS_ASSERT_THROWS(factory.create(progressUpdate), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdate), const std::runtime_error &); } void testInitializationDelegates() { @@ -136,7 +136,7 @@ public: TSM_ASSERT_THROWS("Should have thrown an execption given that no successor " "was available.", - factory.initialize(ws_sptr), std::runtime_error); + factory.initialize(ws_sptr), const std::runtime_error &); } void testCreateDelegates() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDHistoLineFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDHistoLineFactoryTest.h index 84061a5e89b..8a2a2ce20c9 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDHistoLineFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDHistoLineFactoryTest.h @@ -39,13 +39,13 @@ public: TSM_ASSERT_THROWS( "No workspace, so should not be possible to complete initialization.", - factory.initialize(ws_sptr), std::invalid_argument); + factory.initialize(ws_sptr), const std::invalid_argument &); } void testCreateWithoutInitializeThrows() { FakeProgressAction progressUpdate; vtkMDHistoLineFactory factory(Mantid::VATES::VolumeNormalization); - TS_ASSERT_THROWS(factory.create(progressUpdate), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdate), const std::runtime_error &); } void testProgressUpdates() { @@ -109,7 +109,7 @@ public: TSM_ASSERT_THROWS("Should have thrown an execption given that no successor " "was available.", - factory.initialize(ws_sptr), std::runtime_error); + factory.initialize(ws_sptr), const std::runtime_error &); } void testCreateDelegates() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDHistoQuadFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDHistoQuadFactoryTest.h index 17ee8d099e4..a687cf9b8d7 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDHistoQuadFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDHistoQuadFactoryTest.h @@ -43,14 +43,14 @@ public: TSM_ASSERT_THROWS( "No workspace, so should not be possible to complete initialization.", - factory.initialize(ws_sptr), std::invalid_argument); + factory.initialize(ws_sptr), const std::invalid_argument &); } void testCreateWithoutInitializeThrows() { FakeProgressAction progressUpdate; vtkMDHistoQuadFactory factory(Mantid::VATES::VolumeNormalization); - TS_ASSERT_THROWS(factory.create(progressUpdate), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdate), const std::runtime_error &); } void testInsideThresholds() { @@ -114,7 +114,7 @@ public: TSM_ASSERT_THROWS("Should have thrown an execption given that no successor " "was available.", - factory.initialize(ws_sptr), std::runtime_error); + factory.initialize(ws_sptr), const std::runtime_error &); } void testCreateDelegates() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDLineFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDLineFactoryTest.h index 7296be2401f..caf10372884 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDLineFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDLineFactoryTest.h @@ -79,7 +79,7 @@ public: vtkMDLineFactory factory(Mantid::VATES::VolumeNormalization); ITableWorkspace_sptr ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>(); - TS_ASSERT_THROWS(factory.initialize(ws), std::runtime_error); + TS_ASSERT_THROWS(factory.initialize(ws), const std::runtime_error &); } void testCreateWithoutInitializeThrows() { @@ -87,7 +87,7 @@ public: vtkMDLineFactory factory(Mantid::VATES::VolumeNormalization); // initialize not called! - TS_ASSERT_THROWS(factory.create(progressUpdate), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdate), const std::runtime_error &); } void testCreation() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkMDQuadFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkMDQuadFactoryTest.h index f6283a78ab3..a24c0154a3b 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkMDQuadFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkMDQuadFactoryTest.h @@ -81,7 +81,7 @@ public: vtkMDQuadFactory factory(Mantid::VATES::VolumeNormalization); ITableWorkspace_sptr ws = boost::make_shared<Mantid::DataObjects::TableWorkspace>(); - TS_ASSERT_THROWS(factory.initialize(ws), std::runtime_error); + TS_ASSERT_THROWS(factory.initialize(ws), const std::runtime_error &); } void testCreateWithoutInitaliseThrows() { @@ -89,7 +89,7 @@ public: vtkMDQuadFactory factory(Mantid::VATES::VolumeNormalization); // initialize not called! - TS_ASSERT_THROWS(factory.create(progressUpdate), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdate), const std::runtime_error &); } void testCreation() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkPeakMarkerFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkPeakMarkerFactoryTest.h index c2ebc679a65..26f4745cde4 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkPeakMarkerFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkPeakMarkerFactoryTest.h @@ -162,13 +162,13 @@ public: TSM_ASSERT_THROWS( "No workspace, so should not be possible to complete initialization.", - factory.initialize(ws_sptr), std::runtime_error); + factory.initialize(ws_sptr), const std::runtime_error &); } void testCreateWithoutInitializeThrows() { FakeProgressAction progressUpdate; vtkPeakMarkerFactory factory("signal"); - TS_ASSERT_THROWS(factory.create(progressUpdate), std::runtime_error); + TS_ASSERT_THROWS(factory.create(progressUpdate), const std::runtime_error &); } void testTypeName() { diff --git a/qt/paraview_ext/VatesAPI/test/vtkSplatterPlotFactoryTest.h b/qt/paraview_ext/VatesAPI/test/vtkSplatterPlotFactoryTest.h index 906a418713c..565545bbde3 100644 --- a/qt/paraview_ext/VatesAPI/test/vtkSplatterPlotFactoryTest.h +++ b/qt/paraview_ext/VatesAPI/test/vtkSplatterPlotFactoryTest.h @@ -44,7 +44,7 @@ public: FakeProgressAction progressUpdate; vtkSplatterPlotFactory factory("signal"); TSM_ASSERT_THROWS("Have NOT initalized object. Should throw.", - factory.create(progressUpdate), std::runtime_error); + factory.create(progressUpdate), const std::runtime_error &); } void testInitializeWithNullWorkspaceThrows() { @@ -52,7 +52,7 @@ public: IMDEventWorkspace *ws = nullptr; TSM_ASSERT_THROWS("This is a NULL workspace. Should throw.", factory.initialize(Workspace_sptr(ws)), - std::invalid_argument); + const std::invalid_argument &); } /*Demonstrative tests*/ diff --git a/qt/python/mantidqt/_common.sip b/qt/python/mantidqt/_common.sip index 2a7c103f0e9..3f594864ad4 100644 --- a/qt/python/mantidqt/_common.sip +++ b/qt/python/mantidqt/_common.sip @@ -129,7 +129,7 @@ public: public: ScriptEditor(const QString &lexer, const QFont &font = QFont(), - QWidget *parent /TransferThis/ = 0) throw(std::invalid_argument); + QWidget *parent /TransferThis/ = 0) throw(const std::invalid_argument &); QString fileName() const; SIP_PYTUPLE getSelection() const; @@ -145,7 +145,7 @@ public: QString selectedText() const; QString text() const; - void clearKeyBinding(const QString &keyCombination) throw(std::invalid_argument); + void clearKeyBinding(const QString &keyCombination) throw(const std::invalid_argument &); void enableAutoCompletion(AutoCompletionSource source); void disableAutoCompletion(); void getCursorPosition(int *line, int *index) const; @@ -344,7 +344,7 @@ class AlgorithmHistoryWindow : public QDialog { #include "MantidQtWidgets/Common/AlgorithmHistoryWindow.h" %End public: - AlgorithmHistoryWindow(QWidget *parent /TransferThis/, const QString &workspaceName) throw(std::invalid_argument); + AlgorithmHistoryWindow(QWidget *parent /TransferThis/, const QString &workspaceName) throw(const std::invalid_argument &); }; // --------------------------------- diff --git a/qt/python/mantidqtpython/mantidqtpython_def.sip b/qt/python/mantidqtpython/mantidqtpython_def.sip index 2452b3aa6fa..f6f83a2eef3 100644 --- a/qt/python/mantidqtpython/mantidqtpython_def.sip +++ b/qt/python/mantidqtpython/mantidqtpython_def.sip @@ -311,7 +311,7 @@ LineViewer public: -void apply() throw (std::runtime_error); +void apply() throw (const std::runtime_error &); %Docstring void LineViewer::apply() ------------------------ @@ -341,7 +341,7 @@ void LineViewer::showFull() //*WIKI* ==== Start/End Points ==== -void setStartXY(double x, double y) throw (std::runtime_error); +void setStartXY(double x, double y) throw (const std::runtime_error &); %Docstring void LineViewer::setStartXY(double x, double y) ----------------------------------------------- @@ -355,7 +355,7 @@ void LineViewer::setStartXY(double x, double y) %End -void setEndXY(double x, double y) throw (std::runtime_error); +void setEndXY(double x, double y) throw (const std::runtime_error &); %Docstring void LineViewer::setEndXY(double x, double y) --------------------------------------------- @@ -385,7 +385,7 @@ void LineViewer::setThickness(double width) %End -void setThickness(int dim, double width) throw (std::invalid_argument, std::runtime_error); +void setThickness(int dim, double width) throw (std::invalid_argument, const std::runtime_error &); %Docstring void LineViewer::setThickness(int dim, double width) ---------------------------------------------------- @@ -405,7 +405,7 @@ void LineViewer::setThickness(int dim, double width) %End -void setThickness(const QString & dim, double width) throw (std::invalid_argument, std::runtime_error); +void setThickness(const QString & dim, double width) throw (std::invalid_argument, const std::runtime_error &); %Docstring void LineViewer::setThickness(const QString & dim, double width) ---------------------------------------------------------------- @@ -447,7 +447,7 @@ double LineViewer::getPlanarWidth() //*WIKI* ==== Binning ==== -void setNumBins(int numBins) throw (std::invalid_argument); +void setNumBins(int numBins) throw (const std::invalid_argument &); %Docstring void LineViewer::setNumBins(int numBins) ---------------------------------------- @@ -461,7 +461,7 @@ void LineViewer::setNumBins(int numBins) %End -void setFixedBinWidthMode(bool fixedWidth, double binWidth) throw (std::invalid_argument); +void setFixedBinWidthMode(bool fixedWidth, double binWidth) throw (const std::invalid_argument &); %Docstring void LineViewer::setFixedBinWidthMode(bool fixedWidth, double binWidth) ----------------------------------------------------------------------- @@ -670,7 +670,7 @@ SliceViewer public: //*WIKI* ==== Basics ==== - void setWorkspace(const QString & wsName) throw (std::runtime_error); + void setWorkspace(const QString & wsName) throw (const std::runtime_error &); %Docstring void SliceViewer::setWorkspace(const QString & wsName) ------------------------------------------------------ @@ -708,7 +708,7 @@ void SliceViewer::showControls(bool visible) %End - void openFromXML(const QString & xml) throw (std::invalid_argument, std::runtime_error); + void openFromXML(const QString & xml) throw (std::invalid_argument, const std::runtime_error &); %Docstring void SliceViewer::openFromXML(const QString & xml) -------------------------------------------------- @@ -803,7 +803,7 @@ void SliceViewer::toggleLineMode(bool lineMode) //*WIKI* ==== X/Y Dimension ==== - void setXYDim(int indexX, int indexY) throw (std::invalid_argument); + void setXYDim(int indexX, int indexY) throw (const std::invalid_argument &); %Docstring void SliceViewer::setXYDim(int indexX, int indexY) -------------------------------------------------- @@ -822,7 +822,7 @@ void SliceViewer::setXYDim(int indexX, int indexY) %End - void setXYDim(const QString & dimX, const QString & dimY) throw (std::invalid_argument, std::runtime_error); + void setXYDim(const QString & dimX, const QString & dimY) throw (std::invalid_argument, const std::runtime_error &); %Docstring void SliceViewer::setXYDim(const QString & dimX, const QString & dimY) ---------------------------------------------------------------------- @@ -861,7 +861,7 @@ int SliceViewer::getDimY() //*WIKI* ==== Slice Point ==== - void setSlicePoint(int dim, double value) throw (std::invalid_argument); + void setSlicePoint(int dim, double value) throw (const std::invalid_argument &); %Docstring void SliceViewer::setSlicePoint(int dim, double value) ------------------------------------------------------ @@ -878,7 +878,7 @@ void SliceViewer::setSlicePoint(int dim, double value) %End - void setSlicePoint(const QString & dim, double value) throw (std::invalid_argument, std::runtime_error); + void setSlicePoint(const QString & dim, double value) throw (std::invalid_argument, const std::runtime_error &); %Docstring void SliceViewer::setSlicePoint(const QString & dim, double value) ------------------------------------------------------------------ @@ -895,7 +895,7 @@ void SliceViewer::setSlicePoint(const QString & dim, double value) %End - double getSlicePoint(int dim) const throw (std::invalid_argument); + double getSlicePoint(int dim) const throw (const std::invalid_argument &); %Docstring double SliceViewer::getSlicePoint(int dim) ------------------------------------------ @@ -913,7 +913,7 @@ double SliceViewer::getSlicePoint(int dim) %End - double getSlicePoint(const QString & dim) const throw (std::invalid_argument, std::runtime_error); + double getSlicePoint(const QString & dim) const throw (std::invalid_argument, const std::runtime_error &); %Docstring double SliceViewer::getSlicePoint(const QString & dim) ------------------------------------------------------ @@ -1022,7 +1022,7 @@ void SliceViewer::loadColorMap(QString filename) %End - void setColorScale(double min, double max, int type) throw (std::invalid_argument); + void setColorScale(double min, double max, int type) throw (const std::invalid_argument &); %Docstring void SliceViewer::setColorScale(double min, double max, int type) ----------------------------------------------------------------- @@ -1039,7 +1039,7 @@ void SliceViewer::setColorScale(double min, double max, int type) %End - void setColorScaleMin(double min) throw (std::invalid_argument); + void setColorScaleMin(double min) throw (const std::invalid_argument &); %Docstring void SliceViewer::setColorScaleMin(double min) ---------------------------------------------- @@ -1054,7 +1054,7 @@ void SliceViewer::setColorScaleMin(double min) %End - void setColorScaleMax(double max) throw (std::invalid_argument); + void setColorScaleMax(double max) throw (const std::invalid_argument &); %Docstring void SliceViewer::setColorScaleMax(double max) ---------------------------------------------- @@ -1207,7 +1207,7 @@ void SliceViewer::setColorBarAutoScale(bool autoscale) %End //*WIKI* ==== Dynamic Rebinning ==== - void setRebinThickness(int dim, double thickness) throw (std::runtime_error); + void setRebinThickness(int dim, double thickness) throw (const std::runtime_error &); %Docstring void SliceViewer::setRebinThickness(int dim, double thickness) -------------------------------------------------------------- @@ -1222,7 +1222,7 @@ void SliceViewer::setRebinThickness(int dim, double thickness) %End - void setRebinNumBins(int xBins, int yBins) throw (std::runtime_error); + void setRebinNumBins(int xBins, int yBins) throw (const std::runtime_error &); %Docstring void SliceViewer::setRebinNumBins(int xBins, int yBins) ------------------------------------------------------- @@ -1237,7 +1237,7 @@ void SliceViewer::setRebinNumBins(int xBins, int yBins) %End - void setRebinMode(bool mode) throw (std::runtime_error); + void setRebinMode(bool mode) throw (const std::runtime_error &); %Docstring void SliceViewer::setRebinMode(bool mode) ------------------------------------------------------ @@ -1252,7 +1252,7 @@ void SliceViewer::setRebinMode(bool mode) %End - void refreshRebin() throw (std::runtime_error); + void refreshRebin() throw (const std::runtime_error &); %Docstring void SliceViewer::refreshRebin() -------------------------------- @@ -1323,7 +1323,7 @@ WidgetFactory public: static MantidQt::Factory::WidgetFactory* Instance(); MantidQt::SliceViewer::SliceViewerWindow* createSliceViewerWindow(const QString& wsName, const QString& label); - MantidQt::SliceViewer::SliceViewerWindow* getSliceViewerWindow(const QString& wsName, const QString& label) throw (std::runtime_error); + MantidQt::SliceViewer::SliceViewerWindow* getSliceViewerWindow(const QString& wsName, const QString& label) throw (const std::runtime_error &); void closeAllSliceViewerWindows(); %Docstring void WidgetFactory::closeAllSliceViewerWindows() diff --git a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp index c931189e0e3..8a2c8cb4037 100644 --- a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp +++ b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp @@ -728,7 +728,7 @@ void EnggDiffFittingPresenter::plotAlignedWorkspace( generateXAxisLabel(ws->getAxis(0)->unit())); m_view->showStatus("Peaks fitted successfully"); } - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { g_log.error() << "Unable to finish of the plotting of the graph for " "engggui_fitting_focused_fitpeaks workspace. Error " diff --git a/qt/scientific_interfaces/Indirect/test/ConvFitModelTest.h b/qt/scientific_interfaces/Indirect/test/ConvFitModelTest.h index 2bff9fd91f4..076fc9bb822 100644 --- a/qt/scientific_interfaces/Indirect/test/ConvFitModelTest.h +++ b/qt/scientific_interfaces/Indirect/test/ConvFitModelTest.h @@ -185,7 +185,7 @@ public: void test_that_setResolution_will_throw_when_provided_the_name_of_a_workspace_which_does_not_exist() { TS_ASSERT_THROWS(m_model->setResolution("InvalidName", 0), - std::runtime_error); + const std::runtime_error &); } void @@ -196,7 +196,7 @@ public: void test_that_setResolution_will_throw_when_provided_an_index_that_is_out_of_range() { - TS_ASSERT_THROWS(m_model->setResolution(m_workspace, 5), std::out_of_range); + TS_ASSERT_THROWS(m_model->setResolution(m_workspace, 5), const std::out_of_range &); } private: diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h index 02b9957b015..b582b35be0c 100644 --- a/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h +++ b/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h @@ -270,9 +270,9 @@ public: "10", "100000000000000000000000000000", "1,5,10", "1,2,3,4,5,6,22"}; for (auto i = 0u; i < spectraPairs.size(); ++i) - TS_ASSERT_THROWS(data->setSpectra(spectraPairs[i]), std::runtime_error); + TS_ASSERT_THROWS(data->setSpectra(spectraPairs[i]), const std::runtime_error &); for (auto i = 0u; i < spectraStrings.size(); ++i) - TS_ASSERT_THROWS(data->setSpectra(spectraStrings[i]), std::runtime_error); + TS_ASSERT_THROWS(data->setSpectra(spectraStrings[i]), const std::runtime_error &); } void test_no_throw_when_setSpectra_is_provided_a_valid_spectra() { diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h index 12f1bc962c2..81299d75d5a 100644 --- a/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h +++ b/qt/scientific_interfaces/Indirect/test/IndirectFitOutputOptionsModelTest.h @@ -211,16 +211,16 @@ public: } void test_that_plotResult_will_throw_when_there_is_no_result_workspace_set() { - TS_ASSERT_THROWS(m_model->plotResult("HWHM"), std::runtime_error); + TS_ASSERT_THROWS(m_model->plotResult("HWHM"), const std::runtime_error &); } void test_that_plotPDF_will_throw_when_there_is_no_pdf_workspace_set() { TS_ASSERT_THROWS(m_model->plotPDF("WorkspaceName", "HWHM"), - std::runtime_error); + const std::runtime_error &); } void test_that_saveResult_will_throw_when_there_is_no_result_workspace_set() { - TS_ASSERT_THROWS(m_model->saveResult(), std::runtime_error); + TS_ASSERT_THROWS(m_model->saveResult(), const std::runtime_error &); } void @@ -286,7 +286,7 @@ public: auto const outputName("Output_Result"); TS_ASSERT_THROWS(m_model->replaceFitResult("", singleBinName, outputName), - std::runtime_error); + const std::runtime_error &); } void @@ -295,7 +295,7 @@ public: auto const outputName("Output_Result"); TS_ASSERT_THROWS(m_model->replaceFitResult(inputName, "", outputName), - std::runtime_error); + const std::runtime_error &); } void @@ -304,7 +304,7 @@ public: auto const singleBinName("Workspace_s0_Result"); TS_ASSERT_THROWS(m_model->replaceFitResult(inputName, singleBinName, ""), - std::runtime_error); + const std::runtime_error &); } private: diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h index 9814c97ae17..f410ce301f1 100644 --- a/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h +++ b/qt/scientific_interfaces/Indirect/test/IndirectFittingModelTest.h @@ -207,7 +207,7 @@ public: std::string const spectraString(""); TS_ASSERT_THROWS(model->addWorkspace("WorkspaceName", spectraString), - std::runtime_error); + const std::runtime_error &); } void @@ -514,7 +514,7 @@ public: void test_that_getNumberOfSpectra_throws_if_dataIndex_is_out_of_range() { auto const model = createModelWithSingleWorkspace("WorkspaceName", 3); - TS_ASSERT_THROWS(model->getNumberOfSpectra(1), std::runtime_error); + TS_ASSERT_THROWS(model->getNumberOfSpectra(1), const std::runtime_error &); } void @@ -621,7 +621,7 @@ public: void test_that_removeWorkspace_throws_when_provided_an_out_of_range_dataIndex() { auto model = createModelWithMultipleWorkspaces(3, "Ws1", "Ws2"); - TS_ASSERT_THROWS(model->removeWorkspace(2), std::runtime_error); + TS_ASSERT_THROWS(model->removeWorkspace(2), const std::runtime_error &); } void test_that_clearWorkspaces_will_empty_the_fittingData() { diff --git a/qt/scientific_interfaces/test/MuonAnalysisDataLoaderTest.h b/qt/scientific_interfaces/test/MuonAnalysisDataLoaderTest.h index 6955a4be990..064a20d117c 100644 --- a/qt/scientific_interfaces/test/MuonAnalysisDataLoaderTest.h +++ b/qt/scientific_interfaces/test/MuonAnalysisDataLoaderTest.h @@ -71,7 +71,7 @@ public: << "HIFI"; files << "emu00006473.nxs"; MuonAnalysisDataLoader loader(DeadTimesType::None, instruments); - TS_ASSERT_THROWS(loader.loadFiles(files), std::runtime_error); + TS_ASSERT_THROWS(loader.loadFiles(files), const std::runtime_error &); } /// Test special case for DEVA files @@ -132,7 +132,7 @@ public: void test_getDeadTimesTable_FromFile_NotPresent() { MuonAnalysisDataLoader loader(DeadTimesType::FromFile, {"MUSR"}); LoadResult result; - TS_ASSERT_THROWS(loader.getDeadTimesTable(result), std::runtime_error); + TS_ASSERT_THROWS(loader.getDeadTimesTable(result), const std::runtime_error &); } void test_getDeadTimesTable_FromFile() { @@ -342,7 +342,7 @@ private: if (shouldThrow) { TS_ASSERT_THROWS(loader.setProcessAlgorithmProperties(alg, options), - std::invalid_argument); + const std::invalid_argument &); } else { TS_ASSERT_THROWS_NOTHING( loader.setProcessAlgorithmProperties(alg, options)); diff --git a/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h b/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h index f4a8c49ed05..b1401a65077 100644 --- a/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h +++ b/qt/scientific_interfaces/test/MuonAnalysisFitDataPresenterTest.h @@ -34,9 +34,9 @@ using Mantid::API::TableRow; using Mantid::API::Workspace; using Mantid::API::WorkspaceFactory; using Mantid::API::WorkspaceGroup; -using MantidQt::CustomInterfaces::Muon::DeadTimesType; using MantidQt::CustomInterfaces::MuonAnalysisDataLoader; using MantidQt::CustomInterfaces::MuonAnalysisFitDataPresenter; +using MantidQt::CustomInterfaces::Muon::DeadTimesType; using MantidQt::MantidWidgets::IMuonFitDataModel; using MantidQt::MantidWidgets::IMuonFitDataSelector; using MantidQt::MantidWidgets::IWorkspaceFitControl; @@ -503,7 +503,7 @@ public: const std::string baseName("MuonSimulFit_UniqueLabelThatIsNotInTheADS"); TS_ASSERT(!AnalysisDataService::Instance().doesExist(baseName)); TS_ASSERT_THROWS(m_presenter->handleFittedWorkspaces(baseName), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void test_extractFittedWorkspaces_defaultGroupName() { @@ -569,7 +569,7 @@ public: const std::string baseName = "MuonSimulFit_UniqueLabelThatIsNotInTheADS"; TS_ASSERT(!AnalysisDataService::Instance().doesExist(baseName)); TS_ASSERT_THROWS(m_presenter->extractFittedWorkspaces(baseName), - Mantid::Kernel::Exception::NotFoundError); + const Mantid::Kernel::Exception::NotFoundError &); } void test_checkAndUpdateFitLabel_Simultaneous_NoOverwrite_ShouldUpdate() { diff --git a/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h b/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h index 72e1f51c2d8..d3bfb080bdb 100644 --- a/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h +++ b/qt/scientific_interfaces/test/MuonAnalysisHelperTest.h @@ -404,7 +404,7 @@ public: const auto currentWs = createWs("MUSR", 15189); const auto loadedWs = nullptr; TS_ASSERT_THROWS(isReloadGroupingNecessary(currentWs, loadedWs), - std::invalid_argument); + const std::invalid_argument &); } void test_isReloadGroupingNecessary_noLogs() { diff --git a/qt/scientific_interfaces/test/MuonAnalysisResultTableCreatorTest.h b/qt/scientific_interfaces/test/MuonAnalysisResultTableCreatorTest.h index 648768c3451..f436125c8a9 100644 --- a/qt/scientific_interfaces/test/MuonAnalysisResultTableCreatorTest.h +++ b/qt/scientific_interfaces/test/MuonAnalysisResultTableCreatorTest.h @@ -90,7 +90,7 @@ public: "EMU00020919; Pair; long; Asym; #1"}); MuonAnalysisResultTableCreator creator(workspaces, m_logs, &m_logValues, false); - TS_ASSERT_THROWS(creator.createTable(), std::runtime_error); + TS_ASSERT_THROWS(creator.createTable(), const std::runtime_error &); } void test_createTable_throws_noLogs() { @@ -100,7 +100,7 @@ public: this->setUpLogs(workspaces); MuonAnalysisResultTableCreator creator(workspaces, QStringList(), &m_logValues, false); - TS_ASSERT_THROWS(creator.createTable(), std::runtime_error); + TS_ASSERT_THROWS(creator.createTable(), const std::runtime_error &); } /// Two separate fits of one run each @@ -168,7 +168,7 @@ public: // Test MuonAnalysisResultTableCreator creator(workspaces, m_logs, &m_logValues, false); - TS_ASSERT_THROWS(creator.createTable(), std::runtime_error); + TS_ASSERT_THROWS(creator.createTable(), const std::runtime_error &); } /// Sequential fit of two runs @@ -303,7 +303,7 @@ public: // Test MuonAnalysisResultTableCreator creator(labels, m_logs, &m_logValues, true); - TS_ASSERT_THROWS(creator.createTable(), std::runtime_error); + TS_ASSERT_THROWS(creator.createTable(), const std::runtime_error &); } void test_haveSameParameters_Yes() { diff --git a/qt/scientific_interfaces/test/RunMapTest.h b/qt/scientific_interfaces/test/RunMapTest.h index 78d1a0cb35c..e6cba08045e 100644 --- a/qt/scientific_interfaces/test/RunMapTest.h +++ b/qt/scientific_interfaces/test/RunMapTest.h @@ -26,7 +26,7 @@ public: TS_ASSERT_THROWS_NOTHING(runMap.add(morphism, "Morphism")); const RunLabel al("789", 4); - TS_ASSERT_THROWS(runMap.add(al, "Al"), std::invalid_argument); + TS_ASSERT_THROWS(runMap.add(al, "Al"), const std::invalid_argument &); TS_ASSERT(runMap.contains(polly)); TS_ASSERT(runMap.contains(morphism)); @@ -57,7 +57,7 @@ public: TS_ASSERT(!runMap.contains(polly)); const RunLabel invalid("123", 4); - TS_ASSERT_THROWS(runMap.remove(invalid), std::invalid_argument); + TS_ASSERT_THROWS(runMap.remove(invalid), const std::invalid_argument &); } void test_getRunLabels() { diff --git a/qt/widgets/common/src/MuonFitPropertyBrowser.cpp b/qt/widgets/common/src/MuonFitPropertyBrowser.cpp index 019c9b5f916..a726a6b646d 100644 --- a/qt/widgets/common/src/MuonFitPropertyBrowser.cpp +++ b/qt/widgets/common/src/MuonFitPropertyBrowser.cpp @@ -1679,7 +1679,7 @@ bool MuonFitPropertyBrowser::isPeriodValid(const QString &name) { // if the box does not exist and there is more than 1 period in name return false; } - } catch (boost::bad_lexical_cast) { + } catch (const boost::bad_lexical_cast &) { // none int value return false; } diff --git a/qt/widgets/common/test/DataProcessorUI/PostprocessingAlgorithmTest.h b/qt/widgets/common/test/DataProcessorUI/PostprocessingAlgorithmTest.h index 730a23d0baa..a2a59e97595 100644 --- a/qt/widgets/common/test/DataProcessorUI/PostprocessingAlgorithmTest.h +++ b/qt/widgets/common/test/DataProcessorUI/PostprocessingAlgorithmTest.h @@ -37,13 +37,13 @@ public: void test_invalid_algorithms() { // Algorithms with no 'str list' property TS_ASSERT_THROWS(PostprocessingAlgorithm("StepScan"), - std::invalid_argument); + const std::invalid_argument &); // Algorithms with more than one 'str list' property TS_ASSERT_THROWS(PostprocessingAlgorithm("PDDetermineCharacterizations"), - std::invalid_argument); + const std::invalid_argument &); // Algorithms with invalid output ws properties TS_ASSERT_THROWS(PostprocessingAlgorithm("GroupWorkspaces"), - std::invalid_argument); + const std::invalid_argument &); } void test_valid_algorithms() { diff --git a/qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h b/qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h index 98f2b50494f..694dc84a821 100644 --- a/qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h +++ b/qt/widgets/common/test/DataProcessorUI/PreprocessingAlgorithmTest.h @@ -36,13 +36,13 @@ public: void test_invalid_algorithms() { // Algorithm with a single input ws property - TS_ASSERT_THROWS(PreprocessingAlgorithm("Rebin"), std::invalid_argument); + TS_ASSERT_THROWS(PreprocessingAlgorithm("Rebin"), const std::invalid_argument &); // Algorithm with more than two input ws properties TS_ASSERT_THROWS(PreprocessingAlgorithm("ReflectometryReductionOneAuto"), - std::invalid_argument); + const std::invalid_argument &); // Algorithm with two input ws properties but no output ws properties TS_ASSERT_THROWS(PreprocessingAlgorithm("ConjoinWorkspaces"), - std::invalid_argument); + const std::invalid_argument &); } void test_valid_algorithms() { diff --git a/qt/widgets/common/test/DataProcessorUI/ProcessingAlgorithmTest.h b/qt/widgets/common/test/DataProcessorUI/ProcessingAlgorithmTest.h index 8db1386d2f8..15e763876c3 100644 --- a/qt/widgets/common/test/DataProcessorUI/ProcessingAlgorithmTest.h +++ b/qt/widgets/common/test/DataProcessorUI/ProcessingAlgorithmTest.h @@ -52,10 +52,10 @@ public: // Algorithms with no input workspace properties TS_ASSERT_THROWS(ProcessingAlgorithm("Stitch1DMany", prefix, 0), - std::invalid_argument); + const std::invalid_argument &); // Algorithms with no output workspace properties TS_ASSERT_THROWS(ProcessingAlgorithm("SaveAscii", prefix, 0), - std::invalid_argument); + const std::invalid_argument &); } void test_ReflectometryReductionOneAuto() { @@ -69,12 +69,12 @@ public: // This should throw TS_ASSERT_THROWS( ProcessingAlgorithm(algName, prefixes, 0, std::set<QString>()), - std::invalid_argument); + const std::invalid_argument &); // This should also throw TS_ASSERT_THROWS( ProcessingAlgorithm(algName, prefixes, 0, std::set<QString>()), - std::invalid_argument); + const std::invalid_argument &); // But this should be OK prefixes.emplace_back("IvsLam_"); TS_ASSERT_THROWS_NOTHING( diff --git a/qt/widgets/common/test/DataProcessorUI/QOneLevelTreeModelTest.h b/qt/widgets/common/test/DataProcessorUI/QOneLevelTreeModelTest.h index 7946effb182..c9e2fe13646 100644 --- a/qt/widgets/common/test/DataProcessorUI/QOneLevelTreeModelTest.h +++ b/qt/widgets/common/test/DataProcessorUI/QOneLevelTreeModelTest.h @@ -71,12 +71,12 @@ public: ws->addColumn("str", "Group"); TS_ASSERT_THROWS(QOneLevelTreeModel(ws, m_whitelist), - std::invalid_argument); + const std::invalid_argument &); ws->addColumn("str", "Group1"); ws->addColumn("str", "Group2"); TS_ASSERT_THROWS(QOneLevelTreeModel(ws, m_whitelist), - std::invalid_argument); + const std::invalid_argument &); } void testConstructorOneRowTable() { @@ -272,8 +272,8 @@ public: model.setProcessed(true, 2); // Non-existent row - TS_ASSERT_THROWS(model.isProcessed(10), std::invalid_argument); - TS_ASSERT_THROWS(model.isProcessed(-1), std::invalid_argument); + TS_ASSERT_THROWS(model.isProcessed(10), const std::invalid_argument &); + TS_ASSERT_THROWS(model.isProcessed(-1), const std::invalid_argument &); // Only 1st and 3rd rows are processed TS_ASSERT_EQUALS(model.isProcessed(0), true); diff --git a/qt/widgets/common/test/DataProcessorUI/QTwoLevelTreeModelTest.h b/qt/widgets/common/test/DataProcessorUI/QTwoLevelTreeModelTest.h index a1b2e5d4881..b0da705f258 100644 --- a/qt/widgets/common/test/DataProcessorUI/QTwoLevelTreeModelTest.h +++ b/qt/widgets/common/test/DataProcessorUI/QTwoLevelTreeModelTest.h @@ -110,12 +110,12 @@ public: ws->removeColumn("Group"); TS_ASSERT_THROWS(QTwoLevelTreeModel(ws, m_whitelist), - std::invalid_argument); + const std::invalid_argument &); ws->addColumn("str", "Group1"); ws->addColumn("str", "Group2"); TS_ASSERT_THROWS(QTwoLevelTreeModel(ws, m_whitelist), - std::invalid_argument); + const std::invalid_argument &); } void testConstructorOneRowTable() { @@ -703,13 +703,13 @@ public: // Non-existent row TS_ASSERT_THROWS(model.isProcessed(10, model.index(0, 0)), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(model.isProcessed(-1, model.index(0, 0)), - std::invalid_argument); + const std::invalid_argument &); // Non-existent group - TS_ASSERT_THROWS(model.isProcessed(10), std::invalid_argument); - TS_ASSERT_THROWS(model.isProcessed(-1), std::invalid_argument); + TS_ASSERT_THROWS(model.isProcessed(10), const std::invalid_argument &); + TS_ASSERT_THROWS(model.isProcessed(-1), const std::invalid_argument &); // Only the 1st row of 1st group and 2nd group should be highlighted TS_ASSERT_EQUALS(model.isProcessed(model.index(0, 0).row(), QModelIndex()), @@ -729,7 +729,7 @@ public: auto rowValues = std::map<QString, QString>{{"Column1", "row_10"}, {"Column2", "row_11"}}; auto rowsToTransfer = std::vector<std::map<QString, QString>>{{rowValues}}; - TS_ASSERT_THROWS(model.transfer(rowsToTransfer), std::invalid_argument); + TS_ASSERT_THROWS(model.transfer(rowsToTransfer), const std::invalid_argument &); } void testTransferToExistingGroup() { diff --git a/qt/widgets/common/test/LogValueFinderTest.h b/qt/widgets/common/test/LogValueFinderTest.h index 2f0598917ed..a2f8014b2b9 100644 --- a/qt/widgets/common/test/LogValueFinderTest.h +++ b/qt/widgets/common/test/LogValueFinderTest.h @@ -113,9 +113,9 @@ public: << QString::fromStdString(ws1.name()); LogValueFinder finder(wsNames); TS_ASSERT_THROWS(finder.getLogValue("boolProp", StatisticType::Mean, 0), - std::invalid_argument); + const std::invalid_argument &); TS_ASSERT_THROWS(finder.getLogValue("boolProp", StatisticType::Mean, 1), - std::invalid_argument); + const std::invalid_argument &); } void test_getLogValue_nonExistentWorkspace_throws() { @@ -127,7 +127,7 @@ public: LogValueFinder finder(wsNames); TS_ASSERT_THROWS( finder.getLogValue("dblProp", StatisticType::Mean, "no_workspace"), - std::invalid_argument); + const std::invalid_argument &); } void test_getLogValue_indexOutOfRange_throws() { @@ -138,7 +138,7 @@ public: << QString::fromStdString(ws1.name()); LogValueFinder finder(wsNames); TS_ASSERT_THROWS(finder.getLogValue("dblProp", StatisticType::Mean, 2), - std::invalid_argument); + const std::invalid_argument &); } private: diff --git a/qt/widgets/common/test/ParseKeyValueStringTest.h b/qt/widgets/common/test/ParseKeyValueStringTest.h index b9c85bc4d56..8c100c84011 100644 --- a/qt/widgets/common/test/ParseKeyValueStringTest.h +++ b/qt/widgets/common/test/ParseKeyValueStringTest.h @@ -29,12 +29,12 @@ public: TS_ASSERT_EQUALS(kvp["g"], "'"); TS_ASSERT_THROWS(parseKeyValueString("a = 1, b = 2, c = 3,"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(parseKeyValueString("a = 1, b = 2, c = 3,d"), - std::runtime_error); - TS_ASSERT_THROWS(parseKeyValueString(",a = 1"), std::runtime_error); - TS_ASSERT_THROWS(parseKeyValueString(",a = 1 = 2,="), std::runtime_error); - TS_ASSERT_THROWS(parseKeyValueString("=,=,="), std::runtime_error); + const std::runtime_error &); + TS_ASSERT_THROWS(parseKeyValueString(",a = 1"), const std::runtime_error &); + TS_ASSERT_THROWS(parseKeyValueString(",a = 1 = 2,="), const std::runtime_error &); + TS_ASSERT_THROWS(parseKeyValueString("=,=,="), const std::runtime_error &); } void testParseKeyValueQString() { @@ -50,12 +50,12 @@ public: TS_ASSERT_EQUALS(kvp["g"], "'"); TS_ASSERT_THROWS(parseKeyValueQString("a = 1, b = 2, c = 3,"), - std::runtime_error); + const std::runtime_error &); TS_ASSERT_THROWS(parseKeyValueQString("a = 1, b = 2, c = 3,d"), - std::runtime_error); - TS_ASSERT_THROWS(parseKeyValueQString(",a = 1"), std::runtime_error); - TS_ASSERT_THROWS(parseKeyValueQString(",a = 1 = 2,="), std::runtime_error); - TS_ASSERT_THROWS(parseKeyValueQString("=,=,="), std::runtime_error); + const std::runtime_error &); + TS_ASSERT_THROWS(parseKeyValueQString(",a = 1"), const std::runtime_error &); + TS_ASSERT_THROWS(parseKeyValueQString(",a = 1 = 2,="), const std::runtime_error &); + TS_ASSERT_THROWS(parseKeyValueQString("=,=,="), const std::runtime_error &); } }; diff --git a/qt/widgets/common/test/PlotAxisTest.h b/qt/widgets/common/test/PlotAxisTest.h index 16b42d1cbec..5b03a086aaa 100644 --- a/qt/widgets/common/test/PlotAxisTest.h +++ b/qt/widgets/common/test/PlotAxisTest.h @@ -194,8 +194,8 @@ public: test_Index_Greater_Than_numDims_Or_Less_Than_Zero_Throws_Invalid_Argument() { using MantidQt::API::PlotAxis; auto ws = WorkspaceCreationHelper::create2DWorkspace(1, 1); - TS_ASSERT_THROWS(PlotAxis(*ws, 2), std::invalid_argument); - TS_ASSERT_THROWS(PlotAxis(*ws, -1), std::invalid_argument); + TS_ASSERT_THROWS(PlotAxis(*ws, 2), const std::invalid_argument &); + TS_ASSERT_THROWS(PlotAxis(*ws, -1), const std::invalid_argument &); } }; diff --git a/qt/widgets/common/test/Python/SipTest.h b/qt/widgets/common/test/Python/SipTest.h index 56b1e13dadd..72b1e27880e 100644 --- a/qt/widgets/common/test/Python/SipTest.h +++ b/qt/widgets/common/test/Python/SipTest.h @@ -60,7 +60,7 @@ public: struct Foo; TS_ASSERT_THROWS( MantidQt::Widgets::Common::Python::extract<Foo>(nonSipType), - std::runtime_error); + const std::runtime_error &); } }; diff --git a/qt/widgets/instrumentview/src/InstrumentWidget.cpp b/qt/widgets/instrumentview/src/InstrumentWidget.cpp index 571c1b76ae6..c833c0d7631 100644 --- a/qt/widgets/instrumentview/src/InstrumentWidget.cpp +++ b/qt/widgets/instrumentview/src/InstrumentWidget.cpp @@ -1368,7 +1368,7 @@ Workspace_sptr InstrumentWidget::getWorkspaceFromADS(const std::string &name) { try { workspace = AnalysisDataService::Instance().retrieve(name); - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { QMessageBox::warning(this, "Mantid - Warning", "No workspace called '" + QString::fromStdString(name) + "' found. "); diff --git a/qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp b/qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp index b41c47b05ff..f10f35a2050 100644 --- a/qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp +++ b/qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp @@ -960,7 +960,7 @@ void InstrumentWidgetMaskTab::saveMaskingToTableWorkspace(bool invertMask) { temptablews = boost::dynamic_pointer_cast<Mantid::API::ITableWorkspace>( Mantid::API::AnalysisDataService::Instance().retrieve( outputWorkspaceName)); - } catch (Mantid::Kernel::Exception::NotFoundError) { + } catch (const Mantid::Kernel::Exception::NotFoundError &) { std::cout << "TableWorkspace " << outputWorkspaceName << " cannot be found in ADS." << ".\n"; diff --git a/qt/widgets/instrumentview/src/UnwrappedSurface.cpp b/qt/widgets/instrumentview/src/UnwrappedSurface.cpp index c522499e459..7ef2b77ffec 100644 --- a/qt/widgets/instrumentview/src/UnwrappedSurface.cpp +++ b/qt/widgets/instrumentview/src/UnwrappedSurface.cpp @@ -699,7 +699,7 @@ UnwrappedSurface::retrievePeaksWorkspace(const std::string &name) const { try { ws = AnalysisDataService::Instance().retrieve(name); - } catch (std::runtime_error) { + } catch (const std::runtime_error &) { // couldn't find the workspace in the ADS for some reason // just fail silently. There's nothing more we can do. return nullptr; diff --git a/qt/widgets/mplcpp/test/ArtistTest.h b/qt/widgets/mplcpp/test/ArtistTest.h index 2872a928f12..34af9dfe1a8 100644 --- a/qt/widgets/mplcpp/test/ArtistTest.h +++ b/qt/widgets/mplcpp/test/ArtistTest.h @@ -48,7 +48,7 @@ public: void testConstructWithNonArtistThrowsInvalidArgument() { Python::Object none; - TS_ASSERT_THROWS(Artist artist(none), std::invalid_argument); + TS_ASSERT_THROWS(Artist artist(none), const std::invalid_argument &); } }; diff --git a/qt/widgets/mplcpp/test/AxesTest.h b/qt/widgets/mplcpp/test/AxesTest.h index 59b001478a8..ce146486164 100644 --- a/qt/widgets/mplcpp/test/AxesTest.h +++ b/qt/widgets/mplcpp/test/AxesTest.h @@ -109,19 +109,19 @@ public: // ----------------- failure tests --------------------- void testPlotThrowsWithEmptyData() { Axes axes(pyAxes()); - TS_ASSERT_THROWS(axes.plot({}, {}), std::invalid_argument); - TS_ASSERT_THROWS(axes.plot({1}, {}), std::invalid_argument); - TS_ASSERT_THROWS(axes.plot({}, {1}), std::invalid_argument); + TS_ASSERT_THROWS(axes.plot({}, {}), const std::invalid_argument &); + TS_ASSERT_THROWS(axes.plot({1}, {}), const std::invalid_argument &); + TS_ASSERT_THROWS(axes.plot({}, {1}), const std::invalid_argument &); } void testSetXScaleWithUnknownScaleTypeThrows() { Axes axes(pyAxes()); - TS_ASSERT_THROWS(axes.setXScale("notascaletype"), std::invalid_argument); + TS_ASSERT_THROWS(axes.setXScale("notascaletype"), const std::invalid_argument &); } void testSetYScaleWithUnknownScaleTypeThrows() { Axes axes(pyAxes()); - TS_ASSERT_THROWS(axes.setYScale("notascaletype"), std::invalid_argument); + TS_ASSERT_THROWS(axes.setYScale("notascaletype"), const std::invalid_argument &); } private: diff --git a/qt/widgets/mplcpp/test/ColormapTest.h b/qt/widgets/mplcpp/test/ColormapTest.h index 6769a0b62cb..1bf3d6cdf5a 100644 --- a/qt/widgets/mplcpp/test/ColormapTest.h +++ b/qt/widgets/mplcpp/test/ColormapTest.h @@ -46,7 +46,7 @@ public: void testConstructionWithNonColorMapObjectThrows() { TS_ASSERT_THROWS(Colormap cmap(MantidQt::Widgets::Common::Python::Object{}), - std::invalid_argument); + const std::invalid_argument &); } }; diff --git a/qt/widgets/mplcpp/test/CyclerTest.h b/qt/widgets/mplcpp/test/CyclerTest.h index aefda5455ea..038b31b0667 100644 --- a/qt/widgets/mplcpp/test/CyclerTest.h +++ b/qt/widgets/mplcpp/test/CyclerTest.h @@ -38,7 +38,7 @@ public: void testConstructWithNonCyclerThrowsInvalidArgument() { Python::Object none; - TS_ASSERT_THROWS(Cycler cycler(none), std::invalid_argument); + TS_ASSERT_THROWS(Cycler cycler(none), const std::invalid_argument &); } }; diff --git a/qt/widgets/mplcpp/test/FigureTest.h b/qt/widgets/mplcpp/test/FigureTest.h index ebf4dbbb906..b5c41fdce6c 100644 --- a/qt/widgets/mplcpp/test/FigureTest.h +++ b/qt/widgets/mplcpp/test/FigureTest.h @@ -68,7 +68,7 @@ public: // -------------------------- Failure tests --------------------------- void testFigureConstructedWithNonFigureThrows() { TS_ASSERT_THROWS(Figure fig(Python::NewRef(Py_BuildValue("(i)", 1))), - std::invalid_argument); + const std::invalid_argument &); } }; diff --git a/qt/widgets/mplcpp/test/Line2DTest.h b/qt/widgets/mplcpp/test/Line2DTest.h index d92def49ef1..66a317b1e79 100644 --- a/qt/widgets/mplcpp/test/Line2DTest.h +++ b/qt/widgets/mplcpp/test/Line2DTest.h @@ -37,7 +37,7 @@ public: // ---------------------- failure tests -------------------- void testConstructionWithNonLine2DObjectThrowsInvalidArgument() { Python::Object obj{Python::NewRef(Py_BuildValue("(i)", 1))}; - TS_ASSERT_THROWS(Line2D line(obj, {}, {}), std::invalid_argument); + TS_ASSERT_THROWS(Line2D line(obj, {}, {}), const std::invalid_argument &); } private: diff --git a/qt/widgets/mplcpp/test/QBackendExtractTest.h b/qt/widgets/mplcpp/test/QBackendExtractTest.h index 0544a9733b8..08e657f5e72 100644 --- a/qt/widgets/mplcpp/test/QBackendExtractTest.h +++ b/qt/widgets/mplcpp/test/QBackendExtractTest.h @@ -41,7 +41,7 @@ public: const Python::Object nonSipType{ Python::NewRef(Py_BuildValue("(ii)", 1, 2))}; struct Foo; - TS_ASSERT_THROWS(Python::extract<Foo>(nonSipType), std::runtime_error); + TS_ASSERT_THROWS(Python::extract<Foo>(nonSipType), const std::runtime_error &); } }; diff --git a/qt/widgets/sliceviewer/test/PeakPaletteTest.h b/qt/widgets/sliceviewer/test/PeakPaletteTest.h index b1dafc85bf2..47256d1a6a9 100644 --- a/qt/widgets/sliceviewer/test/PeakPaletteTest.h +++ b/qt/widgets/sliceviewer/test/PeakPaletteTest.h @@ -46,10 +46,10 @@ public: PeakPalette<QColor> palette; TSM_ASSERT_THROWS("\n\nIndex > Max Index, should throw.\n", palette.foregroundIndexToColour(indexTooHigh), - std::out_of_range); + const std::out_of_range &); TSM_ASSERT_THROWS("\n\nIndex < Max Index, should throw.\n", palette.foregroundIndexToColour(indexTooLow), - std::out_of_range); + const std::out_of_range &); } void test_backgroundIndexToColour_throws_if_out_of_range() { @@ -59,10 +59,10 @@ public: PeakPalette<QColor> palette; TSM_ASSERT_THROWS("\n\nIndex > Max Index, should throw.\n", palette.backgroundIndexToColour(indexTooHigh), - std::out_of_range); + const std::out_of_range &); TSM_ASSERT_THROWS("\n\nIndex < Max Index, should throw.\n", palette.backgroundIndexToColour(indexTooLow), - std::out_of_range); + const std::out_of_range &); } void test_setForgroundColour() { @@ -118,10 +118,10 @@ public: PeakPalette<QColor> palette; TSM_ASSERT_THROWS("\n\nIndex is > Max Index. Should throw\n.", palette.setForegroundColour(indexTooHigh, Qt::red), - std::out_of_range); + const std::out_of_range &); TSM_ASSERT_THROWS("\n\nIndex is < Min Index. Should throw\n", palette.setForegroundColour(indexTooLow, Qt::red), - std::out_of_range); + const std::out_of_range &); } void test_setBackgroundColour_throws_if_out_of_range() { @@ -131,10 +131,10 @@ public: PeakPalette<QColor> palette; TSM_ASSERT_THROWS("\n\nIndex is > Max Index. Should throw\n.", palette.setBackgroundColour(indexTooHigh, Qt::red), - std::out_of_range); + const std::out_of_range &); TSM_ASSERT_THROWS("\n\nIndex is < Min Index. Should throw\n", palette.setBackgroundColour(indexTooLow, Qt::red), - std::out_of_range); + const std::out_of_range &); } void testCopy() { -- GitLab