Skip to content

Commit

Permalink
Fixed indentation of the test code.
Browse files Browse the repository at this point in the history
Refs #7229
  • Loading branch information
arturbekasov committed Oct 1, 2013
1 parent 3f1e242 commit 4e1085b
Showing 1 changed file with 146 additions and 146 deletions.
292 changes: 146 additions & 146 deletions Code/Mantid/Framework/Algorithms/test/PlotAsymmetryByLogValueTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,155 +23,155 @@ class PlotAsymmetryByLogValueTest : public CxxTest::TestSuite
static PlotAsymmetryByLogValueTest *createSuite() { return new PlotAsymmetryByLogValueTest(); }
static void destroySuite( PlotAsymmetryByLogValueTest *suite ) { delete suite; }

PlotAsymmetryByLogValueTest()
:firstRun("MUSR00015189.nxs"),lastRun("MUSR00015199.nxs")
PlotAsymmetryByLogValueTest()
:firstRun("MUSR00015189.nxs"),lastRun("MUSR00015199.nxs")
{
}

void testExec()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","Field_Danfysik");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");

TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
TS_ASSERT_EQUALS(outWS->blocksize(),11);
TS_ASSERT_EQUALS(outWS->getNumberHistograms(),4);
const Mantid::MantidVec& Y = outWS->readY(0);
TS_ASSERT_DELTA(Y[0],0.0128845,0.001);
TS_ASSERT_DELTA(Y[1],0.0224898,0.00001);
TS_ASSERT_DELTA(Y[2],0.0387179,0.00001);
TS_ASSERT_DELTA(Y[3],0.0545464,0.00001);
TS_ASSERT_DELTA(Y[4],0.0906989,0.00001);
TS_ASSERT_DELTA(Y[5],0.107688,0.00001);
TS_ASSERT_DELTA(Y[6],0.0782618,0.00001);
TS_ASSERT_DELTA(Y[7],0.0448036,0.00001);
TS_ASSERT_DELTA(Y[8],0.0278501,0.00001);
TS_ASSERT_DELTA(Y[9],0.0191948,0.00001);
TS_ASSERT_DELTA(Y[10],0.0142141,0.00001);

const TextAxis* axis = dynamic_cast<const TextAxis*>(outWS->getAxis(1));
TS_ASSERT(axis);
if (axis)
{
TS_ASSERT_EQUALS(axis->length(),4);
TS_ASSERT_EQUALS(axis->label(0),"Red-Green");
TS_ASSERT_EQUALS(axis->label(1),"Red");
TS_ASSERT_EQUALS(axis->label(2),"Green");
TS_ASSERT_EQUALS(axis->label(3),"Red+Green");
}

void testExec()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","Field_Danfysik");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");

TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
TS_ASSERT_EQUALS(outWS->blocksize(),11);
TS_ASSERT_EQUALS(outWS->getNumberHistograms(),4);
const Mantid::MantidVec& Y = outWS->readY(0);
TS_ASSERT_DELTA(Y[0],0.0128845,0.001);
TS_ASSERT_DELTA(Y[1],0.0224898,0.00001);
TS_ASSERT_DELTA(Y[2],0.0387179,0.00001);
TS_ASSERT_DELTA(Y[3],0.0545464,0.00001);
TS_ASSERT_DELTA(Y[4],0.0906989,0.00001);
TS_ASSERT_DELTA(Y[5],0.107688,0.00001);
TS_ASSERT_DELTA(Y[6],0.0782618,0.00001);
TS_ASSERT_DELTA(Y[7],0.0448036,0.00001);
TS_ASSERT_DELTA(Y[8],0.0278501,0.00001);
TS_ASSERT_DELTA(Y[9],0.0191948,0.00001);
TS_ASSERT_DELTA(Y[10],0.0142141,0.00001);

const TextAxis* axis = dynamic_cast<const TextAxis*>(outWS->getAxis(1));
TS_ASSERT(axis);
if (axis)
{
TS_ASSERT_EQUALS(axis->length(),4);
TS_ASSERT_EQUALS(axis->label(0),"Red-Green");
TS_ASSERT_EQUALS(axis->label(1),"Red");
TS_ASSERT_EQUALS(axis->label(2),"Green");
TS_ASSERT_EQUALS(axis->label(3),"Red+Green");
}
AnalysisDataService::Instance().clear();
}
AnalysisDataService::Instance().clear();
}

