Commit 02ab69f9 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Fixes for clang-tidy modernize-use-nullptr

parent 6a53e65b
......@@ -16,7 +16,7 @@ public:
void test_Clone_With_Only_Workspace_Returns_BinEdgeAxis_() {
BinEdgeAxis ax1(10);
Mantid::API::Axis *copy = ax1.clone(NULL);
Mantid::API::Axis *copy = ax1.clone(nullptr);
auto *typedCopy = dynamic_cast<BinEdgeAxis *>(copy);
TS_ASSERT(typedCopy);
......@@ -27,7 +27,7 @@ public:
void
test_Clone_With_Only_Length_And_Workspace_Returns_BinEdgeAxis_With_New_Length() {
BinEdgeAxis ax1(10);
Mantid::API::Axis *copy = ax1.clone(20, NULL);
Mantid::API::Axis *copy = ax1.clone(20, nullptr);
auto *typedCopy = dynamic_cast<BinEdgeAxis *>(copy);
TS_ASSERT(typedCopy);
......
......@@ -104,7 +104,7 @@ public:
void test_Setting_A_New_Source_With_NULL_Ptr_Throws() {
ExperimentInfo ws;
TS_ASSERT_THROWS(ws.setModeratorModel(NULL), std::invalid_argument);
TS_ASSERT_THROWS(ws.setModeratorModel(nullptr), std::invalid_argument);
}
void test_Retrieving_Source_Properties_Before_Set_Throws() {
......@@ -191,7 +191,7 @@ public:
addRunWithLog(expt, actualLogName, logValue);
addInstrumentWithParameter(expt, instPar, actualLogName);
Property *log(NULL);
Property *log(nullptr);
TS_ASSERT_THROWS_NOTHING(log = expt.getLog(instPar));
TS_ASSERT_EQUALS(log->name(), actualLogName);
}
......@@ -203,7 +203,7 @@ public:
addRunWithLog(expt, actualLogName, logValue);
addInstrumentWithParameter(expt, actualLogName, "some value");
Property *log(NULL);
Property *log(nullptr);
TS_ASSERT_THROWS_NOTHING(log = expt.getLog(actualLogName));
TS_ASSERT_EQUALS(log->name(), actualLogName);
}
......
......@@ -469,7 +469,7 @@ public:
// Shun use of Poco, which is slower.
FILE *pFile;
pFile = fopen(cstr, "w");
if (pFile != NULL) {
if (pFile != nullptr) {
fclose(pFile);
}
}
......
......@@ -70,7 +70,7 @@ public:
dynamic_cast<MockImplicitFunctionParameterParserA *>(parser);
TSM_ASSERT("The correct implicit implicit function parameter parser type "
"has not been generated",
NULL != a);
nullptr != a);
delete parser;
}
......@@ -82,7 +82,7 @@ public:
dynamic_cast<MockImplicitFunctionParameterParserB *>(parser);
TSM_ASSERT("The correct implicit function parameter parser type has not "
"been generated",
NULL != b);
nullptr != b);
delete parser;
}
......
......@@ -19,7 +19,7 @@ private:
public:
Mantid::API::ImplicitFunctionParameter *
createParameter(Poco::XML::Element *) override {
return NULL;
return nullptr;
}
void setSuccessorParser(
Mantid::API::ImplicitFunctionParameterParser *) override {}
......@@ -34,7 +34,7 @@ private:
Mantid::API::ImplicitFunctionBuilder *
createFunctionBuilder(Poco::XML::Element *) override {
return NULL;
return nullptr;
}
void setSuccessorParser(Mantid::API::ImplicitFunctionParser *) override {}
void setParameterParser(
......@@ -50,7 +50,7 @@ private:
Mantid::API::ImplicitFunctionBuilder *
createFunctionBuilder(Poco::XML::Element *) override {
return NULL;
return nullptr;
}
void setSuccessorParser(Mantid::API::ImplicitFunctionParser *) override {}
void setParameterParser(
......@@ -73,7 +73,7 @@ public:
dynamic_cast<MockImplicitFunctionParserA *>(parser);
TSM_ASSERT("The correct implicit parserparameter parser type has not been "
"generated",
NULL != a);
nullptr != a);
delete parser;
}
......@@ -85,7 +85,7 @@ public:
dynamic_cast<MockImplicitFunctionParserB *>(parser);
TSM_ASSERT("The correct implicit parserparameter parser type has not been "
"generated",
NULL != b);
nullptr != b);
delete parser;
}
......
......@@ -69,7 +69,7 @@ public:
Property *p = new ConcreteProperty();
TS_ASSERT_THROWS_NOTHING(runInfo.addProperty(p));
Property *pp = NULL;
Property *pp = nullptr;
TS_ASSERT_THROWS_NOTHING(pp = runInfo.getProperty("Test"));
TS_ASSERT_EQUALS(p, pp);
TS_ASSERT(!pp->name().compare("Test"));
......@@ -184,7 +184,7 @@ public:
const double value = 10.9;
addTimeSeriesEntry(runInfo, name, value);
TimeSeriesProperty<double> *tsp(NULL);
TimeSeriesProperty<double> *tsp(nullptr);
TS_ASSERT_THROWS_NOTHING(tsp = runInfo.getTimeSeriesProperty<double>(name));
TS_ASSERT_DELTA(tsp->firstValue(), value, 1e-12);
}
......
......@@ -133,10 +133,10 @@ public:
g.getTransformToOriginal(0));
TS_ASSERT_DIFFERS(g2.getTransformToOriginal(1),
g.getTransformToOriginal(1));
TS_ASSERT(g2.getTransformFromOriginal(0) != NULL);
TS_ASSERT(g2.getTransformFromOriginal(1) != NULL);
TS_ASSERT(g2.getTransformToOriginal(0) != NULL);
TS_ASSERT(g2.getTransformToOriginal(1) != NULL);
TS_ASSERT(g2.getTransformFromOriginal(0) != nullptr);
TS_ASSERT(g2.getTransformFromOriginal(1) != nullptr);
TS_ASSERT(g2.getTransformToOriginal(0) != nullptr);
TS_ASSERT(g2.getTransformToOriginal(1) != nullptr);
}
/** Adding dimension info and searching for it back */
......
......@@ -51,7 +51,7 @@ public:
void test_iterating() {
boost::shared_ptr<MatrixWorkspace> ws = makeFakeWS();
IMDIterator *it = NULL;
IMDIterator *it = nullptr;
TS_ASSERT_THROWS_NOTHING(it = ws->createIterator(NULL));
TS_ASSERT_EQUALS(it->getDataSize(), 20);
TS_ASSERT_DELTA(it->getSignal(), 0.0, 1e-5);
......
......@@ -95,14 +95,14 @@ public:
void testDefaultConstruction() {
TestablePeakFunctionIntegrator integrator;
TS_ASSERT(integrator.m_integrationWorkspace != 0);
TS_ASSERT(integrator.m_integrationWorkspace != nullptr);
TS_ASSERT_EQUALS(integrator.m_relativePrecision, 1e-8);
}
void testConstruction() {
TestablePeakFunctionIntegrator integrator(1e-10);
TS_ASSERT(integrator.m_integrationWorkspace != 0);
TS_ASSERT(integrator.m_integrationWorkspace != nullptr);
TS_ASSERT_EQUALS(integrator.m_relativePrecision, 1e-10);
}
......
......@@ -73,7 +73,7 @@ public:
Property *p = new ConcreteProperty();
TS_ASSERT_THROWS_NOTHING(runInfo.addProperty(p));
Property *pp = NULL;
Property *pp = nullptr;
TS_ASSERT_THROWS_NOTHING(pp = runInfo.getProperty("Test"));
TS_ASSERT_EQUALS(p, pp);
TS_ASSERT(!pp->name().compare("Test"));
......@@ -142,7 +142,7 @@ public:
const double value = 10.9;
addTimeSeriesEntry(runInfo, name, value);
TimeSeriesProperty<double> *tsp(NULL);
TimeSeriesProperty<double> *tsp(nullptr);
TS_ASSERT_THROWS_NOTHING(tsp = runInfo.getTimeSeriesProperty<double>(name));
TS_ASSERT_DELTA(tsp->firstValue(), value, 1e-12);
}
......
......@@ -20,7 +20,7 @@ public:
static void destroySuite(SpectrumDetectorMappingTest *suite) { delete suite; }
void test_workspace_constructor_null_pointer() {
TS_ASSERT_THROWS(SpectrumDetectorMapping(NULL), std::invalid_argument);
TS_ASSERT_THROWS(SpectrumDetectorMapping(nullptr), std::invalid_argument);
}
void test_workspace_constructor_fills_map() {
......@@ -114,9 +114,9 @@ public:
void test_array_constructor_null_inputs() {
specnum_t specs[2];
detid_t detids[2];
TS_ASSERT_THROWS(SpectrumDetectorMapping(NULL, detids, 10),
TS_ASSERT_THROWS(SpectrumDetectorMapping(nullptr, detids, 10),
std::invalid_argument);
TS_ASSERT_THROWS(SpectrumDetectorMapping(specs, NULL, 10),
TS_ASSERT_THROWS(SpectrumDetectorMapping(specs, nullptr, 10),
std::invalid_argument);
}
......
......@@ -70,7 +70,7 @@ public:
dynamic_cast<ConcreteVectorDblParam *>(product);
TSM_ASSERT("The wrong product parameter has been produced",
(actualProduct != NULL));
(actualProduct != nullptr));
double v1 = (*actualProduct)[0];
double v2 = (*actualProduct)[1];
double v3 = (*actualProduct)[2];
......@@ -131,7 +131,7 @@ public:
dynamic_cast<ConcreteVectorBoolParam *>(product);
TSM_ASSERT("The wrong product parameter has been produced",
(actualProduct != NULL));
(actualProduct != nullptr));
bool v1 = (*actualProduct)[0];
bool v2 = (*actualProduct)[1];
......@@ -167,7 +167,7 @@ public:
ConcreteVectorDblParamParser parser;
ConcreteVectorDblParam *product = parser.createWithoutDelegation(pRootElem);
TS_ASSERT(product != NULL);
TS_ASSERT(product != nullptr);
delete product;
}
};
......
......@@ -62,14 +62,14 @@ public:
TS_ASSERT_THROWS_NOTHING(alg.execute(););
if (willFail) {
TS_ASSERT(!alg.isExecuted());
return NULL;
return nullptr;
} else
TS_ASSERT(alg.isExecuted());
Run &run = ws->mutableRun();
TS_ASSERT(run.hasProperty(NewLogName));
if (!run.hasProperty(NewLogName))
return NULL;
return nullptr;
p = dynamic_cast<TimeSeriesProperty<double> *>(run.getProperty(NewLogName));
TS_ASSERT(p);
return p;
......
......@@ -204,7 +204,7 @@ public:
alg.getProperty("Workspace"));
const Run &wSpaceRun = output->run();
Property *prop = NULL;
Property *prop = nullptr;
TS_ASSERT_THROWS_NOTHING(prop = wSpaceRun.getLogData(LogName);)
if (!prop)
return;
......
......@@ -41,7 +41,7 @@ public:
const int nummask = 5;
Instrument_sptr instr = boost::dynamic_pointer_cast<Instrument>(
ComponentCreationHelper::createTestInstrumentCylindrical(1));
Detector *d = new Detector("det", 0, 0);
Detector *d = new Detector("det", 0, nullptr);
instr->add(d);
instr->markAsDetector(d);
......
......@@ -48,7 +48,7 @@ private:
outputWSSignedTheta));
// Check the signed theta axes of the workspaces.
const Axis *thetaAxis = 0;
const Axis *thetaAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(thetaAxis = outputSignedTheta->getAxis(1));
TS_ASSERT(thetaAxis->isNumeric());
......@@ -74,7 +74,7 @@ private:
outputWSTheta));
// Workspaces should now have a numeric axes up the side, with units of
// angle.
const Axis *thetaAxis = 0;
const Axis *thetaAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(thetaAxis = output->getAxis(1));
TS_ASSERT(thetaAxis->isNumeric());
TS_ASSERT_EQUALS(thetaAxis->unit()->caption(), "Scattering angle");
......@@ -212,7 +212,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of Q
const Axis *qAxis = 0;
const Axis *qAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(qAxis = output->getAxis(1));
TS_ASSERT(qAxis->isNumeric());
TS_ASSERT_EQUALS(qAxis->unit()->unitID(), "MomentumTransfer");
......@@ -254,7 +254,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of d
const Axis *qAxis = 0;
const Axis *qAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(qAxis = output->getAxis(1));
TS_ASSERT(qAxis->isNumeric());
TS_ASSERT_EQUALS(qAxis->unit()->unitID(), "dSpacing");
......@@ -296,7 +296,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of Q^2
const Axis *q2Axis = 0;
const Axis *q2Axis = nullptr;
TS_ASSERT_THROWS_NOTHING(q2Axis = output->getAxis(1));
TS_ASSERT(q2Axis->isNumeric());
TS_ASSERT_EQUALS(q2Axis->unit()->unitID(), "QSquared");
......@@ -358,7 +358,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of Q
const Axis *qAxis = 0;
const Axis *qAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(qAxis = output->getAxis(1));
TS_ASSERT(qAxis->isNumeric());
TS_ASSERT_EQUALS(qAxis->unit()->unitID(), "MomentumTransfer");
......@@ -412,7 +412,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of Q.
const Axis *qAxis = 0;
const Axis *qAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(qAxis = output->getAxis(1));
TS_ASSERT(qAxis->isNumeric());
TS_ASSERT_EQUALS(qAxis->unit()->unitID(), "MomentumTransfer");
......
......@@ -70,7 +70,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of angle
const Axis *thetaAxis = 0;
const Axis *thetaAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(thetaAxis = output->getAxis(1));
TS_ASSERT(thetaAxis->isNumeric());
TS_ASSERT_EQUALS(thetaAxis->unit()->caption(), "Scattering angle");
......@@ -106,7 +106,7 @@ public:
outputSignedThetaAxisWS));
// Check the signed theta axis
const Axis *thetaAxis = 0;
const Axis *thetaAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(thetaAxis = outputSignedTheta->getAxis(1));
TS_ASSERT(thetaAxis->isNumeric());
TS_ASSERT_EQUALS(thetaAxis->unit()->caption(), "Scattering angle");
......@@ -152,7 +152,7 @@ public:
outputWS));
// Should now have a numeric axis up the side, with units of angle
const Axis *thetaAxis = 0;
const Axis *thetaAxis = nullptr;
TS_ASSERT_THROWS_NOTHING(thetaAxis = output->getAxis(1));
TS_ASSERT(thetaAxis->isNumeric());
TS_ASSERT_EQUALS(thetaAxis->unit()->caption(), "Energy transfer");
......
......@@ -40,7 +40,7 @@ public:
boost::dynamic_pointer_cast<Mantid::DataObjects::WorkspaceSingleValue>(
ws);
TS_ASSERT(ws.get() != 0);
TS_ASSERT(ws.get() != nullptr);
// Test the data
TS_ASSERT_DELTA(single->x(0)[0], 0.0, 1e-08);
......@@ -82,7 +82,7 @@ public:
boost::dynamic_pointer_cast<Mantid::DataObjects::WorkspaceSingleValue>(
ws);
TS_ASSERT(ws.get() != 0);
TS_ASSERT(ws.get() != nullptr);
// Test the data
TS_ASSERT_DELTA(single->x(0)[0], 0.0, 1e-08);
......
......@@ -72,7 +72,7 @@ public:
work_in->getSpectrum(i).setSpectrumNo(i);
Mantid::Geometry::Detector *det =
new Mantid::Geometry::Detector("", i, NULL);
new Mantid::Geometry::Detector("", i, nullptr);
instr->add(det);
instr->markAsDetector(det);
work_in->getSpectrum(i).setDetectorID(i);
......
......@@ -69,7 +69,7 @@ public:
work_in->getSpectrum(i).setSpectrumNo(i);
Mantid::Geometry::Detector *det =
new Mantid::Geometry::Detector("", i, NULL);
new Mantid::Geometry::Detector("", i, nullptr);
instr->add(det);
instr->markAsDetector(det);
work_in->getSpectrum(i).setDetectorID(i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment