Skip to content

Commit

Permalink
Extend LoadFullprofResolutionTest.h re #7617
Browse files Browse the repository at this point in the history
Test extended to test the names of parameters I'll use later on.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Sep 16, 2013
1 parent 4045674 commit 6847cd0
Showing 1 changed file with 61 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@ class LoadFullprofResolutionTest : public CxxTest::TestSuite
TS_ASSERT(alg.isExecuted());

TableWorkspace_sptr outws = boost::dynamic_pointer_cast<TableWorkspace>(
AnalysisDataService::Instance().retrieve("TestBank1Table"));
AnalysisDataService::Instance().retrieve("TestBank1Table"));
TS_ASSERT(outws);

TS_ASSERT_EQUALS(outws->columnCount(), 2);
TS_ASSERT_EQUALS(outws->rowCount(), 27);

// 3. Verify value
// 3. Verify name and value
map<string, double> parammap;
parseTableWorkspace(outws, parammap);

TS_ASSERT_EQUALS(parammap.count("Zero"),1);
TS_ASSERT_EQUALS(parammap.count("Sig2"),1);
TS_ASSERT_EQUALS(parammap.count("Beta0t"),1);

TS_ASSERT_DELTA(parammap["Zero"], -1.00, 0.0001);
TS_ASSERT_DELTA(parammap["Sig2"], sqrt(514.546), 0.0001);
TS_ASSERT_DELTA(parammap["Beta0t"], 85.918922, 0.00001);
Expand Down Expand Up @@ -95,9 +99,12 @@ class LoadFullprofResolutionTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS(outws->columnCount(), 2);
TS_ASSERT_EQUALS(outws->rowCount(), 27);

// 3. Verify value
// 3. Verify name and value
map<string, double> parammap;
parseTableWorkspace(outws, parammap);
TS_ASSERT_EQUALS(parammap.count("Dtt1"),1);
TS_ASSERT_EQUALS(parammap.count("Sig1"),1);
TS_ASSERT_EQUALS(parammap.count("Alph0t"),1);

TS_ASSERT_DELTA(parammap["Dtt1"], 22586.10156, 0.0001);
TS_ASSERT_DELTA(parammap["Sig1"], sqrt(10.00), 0.0001);
Expand Down Expand Up @@ -207,6 +214,57 @@ class LoadFullprofResolutionTest : public CxxTest::TestSuite
return;
}

//----------------------------------------------------------------------------------------------
/** Test import of ALFBE, GAMMA and SIGMA parameters
* and check they are given their expected names.
* ConvertFullprofToXML relies on features tested here.
*/
void test_ags_parameters()
{
// 1. Generate file
string filename("TestAGS.irf");
generate1BankIrfFile(filename);

// 2. Load
LoadFullprofResolution alg;
alg.initialize();

alg.setProperty("Filename", filename);
alg.setPropertyValue("Banks", "1");
alg.setProperty("OutputWorkspace", "TestAGSTable");

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

TableWorkspace_sptr outws = boost::dynamic_pointer_cast<TableWorkspace>(
AnalysisDataService::Instance().retrieve("TestAGSTable"));
TS_ASSERT(outws);

// 3. Verify names
map<string, double> parammap;
parseTableWorkspace(outws, parammap);

// 3a. ALFBE
TS_ASSERT_EQUALS(parammap.count("Alph0"),1);
TS_ASSERT_EQUALS(parammap.count("Beta0"),1);
TS_ASSERT_EQUALS(parammap.count("Alph1"),1);
TS_ASSERT_EQUALS(parammap.count("Beta1"),1);
// 3b. GAMMA
TS_ASSERT_EQUALS(parammap.count("Gam2"),1);
TS_ASSERT_EQUALS(parammap.count("Gam1"),1);
TS_ASSERT_EQUALS(parammap.count("Gam0"),1);
// 3c. SIGMA
TS_ASSERT_EQUALS(parammap.count("Sig2"),1);
TS_ASSERT_EQUALS(parammap.count("Sig1"),1);
TS_ASSERT_EQUALS(parammap.count("Sig0"),1);

// 4. Clean
AnalysisDataService::Instance().remove("TestAGSTable");
Poco::File("TestAGS.irf").remove();

return;
}

//----------------------------------------------------------------------------------------------
/** Test Exception
*/
Expand Down

0 comments on commit 6847cd0

Please sign in to comment.