void testDifferential()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","Field_Danfysik");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.setPropertyValue("Type","Differential");

TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
TS_ASSERT_EQUALS(outWS->blocksize(),11);
TS_ASSERT_EQUALS(outWS->getNumberHistograms(),4);
const Mantid::MantidVec& Y = outWS->readY(0);
TS_ASSERT_DELTA(Y[0],-0.01236,0.001);
TS_ASSERT_DELTA(Y[1],0.019186,0.00001);
TS_ASSERT_DELTA(Y[2],0.020093,0.00001);
TS_ASSERT_DELTA(Y[3],0.037658,0.00001);
TS_ASSERT_DELTA(Y[4],0.085060,0.00001);
TS_ASSERT_DELTA(Y[5],0.054248,0.00001);
TS_ASSERT_DELTA(Y[6],0.042526,0.00001);
TS_ASSERT_DELTA(Y[7],0.012002,0.00001);
TS_ASSERT_DELTA(Y[8],0.029188,0.00001);
TS_ASSERT_DELTA(Y[9],0.009614,0.00001);
TS_ASSERT_DELTA(Y[10],0.007757,0.00001);
AnalysisDataService::Instance().clear();
}

void test_int_log()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","nspectra");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.execute();

TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
AnalysisDataService::Instance().clear();
}

void test_string_log()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","run_number");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.execute();

TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
AnalysisDataService::Instance().clear();
}

void test_text_log()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","run_title");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.execute();

TS_ASSERT( ! alg.isExecuted() );

AnalysisDataService::Instance().clear();
}
void testDifferential()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","Field_Danfysik");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.setPropertyValue("Type","Differential");

TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
TS_ASSERT_EQUALS(outWS->blocksize(),11);
TS_ASSERT_EQUALS(outWS->getNumberHistograms(),4);
const Mantid::MantidVec& Y = outWS->readY(0);
TS_ASSERT_DELTA(Y[0],-0.01236,0.001);
TS_ASSERT_DELTA(Y[1],0.019186,0.00001);
TS_ASSERT_DELTA(Y[2],0.020093,0.00001);
TS_ASSERT_DELTA(Y[3],0.037658,0.00001);
TS_ASSERT_DELTA(Y[4],0.085060,0.00001);
TS_ASSERT_DELTA(Y[5],0.054248,0.00001);
TS_ASSERT_DELTA(Y[6],0.042526,0.00001);
TS_ASSERT_DELTA(Y[7],0.012002,0.00001);
TS_ASSERT_DELTA(Y[8],0.029188,0.00001);
TS_ASSERT_DELTA(Y[9],0.009614,0.00001);
TS_ASSERT_DELTA(Y[10],0.007757,0.00001);
AnalysisDataService::Instance().clear();
}

void test_int_log()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","nspectra");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.execute();

TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
AnalysisDataService::Instance().clear();
}

void test_string_log()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","run_number");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.execute();

TS_ASSERT(alg.isExecuted());

MatrixWorkspace_sptr outWS = boost::dynamic_pointer_cast<MatrixWorkspace>(
AnalysisDataService::Instance().retrieve("PlotAsymmetryByLogValueTest_WS")
);

TS_ASSERT(outWS);
AnalysisDataService::Instance().clear();
}

void test_text_log()
{
PlotAsymmetryByLogValue alg;
alg.initialize();
alg.setPropertyValue("FirstRun",firstRun);
alg.setPropertyValue("LastRun",lastRun);
alg.setPropertyValue("OutputWorkspace","PlotAsymmetryByLogValueTest_WS");
alg.setPropertyValue("LogValue","run_title");
alg.setPropertyValue("Red","2");
alg.setPropertyValue("Green","1");
alg.execute();

TS_ASSERT( ! alg.isExecuted() );

AnalysisDataService::Instance().clear();
}

private:
std::string firstRun,lastRun;
Expand Down

0 comments on commit 4e1085b

Please sign in to comment.