Skip to content

Commit

Permalink
Refs #8958 Unit test now checks for special values
Browse files Browse the repository at this point in the history
The unit test now looks for a NAN or INF in one of the tests. This means that the test will still pass if a platform outputs a different special value for divide by zero, as by all rights both NAN and INF are both valid results.
  • Loading branch information
keithnbrown committed Feb 18, 2014
1 parent 94bd6e9 commit e3b112c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Code/Mantid/Framework/DataHandling/test/SaveANSTOAsciiTest.h
Expand Up @@ -97,7 +97,7 @@ class SaveANSTOAsciiTest : public CxxTest::TestSuite
TS_ASSERT_DELTA(boost::lexical_cast<double>(columns.at(0)), 0, 0.01);
TS_ASSERT_DELTA(boost::lexical_cast<double>(columns.at(1)), 1, 0.01);
TS_ASSERT_DELTA(boost::lexical_cast<double>(columns.at(2)), 1, 0.01);
//TS_ASSERT_DELTA(boost::lexical_cast<double>(columns.at(3)), -1, 0.01);
TS_ASSERT((columns.at(3) == "nan") || (columns.at(3) == "inf"));
in.close();

cleanupafterwards();
Expand Down Expand Up @@ -183,6 +183,7 @@ class SaveANSTOAsciiTest : public CxxTest::TestSuite
{
MatrixWorkspace_sptr ws = WorkspaceCreationHelper::Create2DWorkspace(1,10);
AnalysisDataService::Instance().addOrReplace(m_name, ws);
//Check if any of X, Y or E should be zeroed to check for divide by zero or similiar
if (zeroX)
{
ws->dataX(0) = m_data0;
Expand All @@ -191,6 +192,7 @@ class SaveANSTOAsciiTest : public CxxTest::TestSuite
{
ws->dataX(0) = m_dataX;
}

if (zeroY)
{
ws->dataY(0) = m_data0;
Expand All @@ -199,6 +201,7 @@ class SaveANSTOAsciiTest : public CxxTest::TestSuite
{
ws->dataY(0) = m_dataY;
}

if (zeroE)
{
ws->dataE(0) = m_data0;
Expand Down

0 comments on commit e3b112c

Please sign in to comment.