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
9f464c2c
Commit
9f464c2c
authored
5 years ago
by
Nick Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add in testing of Result and Exectution states
parent
1d30456c
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/test/AlgorithmProxyTest.h
+2
-0
2 additions, 0 deletions
Framework/API/test/AlgorithmProxyTest.h
Framework/API/test/AlgorithmTest.h
+9
-0
9 additions, 0 deletions
Framework/API/test/AlgorithmTest.h
with
11 additions
and
0 deletions
Framework/API/test/AlgorithmProxyTest.h
+
2
−
0
View file @
9f464c2c
...
@@ -152,6 +152,8 @@ public:
...
@@ -152,6 +152,8 @@ public:
alg
->
setProperty
(
"prop2"
,
17
);
alg
->
setProperty
(
"prop2"
,
17
);
TS_ASSERT_THROWS_NOTHING
(
alg
->
execute
());
TS_ASSERT_THROWS_NOTHING
(
alg
->
execute
());
TS_ASSERT
(
alg
->
isExecuted
());
TS_ASSERT
(
alg
->
isExecuted
());
TS_ASSERT_EQUALS
(
ExecutionState
::
Finished
,
alg
->
executionState
());
TS_ASSERT_EQUALS
(
ResultState
::
Success
,
alg
->
resultState
());
int
out
=
alg
->
getProperty
(
"out"
);
int
out
=
alg
->
getProperty
(
"out"
);
TS_ASSERT_EQUALS
(
out
,
28
);
TS_ASSERT_EQUALS
(
out
,
28
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Framework/API/test/AlgorithmTest.h
+
9
−
0
View file @
9f464c2c
...
@@ -291,11 +291,16 @@ public:
...
@@ -291,11 +291,16 @@ public:
void
testExecute
()
{
void
testExecute
()
{
ToyAlgorithm
myAlg
;
ToyAlgorithm
myAlg
;
TS_ASSERT_EQUALS
(
ExecutionState
::
Uninitialized
,
myAlg
.
executionState
());
TS_ASSERT_THROWS
(
myAlg
.
execute
(),
const
std
::
runtime_error
&
);
TS_ASSERT_THROWS
(
myAlg
.
execute
(),
const
std
::
runtime_error
&
);
TS_ASSERT
(
!
myAlg
.
isExecuted
());
TS_ASSERT
(
!
myAlg
.
isExecuted
());
TS_ASSERT_EQUALS
(
ExecutionState
::
Uninitialized
,
myAlg
.
executionState
());
TS_ASSERT_THROWS_NOTHING
(
myAlg
.
initialize
());
TS_ASSERT_THROWS_NOTHING
(
myAlg
.
initialize
());
TS_ASSERT_EQUALS
(
ExecutionState
::
Initialized
,
myAlg
.
executionState
());
TS_ASSERT_THROWS_NOTHING
(
myAlg
.
execute
());
TS_ASSERT_THROWS_NOTHING
(
myAlg
.
execute
());
TS_ASSERT
(
myAlg
.
isExecuted
());
TS_ASSERT
(
myAlg
.
isExecuted
());
TS_ASSERT_EQUALS
(
ExecutionState
::
Finished
,
myAlg
.
executionState
());
TS_ASSERT_EQUALS
(
ResultState
::
Success
,
myAlg
.
resultState
());
}
}
void
testSetPropertyValue
()
{
void
testSetPropertyValue
()
{
...
@@ -333,10 +338,14 @@ public:
...
@@ -333,10 +338,14 @@ public:
alg
.
setProperty
(
"PropertyB"
,
5
);
alg
.
setProperty
(
"PropertyB"
,
5
);
TS_ASSERT_THROWS_ANYTHING
(
alg
.
execute
());
TS_ASSERT_THROWS_ANYTHING
(
alg
.
execute
());
TS_ASSERT
(
!
alg
.
isExecuted
());
TS_ASSERT
(
!
alg
.
isExecuted
());
TS_ASSERT_EQUALS
(
ExecutionState
::
Finished
,
alg
.
executionState
());
TS_ASSERT_EQUALS
(
ResultState
::
Failed
,
alg
.
resultState
());
alg
.
setProperty
(
"PropertyB"
,
15
);
alg
.
setProperty
(
"PropertyB"
,
15
);
TS_ASSERT_THROWS_NOTHING
(
alg
.
execute
());
TS_ASSERT_THROWS_NOTHING
(
alg
.
execute
());
TS_ASSERT
(
alg
.
isExecuted
());
TS_ASSERT
(
alg
.
isExecuted
());
TS_ASSERT_EQUALS
(
ExecutionState
::
Finished
,
alg
.
executionState
());
TS_ASSERT_EQUALS
(
ResultState
::
Success
,
alg
.
resultState
());
}
}
void
test_WorkspaceMethodFunctionsReturnEmptyByDefault
()
{
void
test_WorkspaceMethodFunctionsReturnEmptyByDefault
()
{
...
...
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