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
d5bf805e
Commit
d5bf805e
authored
4 years ago
by
Zhang, Chen
Browse files
Options
Downloads
Patches
Plain Diff
add new unit test for sort LeanElasticPWS
parent
7dd4e753
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/Crystal/test/SortPeaksWorkspaceTest.h
+31
-0
31 additions, 0 deletions
Framework/Crystal/test/SortPeaksWorkspaceTest.h
with
31 additions
and
0 deletions
Framework/Crystal/test/SortPeaksWorkspaceTest.h
+
31
−
0
View file @
d5bf805e
...
...
@@ -8,6 +8,7 @@
#include
"MantidAPI/TableRow.h"
#include
"MantidCrystal/SortPeaksWorkspace.h"
#include
"MantidDataObjects/LeanElasticPeaksWorkspace.h"
#include
"MantidDataObjects/PeaksWorkspace.h"
#include
"MantidTestHelpers/WorkspaceCreationHelper.h"
#include
<algorithm>
...
...
@@ -209,4 +210,34 @@ public:
"workspaces should be the same."
,
outWS
,
inWS
);
}
void
test_leanPeakWorkspace_sort_inplace
()
{
// generate a lean elastic peak workspace with two peaks
auto
lpws
=
std
::
make_shared
<
LeanElasticPeaksWorkspace
>
();
// add peaks
LeanElasticPeak
pk1
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
6.28319
),
2.0
);
LeanElasticPeak
pk2
(
Mantid
::
Kernel
::
V3D
(
6.28319
,
0.0
,
6.28319
),
1.0
);
lpws
->
addPeak
(
pk1
);
lpws
->
addPeak
(
pk2
);
IPeaksWorkspace_sptr
inWS
=
std
::
dynamic_pointer_cast
<
IPeaksWorkspace
>
(
lpws
);
SortPeaksWorkspace
alg
;
alg
.
setChild
(
true
);
alg
.
setRethrows
(
true
);
TS_ASSERT_THROWS_NOTHING
(
alg
.
initialize
())
TS_ASSERT
(
alg
.
isInitialized
())
TS_ASSERT_THROWS_NOTHING
(
alg
.
setProperty
(
"InputWorkspace"
,
inWS
));
alg
.
setPropertyValue
(
"OutputWorkspace"
,
"OutName"
);
TS_ASSERT_THROWS_NOTHING
(
alg
.
setProperty
(
"OutputWorkspace"
,
inWS
));
TS_ASSERT_THROWS_NOTHING
(
alg
.
setPropertyValue
(
"ColumnNameToSortBy"
,
"h"
));
TS_ASSERT_THROWS_NOTHING
(
alg
.
execute
());
TS_ASSERT
(
alg
.
isExecuted
());
IPeaksWorkspace_sptr
outWS
=
alg
.
getProperty
(
"OutputWorkspace"
);
TSM_ASSERT_EQUALS
(
"Sorting should have happened in place. Output and input "
"workspaces should be the same."
,
outWS
,
inWS
);
}
};
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