Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
f17c7be8
Commit
f17c7be8
authored
6 years ago
by
David Fairbrother
Browse files
Options
Downloads
Patches
Plain Diff
Re #22898 Clang formatting
parent
de9c50d4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/API/src/ScriptBuilder.cpp
+2
-2
2 additions, 2 deletions
Framework/API/src/ScriptBuilder.cpp
Framework/API/test/ScriptBuilderTest.h
+63
-63
63 additions, 63 deletions
Framework/API/test/ScriptBuilderTest.h
with
65 additions
and
65 deletions
Framework/API/src/ScriptBuilder.cpp
+
2
−
2
View file @
f17c7be8
...
@@ -222,8 +222,8 @@ ScriptBuilder::buildAlgorithmString(const AlgorithmHistory &algHistory) {
...
@@ -222,8 +222,8 @@ ScriptBuilder::buildAlgorithmString(const AlgorithmHistory &algHistory) {
}
}
std
::
string
historyEntry
=
name
+
"("
+
propStr
+
")"
;
std
::
string
historyEntry
=
name
+
"("
+
propStr
+
")"
;
historyEntry
.
erase
(
historyEntry
.
erase
(
boost
::
remove_if
(
historyEntry
,
boost
::
is_any_of
(
"
\n\r
"
)),
boost
::
remove_if
(
historyEntry
,
boost
::
is_any_of
(
"
\n\r
"
)),
historyEntry
.
end
());
historyEntry
.
end
());
return
historyEntry
;
return
historyEntry
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Framework/API/test/ScriptBuilderTest.h
+
63
−
63
View file @
f17c7be8
...
@@ -85,37 +85,36 @@ class ScriptBuilderTest : public CxxTest::TestSuite {
...
@@ -85,37 +85,36 @@ class ScriptBuilderTest : public CxxTest::TestSuite {
}
}
};
};
class
NewlineAlgorithm
:
public
Algorithm
{
class
NewlineAlgorithm
:
public
Algorithm
{
public:
public:
NewlineAlgorithm
()
:
Algorithm
()
{}
NewlineAlgorithm
()
:
Algorithm
()
{}
~
NewlineAlgorithm
()
override
{}
~
NewlineAlgorithm
()
override
{}
const
std
::
string
name
()
const
override
{
return
"Foo
\n\r
Bar"
;
}
const
std
::
string
name
()
const
override
{
return
"Foo
\n\r
Bar"
;
}
const
std
::
string
summary
()
const
override
{
return
"Test"
;
}
const
std
::
string
summary
()
const
override
{
return
"Test"
;
}
int
version
()
const
override
{
return
1
;
}
int
version
()
const
override
{
return
1
;
}
const
std
::
string
category
()
const
override
{
return
"Cat;Leopard;Mink"
;
}
const
std
::
string
category
()
const
override
{
return
"Cat;Leopard;Mink"
;
}
void
afterPropertySet
(
const
std
::
string
&
name
)
override
{
void
afterPropertySet
(
const
std
::
string
&
name
)
override
{
if
(
name
==
"InputWorkspace"
)
if
(
name
==
"InputWorkspace"
)
declareProperty
(
"DynamicInputProperty"
,
""
);
declareProperty
(
"DynamicInputProperty"
,
""
);
}
}
void
init
()
override
{
void
init
()
override
{
declareProperty
(
make_unique
<
WorkspaceProperty
<
MatrixWorkspace
>>
(
declareProperty
(
make_unique
<
WorkspaceProperty
<
MatrixWorkspace
>>
(
"InputWorkspace"
,
""
,
Direction
::
Input
));
"InputWorkspace"
,
""
,
Direction
::
Input
));
declareProperty
(
make_unique
<
WorkspaceProperty
<
MatrixWorkspace
>>
(
declareProperty
(
make_unique
<
WorkspaceProperty
<
MatrixWorkspace
>>
(
"OutputWorkspace"
,
""
,
Direction
::
Output
));
"OutputWorkspace"
,
""
,
Direction
::
Output
));
declareProperty
(
"PropertyA"
,
"Hello"
);
declareProperty
(
"PropertyA"
,
"Hello"
);
declareProperty
(
"PropertyB"
,
"World"
);
declareProperty
(
"PropertyB"
,
"World"
);
}
}
void
exec
()
override
{
void
exec
()
override
{
declareProperty
(
"DynamicProperty1"
,
"value"
,
Direction
::
Output
);
declareProperty
(
"DynamicProperty1"
,
"value"
,
Direction
::
Output
);
setPropertyValue
(
"DynamicProperty1"
,
"outputValue"
);
setPropertyValue
(
"DynamicProperty1"
,
"outputValue"
);
boost
::
shared_ptr
<
MatrixWorkspace
>
output
=
boost
::
shared_ptr
<
MatrixWorkspace
>
output
=
boost
::
make_shared
<
WorkspaceTester
>
();
boost
::
make_shared
<
WorkspaceTester
>
();
setProperty
(
"OutputWorkspace"
,
output
);
setProperty
(
"OutputWorkspace"
,
output
);
}
}
};
};
// middle layer algorithm executed by a top level algorithm
// middle layer algorithm executed by a top level algorithm
...
@@ -238,7 +237,7 @@ public:
...
@@ -238,7 +237,7 @@ public:
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
NestedAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
NestedAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
BasicAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
BasicAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
SubAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
SubAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
NewlineAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
subscribe
<
NewlineAlgorithm
>
();
Mantid
::
API
::
AlgorithmFactory
::
Instance
()
Mantid
::
API
::
AlgorithmFactory
::
Instance
()
.
subscribe
<
AlgorithmWithDynamicProperty
>
();
.
subscribe
<
AlgorithmWithDynamicProperty
>
();
}
}
...
@@ -251,7 +250,7 @@ public:
...
@@ -251,7 +250,7 @@ public:
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
unsubscribe
(
"SubAlgorithm"
,
1
);
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
unsubscribe
(
"SubAlgorithm"
,
1
);
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
unsubscribe
(
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
unsubscribe
(
"AlgorithmWithDynamicProperty"
,
1
);
"AlgorithmWithDynamicProperty"
,
1
);
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
unsubscribe
(
"Foo
\n\r
Bar"
,
1
);
Mantid
::
API
::
AlgorithmFactory
::
Instance
().
unsubscribe
(
"Foo
\n\r
Bar"
,
1
);
}
}
void
test_Build_Simple
()
{
void
test_Build_Simple
()
{
...
@@ -290,38 +289,39 @@ public:
...
@@ -290,38 +289,39 @@ public:
}
}
void
test_newline_chars_removed
()
{
void
test_newline_chars_removed
()
{
// Check that any newline chars are removed
// Check that any newline chars are removed
std
::
string
result
[]
=
{
"FooBar(InputWorkspace='test_input_workspace',"
std
::
string
result
[]
=
{
"FooBar(InputWorkspace='test_input_workspace',"
" OutputWorkspace='test_output_workspace')"
,
""
};
" OutputWorkspace='test_output_workspace')"
,
""
};
boost
::
shared_ptr
<
WorkspaceTester
>
input
=
boost
::
make_shared
<
WorkspaceTester
>
();
boost
::
shared_ptr
<
WorkspaceTester
>
input
=
AnalysisDataService
::
Instance
().
addOrReplace
(
"test_input_workspace"
,
input
);
boost
::
make_shared
<
WorkspaceTester
>
();
AnalysisDataService
::
Instance
().
addOrReplace
(
"test_input_workspace"
,
input
);
auto
alg
=
AlgorithmFactory
::
Instance
().
create
(
"Foo
\n\r
Bar"
,
1
);
alg
->
initialize
();
auto
alg
=
AlgorithmFactory
::
Instance
().
create
(
"Foo
\n\r
Bar"
,
1
);
alg
->
setRethrows
(
true
);
alg
->
initialize
();
alg
->
setProperty
(
"InputWorkspace"
,
input
);
alg
->
setRethrows
(
true
);
alg
->
setPropertyValue
(
"OutputWorkspace"
,
"test_output_workspace"
);
alg
->
setProperty
(
"InputWorkspace"
,
input
);
alg
->
execute
();
alg
->
setPropertyValue
(
"OutputWorkspace"
,
"test_output_workspace"
);
alg
->
execute
();
auto
ws
=
AnalysisDataService
::
Instance
().
retrieveWS
<
MatrixWorkspace
>
(
"test_output_workspace"
);
auto
ws
=
AnalysisDataService
::
Instance
().
retrieveWS
<
MatrixWorkspace
>
(
auto
wsHist
=
ws
->
getHistory
();
"test_output_workspace"
);
auto
wsHist
=
ws
->
getHistory
();
ScriptBuilder
builder
(
wsHist
.
createView
());
std
::
string
scriptText
=
builder
.
build
();
ScriptBuilder
builder
(
wsHist
.
createView
());
std
::
string
scriptText
=
builder
.
build
();
std
::
vector
<
std
::
string
>
scriptLines
;
boost
::
split
(
scriptLines
,
scriptText
,
boost
::
is_any_of
(
"
\n
"
));
std
::
vector
<
std
::
string
>
scriptLines
;
boost
::
split
(
scriptLines
,
scriptText
,
boost
::
is_any_of
(
"
\n
"
));
int
i
=
0
;
for
(
auto
it
=
scriptLines
.
begin
();
it
!=
scriptLines
.
end
();
++
it
,
++
i
)
{
int
i
=
0
;
TS_ASSERT_EQUALS
(
*
it
,
result
[
i
])
for
(
auto
it
=
scriptLines
.
begin
();
it
!=
scriptLines
.
end
();
++
it
,
++
i
)
{
}
TS_ASSERT_EQUALS
(
*
it
,
result
[
i
])
}
AnalysisDataService
::
Instance
().
remove
(
"test_output_workspace"
);
AnalysisDataService
::
Instance
().
remove
(
"test_input_workspace"
);
AnalysisDataService
::
Instance
().
remove
(
"test_output_workspace"
);
AnalysisDataService
::
Instance
().
remove
(
"test_input_workspace"
);
}
}
void
test_Build_Simple_Timestamped
()
{
void
test_Build_Simple_Timestamped
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment