Skip to content

Commit

Permalink
Update LoadParameterFileTest.
Browse files Browse the repository at this point in the history
We now test setting parameters by detector id.

Refs #9959
  • Loading branch information
Harry Jeffery committed Jul 29, 2014
1 parent a96ac72 commit cd4ab88
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Code/Mantid/Framework/DataHandling/test/LoadParameterFileTest.h
Expand Up @@ -59,6 +59,13 @@ class LoadParameterFileTest : public CxxTest::TestSuite
param = paramMap.get(&(*ptrDet), "fjols-test-paramfile");
TS_ASSERT_DELTA( param->value<double>(), 50.0, 0.0001);

ptrDet = i->getDetector(1301);
TS_ASSERT_EQUALS( ptrDet->getID(), 1301);
TS_ASSERT_EQUALS( ptrDet->getName(), "pixel");
param = paramMap.get(ptrDet.get(), "testDouble");
TS_ASSERT_DELTA( param->value<double>(), 25.0, 0.0001);
TS_ASSERT_EQUALS( paramMap.getString(ptrDet.get(), "testString"), "hello world");

std::vector<double> dummy = paramMap.getDouble("nickel-holder", "klovn");
TS_ASSERT_DELTA( dummy[0], 1.0, 0.0001);
dummy = paramMap.getDouble("nickel-holder", "pos");
Expand Down Expand Up @@ -92,6 +99,10 @@ class LoadParameterFileTest : public CxxTest::TestSuite
" <component-link name=\"IDF_for_UNIT_TESTING2.xml/combined translation6\" >"
" <parameter name=\"fjols-test-paramfile\"> <value val=\"52.0\" /> </parameter>"
" </component-link>"
" <component-link id=\"1301\" >"
" <parameter name=\"testDouble\"> <value val=\"27.0\" /> </parameter>"
" <parameter name=\"testString\" type=\"string\"> <value val=\"goodbye world\" /> </parameter>"
" </component-link>"
"</parameter-file>";

// load in additional parameters
Expand All @@ -118,6 +129,13 @@ class LoadParameterFileTest : public CxxTest::TestSuite
param = paramMap.get(&(*ptrDet), "fjols-test-paramfile");
TS_ASSERT_DELTA( param->value<double>(), 52.0, 0.0001);

ptrDet = i->getDetector(1301);
TS_ASSERT_EQUALS( ptrDet->getID(), 1301);
TS_ASSERT_EQUALS( ptrDet->getName(), "pixel");
param = paramMap.get(ptrDet.get(), "testDouble");
TS_ASSERT_DELTA( param->value<double>(), 27.0, 0.0001);
TS_ASSERT_EQUALS( paramMap.getString(ptrDet.get(), "testString"), "goodbye world");

std::vector<double> dummy = paramMap.getDouble("nickel-holder", "klovn");
TS_ASSERT_DELTA( dummy[0], 1.0, 0.0001);
dummy = paramMap.getDouble("nickel-holder", "pos");
Expand Down
Expand Up @@ -9,4 +9,9 @@
<parameter name="fjols-test-paramfile"> <value val="50.0" /> </parameter>
</component-link>

<component-link id="1301" >
<parameter name="testDouble"> <value val="25.0" /> </parameter>
<parameter name="testString" type="string"> <value val="hello world" /> </parameter>
</component-link>

</parameter-file>

0 comments on commit cd4ab88

Please sign in to comment.