From 4a9ea9da4a1f218b8a3d71c2714b8ad2f91720e7 Mon Sep 17 00:00:00 2001 From: Russell Taylor Date: Fri, 3 Jan 2014 17:01:26 -0500 Subject: [PATCH] Re #8669. Add a test for the creation of integer-typed logs. --- .../Framework/Algorithms/test/AddSampleLogTest.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h b/Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h index ab75cc486402..59b1298df8a2 100644 --- a/Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h +++ b/Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h @@ -42,6 +42,9 @@ class AddSampleLogTest : public CxxTest::TestSuite MatrixWorkspace_sptr ws = WorkspaceCreationHelper::Create2DWorkspace(10,10); ExecuteAlgorithm(ws, "My Name", "Number", "1.234", 1.234); ExecuteAlgorithm(ws, "My Name", "Number", "2.456", 2.456); + + ExecuteAlgorithm(ws, "My Name", "Number", "-987654321", -987654321); + ExecuteAlgorithm(ws, "My Name", "Number", "963", 963); } void test_BadNumber() @@ -62,10 +65,15 @@ class AddSampleLogTest : public CxxTest::TestSuite ws->mutableRun().setStartAndEndTime(DateAndTime("2013-12-18T13:40:00"),DateAndTime("2013-12-18T13:42:00")); ExecuteAlgorithm(ws, "My Name", "Number Series", "1.234", 1.234); ExecuteAlgorithm(ws, "My Name", "Number Series", "2.456", 2.456); + + ExecuteAlgorithm(ws, "My Name", "Number Series", "-1", -1); + ExecuteAlgorithm(ws, "Another Name", "Number Series", "0", 0); + ExecuteAlgorithm(ws, "Another Name", "Number Series", "123456789", 123456789); } + template void ExecuteAlgorithm(MatrixWorkspace_sptr testWS, std::string LogName, std::string LogType, std::string LogText, - double expectedValue, bool fails=false) + T expectedValue, bool fails=false) { //add the workspace to the ADS AnalysisDataService::Instance().addOrReplace("AddSampleLogTest_Temporary", testWS); @@ -104,13 +112,13 @@ class AddSampleLogTest : public CxxTest::TestSuite } else if (LogType == "Number") { - PropertyWithValue *testProp = dynamic_cast*>(prop); + auto testProp = dynamic_cast*>(prop); TS_ASSERT(testProp); TS_ASSERT_DELTA((*testProp)(), expectedValue, 1e-5); } else if (LogType == "Number Series") { - TimeSeriesProperty *testProp = dynamic_cast*>(prop); + auto testProp = dynamic_cast*>(prop); TS_ASSERT(testProp); TS_ASSERT_EQUALS(testProp->firstTime(),DateAndTime("2013-12-18T13:40:00")); TS_ASSERT_DELTA(testProp->firstValue(), expectedValue, 1e-5);