From 4bcf32001f8620b001f0a5bbc5db5772b425f99a Mon Sep 17 00:00:00 2001 From: Nick Draper <nick.draper@stfc.ac.uk> Date: Tue, 20 Oct 2015 15:57:41 +0100 Subject: [PATCH] clang format re #13867 --- Framework/API/inc/MantidAPI/ScriptBuilder.h | 5 +-- Framework/API/src/ScriptBuilder.cpp | 22 +++++----- Framework/Algorithms/src/Comment.cpp | 15 +++---- Framework/Algorithms/test/CommentTest.h | 48 +++++++++------------ 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/Framework/API/inc/MantidAPI/ScriptBuilder.h b/Framework/API/inc/MantidAPI/ScriptBuilder.h index 60c7e11efb5..8c7ac90e4e9 100644 --- a/Framework/API/inc/MantidAPI/ScriptBuilder.h +++ b/Framework/API/inc/MantidAPI/ScriptBuilder.h @@ -60,8 +60,7 @@ private: void buildChildren(std::ostringstream &os, std::vector<HistoryItem>::const_iterator &iter, int depth = 1); - const std::string - buildCommentString(AlgorithmHistory_const_sptr algHistory); + const std::string buildCommentString(AlgorithmHistory_const_sptr algHistory); const std::string buildAlgorithmString(AlgorithmHistory_const_sptr algHistory); const std::string @@ -70,8 +69,6 @@ private: const std::vector<HistoryItem> m_historyItems; std::string m_output; std::string m_versionSpecificity; - - }; } // namespace API diff --git a/Framework/API/src/ScriptBuilder.cpp b/Framework/API/src/ScriptBuilder.cpp index 422749fe8a7..29a142781b2 100644 --- a/Framework/API/src/ScriptBuilder.cpp +++ b/Framework/API/src/ScriptBuilder.cpp @@ -106,16 +106,14 @@ void ScriptBuilder::buildChildren( * @param algHistory :: pointer to an algorithm history object * @returns std::string to run this algorithm */ -const std::string ScriptBuilder::buildCommentString(AlgorithmHistory_const_sptr algHistory) -{ +const std::string +ScriptBuilder::buildCommentString(AlgorithmHistory_const_sptr algHistory) { std::ostringstream comment; const std::string name = algHistory->name(); - if (name == COMMENT_ALG) - { + if (name == COMMENT_ALG) { auto props = algHistory->getProperties(); for (auto propIter = props.begin(); propIter != props.end(); ++propIter) { - if ((*propIter)->name() == "Note") - { + if ((*propIter)->name() == "Note") { comment << "# " << (*propIter)->value(); } } @@ -123,12 +121,12 @@ const std::string ScriptBuilder::buildCommentString(AlgorithmHistory_const_sptr return comment.str(); } - /** - * Build the script output for a single algorithm - * - * @param algHistory :: pointer to an algorithm history object - * @returns std::string to run this algorithm - */ +/** +* Build the script output for a single algorithm +* +* @param algHistory :: pointer to an algorithm history object +* @returns std::string to run this algorithm +*/ const std::string ScriptBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) { std::ostringstream properties; diff --git a/Framework/Algorithms/src/Comment.cpp b/Framework/Algorithms/src/Comment.cpp index 8be4da8c2f8..d09c984008f 100644 --- a/Framework/Algorithms/src/Comment.cpp +++ b/Framework/Algorithms/src/Comment.cpp @@ -31,9 +31,7 @@ const std::string Comment::name() const { return "Comment"; } int Comment::version() const { return 1; } /// Algorithm's category for identification. @see Algorithm::category -const std::string Comment::category() const { - return "DataHandling"; -} +const std::string Comment::category() const { return "DataHandling"; } /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary const std::string Comment::summary() const { @@ -48,11 +46,12 @@ void Comment::init() { new WorkspaceProperty<Workspace>("Workspace", "", Direction::InOut), "An InOut workspace that will store the new history comment"); - declareProperty( - "Text", "", boost::make_shared<MandatoryValidator<std::string>>(), - "The text you want to store in the history of the workspace", Direction::Input); + declareProperty("Text", "", + boost::make_shared<MandatoryValidator<std::string>>(), + "The text you want to store in the history of the workspace", + Direction::Input); - //always record history for this algorithm + // always record history for this algorithm enableHistoryRecordingForChild(true); } @@ -60,7 +59,7 @@ void Comment::init() { /** Execute the algorithm. */ void Comment::exec() { - //do nothing + // do nothing } } // namespace Algorithms diff --git a/Framework/Algorithms/test/CommentTest.h b/Framework/Algorithms/test/CommentTest.h index 091fbe088d3..22c846ada84 100644 --- a/Framework/Algorithms/test/CommentTest.h +++ b/Framework/Algorithms/test/CommentTest.h @@ -14,34 +14,30 @@ public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests static CommentTest *createSuite() { return new CommentTest(); } - static void destroySuite( CommentTest *suite ) { delete suite; } + static void destroySuite(CommentTest *suite) { delete suite; } - - void test_Init() - { + void test_Init() { Mantid::Algorithms::Comment alg; - TS_ASSERT_THROWS_NOTHING( alg.initialize() ) - TS_ASSERT( alg.isInitialized() ) + TS_ASSERT_THROWS_NOTHING(alg.initialize()) + TS_ASSERT(alg.isInitialized()) } - void test_exec() - { + void test_exec() { std::string wsName = "CommentTest_Exec_workspace"; // Create test input auto ws = WorkspaceCreationHelper::Create2DWorkspace(10, 10); - AnalysisDataService::Instance().add(wsName,ws); - //and an identical ws for comparison later + AnalysisDataService::Instance().add(wsName, ws); + // and an identical ws for comparison later auto ws2 = WorkspaceCreationHelper::Create2DWorkspace(10, 10); Mantid::Algorithms::Comment alg; - TS_ASSERT_THROWS_NOTHING( alg.initialize() ) - TS_ASSERT( alg.isInitialized() ) - TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Workspace", wsName) ); - TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Text", - "The next algorithm is doing ws equals 1/ws") ); - TS_ASSERT_THROWS_NOTHING( alg.execute(); ); - TS_ASSERT( alg.isExecuted() ); - + TS_ASSERT_THROWS_NOTHING(alg.initialize()) + TS_ASSERT(alg.isInitialized()) + TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Workspace", wsName)); + TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue( + "Text", "The next algorithm is doing ws equals 1/ws")); + TS_ASSERT_THROWS_NOTHING(alg.execute();); + TS_ASSERT(alg.isExecuted()); // Retrieve the workspace from data service. MatrixWorkspace_sptr outputWS; @@ -53,20 +49,16 @@ public: return; IAlgorithm_sptr lastAlgorithm = outputWS->getHistory().lastAlgorithm(); - + TS_ASSERT_EQUALS(lastAlgorithm->getPropertyValue("Workspace"), - alg.getPropertyValue("Workspace")); + alg.getPropertyValue("Workspace")); TS_ASSERT_EQUALS(lastAlgorithm->getPropertyValue("Text"), - alg.getPropertyValue("Text")); - TSM_ASSERT("The workspace has been altered by Comment",Mantid::API::equals(ws, ws2)); - + alg.getPropertyValue("Text")); + TSM_ASSERT("The workspace has been altered by Comment", + Mantid::API::equals(ws, ws2)); + AnalysisDataService::Instance().remove(wsName); } - - - - }; - #endif /* MANTID_ALGORITHMS_COMMENTTEST_H_ */ \ No newline at end of file -- GitLab