Skip to content
Snippets Groups Projects
Commit 4bcf3200 authored by Nick Draper's avatar Nick Draper
Browse files

clang format re #13867

parent 1b983211
No related branches found
No related tags found
No related merge requests found
...@@ -60,8 +60,7 @@ private: ...@@ -60,8 +60,7 @@ private:
void buildChildren(std::ostringstream &os, void buildChildren(std::ostringstream &os,
std::vector<HistoryItem>::const_iterator &iter, std::vector<HistoryItem>::const_iterator &iter,
int depth = 1); int depth = 1);
const std::string const std::string buildCommentString(AlgorithmHistory_const_sptr algHistory);
buildCommentString(AlgorithmHistory_const_sptr algHistory);
const std::string const std::string
buildAlgorithmString(AlgorithmHistory_const_sptr algHistory); buildAlgorithmString(AlgorithmHistory_const_sptr algHistory);
const std::string const std::string
...@@ -70,8 +69,6 @@ private: ...@@ -70,8 +69,6 @@ private:
const std::vector<HistoryItem> m_historyItems; const std::vector<HistoryItem> m_historyItems;
std::string m_output; std::string m_output;
std::string m_versionSpecificity; std::string m_versionSpecificity;
}; };
} // namespace API } // namespace API
......
...@@ -106,16 +106,14 @@ void ScriptBuilder::buildChildren( ...@@ -106,16 +106,14 @@ void ScriptBuilder::buildChildren(
* @param algHistory :: pointer to an algorithm history object * @param algHistory :: pointer to an algorithm history object
* @returns std::string to run this algorithm * @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; std::ostringstream comment;
const std::string name = algHistory->name(); const std::string name = algHistory->name();
if (name == COMMENT_ALG) if (name == COMMENT_ALG) {
{
auto props = algHistory->getProperties(); auto props = algHistory->getProperties();
for (auto propIter = props.begin(); propIter != props.end(); ++propIter) { for (auto propIter = props.begin(); propIter != props.end(); ++propIter) {
if ((*propIter)->name() == "Note") if ((*propIter)->name() == "Note") {
{
comment << "# " << (*propIter)->value(); comment << "# " << (*propIter)->value();
} }
} }
...@@ -123,12 +121,12 @@ const std::string ScriptBuilder::buildCommentString(AlgorithmHistory_const_sptr ...@@ -123,12 +121,12 @@ const std::string ScriptBuilder::buildCommentString(AlgorithmHistory_const_sptr
return comment.str(); return comment.str();
} }
/** /**
* Build the script output for a single algorithm * Build the script output for a single algorithm
* *
* @param algHistory :: pointer to an algorithm history object * @param algHistory :: pointer to an algorithm history object
* @returns std::string to run this algorithm * @returns std::string to run this algorithm
*/ */
const std::string const std::string
ScriptBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) { ScriptBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) {
std::ostringstream properties; std::ostringstream properties;
......
...@@ -31,9 +31,7 @@ const std::string Comment::name() const { return "Comment"; } ...@@ -31,9 +31,7 @@ const std::string Comment::name() const { return "Comment"; }
int Comment::version() const { return 1; } int Comment::version() const { return 1; }
/// Algorithm's category for identification. @see Algorithm::category /// Algorithm's category for identification. @see Algorithm::category
const std::string Comment::category() const { const std::string Comment::category() const { return "DataHandling"; }
return "DataHandling";
}
/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary /// Algorithm's summary for use in the GUI and help. @see Algorithm::summary
const std::string Comment::summary() const { const std::string Comment::summary() const {
...@@ -48,11 +46,12 @@ void Comment::init() { ...@@ -48,11 +46,12 @@ void Comment::init() {
new WorkspaceProperty<Workspace>("Workspace", "", Direction::InOut), new WorkspaceProperty<Workspace>("Workspace", "", Direction::InOut),
"An InOut workspace that will store the new history comment"); "An InOut workspace that will store the new history comment");
declareProperty( declareProperty("Text", "",
"Text", "", boost::make_shared<MandatoryValidator<std::string>>(), boost::make_shared<MandatoryValidator<std::string>>(),
"The text you want to store in the history of the workspace", Direction::Input); "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); enableHistoryRecordingForChild(true);
} }
...@@ -60,7 +59,7 @@ void Comment::init() { ...@@ -60,7 +59,7 @@ void Comment::init() {
/** Execute the algorithm. /** Execute the algorithm.
*/ */
void Comment::exec() { void Comment::exec() {
//do nothing // do nothing
} }
} // namespace Algorithms } // namespace Algorithms
......
...@@ -14,34 +14,30 @@ public: ...@@ -14,34 +14,30 @@ public:
// This pair of boilerplate methods prevent the suite being created statically // This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests // This means the constructor isn't called when running other tests
static CommentTest *createSuite() { return new CommentTest(); } 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; Mantid::Algorithms::Comment alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT( alg.isInitialized() ) TS_ASSERT(alg.isInitialized())
} }
void test_exec() void test_exec() {
{
std::string wsName = "CommentTest_Exec_workspace"; std::string wsName = "CommentTest_Exec_workspace";
// Create test input // Create test input
auto ws = WorkspaceCreationHelper::Create2DWorkspace(10, 10); auto ws = WorkspaceCreationHelper::Create2DWorkspace(10, 10);
AnalysisDataService::Instance().add(wsName,ws); AnalysisDataService::Instance().add(wsName, ws);
//and an identical ws for comparison later // and an identical ws for comparison later
auto ws2 = WorkspaceCreationHelper::Create2DWorkspace(10, 10); auto ws2 = WorkspaceCreationHelper::Create2DWorkspace(10, 10);
Mantid::Algorithms::Comment alg; Mantid::Algorithms::Comment alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() ) TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT( alg.isInitialized() ) TS_ASSERT(alg.isInitialized())
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Workspace", wsName) ); TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Workspace", wsName));
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Text", TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue(
"The next algorithm is doing ws equals 1/ws") ); "Text", "The next algorithm is doing ws equals 1/ws"));
TS_ASSERT_THROWS_NOTHING( alg.execute(); ); TS_ASSERT_THROWS_NOTHING(alg.execute(););
TS_ASSERT( alg.isExecuted() ); TS_ASSERT(alg.isExecuted());
// Retrieve the workspace from data service. // Retrieve the workspace from data service.
MatrixWorkspace_sptr outputWS; MatrixWorkspace_sptr outputWS;
...@@ -53,20 +49,16 @@ public: ...@@ -53,20 +49,16 @@ public:
return; return;
IAlgorithm_sptr lastAlgorithm = outputWS->getHistory().lastAlgorithm(); IAlgorithm_sptr lastAlgorithm = outputWS->getHistory().lastAlgorithm();
TS_ASSERT_EQUALS(lastAlgorithm->getPropertyValue("Workspace"), TS_ASSERT_EQUALS(lastAlgorithm->getPropertyValue("Workspace"),
alg.getPropertyValue("Workspace")); alg.getPropertyValue("Workspace"));
TS_ASSERT_EQUALS(lastAlgorithm->getPropertyValue("Text"), TS_ASSERT_EQUALS(lastAlgorithm->getPropertyValue("Text"),
alg.getPropertyValue("Text")); alg.getPropertyValue("Text"));
TSM_ASSERT("The workspace has been altered by Comment",Mantid::API::equals(ws, ws2)); TSM_ASSERT("The workspace has been altered by Comment",
Mantid::API::equals(ws, ws2));
AnalysisDataService::Instance().remove(wsName); AnalysisDataService::Instance().remove(wsName);
} }
}; };
#endif /* MANTID_ALGORITHMS_COMMENTTEST_H_ */ #endif /* MANTID_ALGORITHMS_COMMENTTEST_H_ */
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment