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
cf751ea5
Commit
cf751ea5
authored
8 years ago
by
Gemma Guest
Browse files
Options
Downloads
Patches
Plain Diff
Re #18215 Remove duplication
parent
6c9e8126
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/Algorithms/test/UnwrapMonitorTest.h
+31
-57
31 additions, 57 deletions
Framework/Algorithms/test/UnwrapMonitorTest.h
with
31 additions
and
57 deletions
Framework/Algorithms/test/UnwrapMonitorTest.h
+
31
−
57
View file @
cf751ea5
...
@@ -35,6 +35,22 @@ private:
...
@@ -35,6 +35,22 @@ private:
algo
.
setProperty
(
"LRef"
,
lref
);
algo
.
setProperty
(
"LRef"
,
lref
);
}
}
// Run the algorithm and do some basic checks. Returns the output workspace.
MatrixWorkspace_const_sptr
runAlgorithm
(
UnwrapMonitor
&
algo
,
const
MatrixWorkspace_sptr
inWS
)
{
// run the algorithm
TS_ASSERT
(
algo
.
execute
());
TS_ASSERT
(
algo
.
isExecuted
());
// verify the output workspace
const
MatrixWorkspace_const_sptr
outWS
=
algo
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT_EQUALS
(
inWS
->
getNumberHistograms
(),
outWS
->
getNumberHistograms
());
// shouldn't drop histograms
return
outWS
;
}
public
:
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
...
@@ -42,28 +58,18 @@ public:
...
@@ -42,28 +58,18 @@ public:
static
void
destroySuite
(
UnwrapMonitorTest
*
suite
)
{
delete
suite
;
}
static
void
destroySuite
(
UnwrapMonitorTest
*
suite
)
{
delete
suite
;
}
void
testLrefLessThanLd
()
{
void
testLrefLessThanLd
()
{
// setup
// setup
and run the algorithm (includes basic checks)
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
UnwrapMonitor
algo
;
UnwrapMonitor
algo
;
setupAlgorithm
(
algo
,
inWS
,
11.0
);
setupAlgorithm
(
algo
,
inWS
,
11.0
);
MatrixWorkspace_const_sptr
outWS
=
runAlgorithm
(
algo
,
inWS
);
// run the algorithm
// specific checks
TS_ASSERT
(
algo
.
execute
());
TS_ASSERT
(
algo
.
isExecuted
());
// verify the output workspace
const
MatrixWorkspace_const_sptr
outWS
=
algo
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT_EQUALS
(
inWS
->
getNumberHistograms
(),
outWS
->
getNumberHistograms
());
// shouldn't drop histograms
// Check some x values
const
Mantid
::
MantidVec
outX
=
outWS
->
readX
(
0
);
const
Mantid
::
MantidVec
outX
=
outWS
->
readX
(
0
);
TS_ASSERT_EQUALS
(
outX
.
size
(),
23
);
TS_ASSERT_EQUALS
(
outX
.
size
(),
23
);
TS_ASSERT_DELTA
(
outX
.
front
(),
0.0
,
1e-6
);
TS_ASSERT_DELTA
(
outX
.
front
(),
0.0
,
1e-6
);
TS_ASSERT_DELTA
(
outX
.
back
(),
0.017982
,
1e-6
);
TS_ASSERT_DELTA
(
outX
.
back
(),
0.017982
,
1e-6
);
// Check some y values
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
22
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
22
);
TS_ASSERT_DELTA
(
outY
[
3
],
0.0
,
1e-6
);
TS_ASSERT_DELTA
(
outY
[
3
],
0.0
,
1e-6
);
...
@@ -77,21 +83,13 @@ public:
...
@@ -77,21 +83,13 @@ public:
}
}
void
testLrefGreaterThanLd
()
{
void
testLrefGreaterThanLd
()
{
// setup
// setup
and run the algorithm (includes basic checks)
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
UnwrapMonitor
algo
;
UnwrapMonitor
algo
;
setupAlgorithm
(
algo
,
inWS
,
17.0
);
setupAlgorithm
(
algo
,
inWS
,
17.0
);
const
MatrixWorkspace_const_sptr
outWS
=
runAlgorithm
(
algo
,
inWS
);
// run the algorithm
// specific checks
TS_ASSERT
(
algo
.
execute
());
TS_ASSERT
(
algo
.
isExecuted
());
// verify the output workspace
const
MatrixWorkspace_const_sptr
outWS
=
algo
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT_EQUALS
(
inWS
->
getNumberHistograms
(),
outWS
->
getNumberHistograms
());
// shouldn't drop histograms
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
44
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
44
);
...
@@ -100,21 +98,13 @@ public:
...
@@ -100,21 +98,13 @@ public:
}
}
void
testLrefEqualsLd
()
{
void
testLrefEqualsLd
()
{
// setup
// setup
and run the algorithm (includes basic checks)
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
UnwrapMonitor
algo
;
UnwrapMonitor
algo
;
setupAlgorithm
(
algo
,
inWS
,
15.0
);
setupAlgorithm
(
algo
,
inWS
,
15.0
);
const
MatrixWorkspace_const_sptr
outWS
=
runAlgorithm
(
algo
,
inWS
);
// run the algorithm
// specific checks
TS_ASSERT
(
algo
.
execute
());
TS_ASSERT
(
algo
.
isExecuted
());
// verify the output workspace
const
MatrixWorkspace_const_sptr
outWS
=
algo
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT_EQUALS
(
inWS
->
getNumberHistograms
(),
outWS
->
getNumberHistograms
());
// shouldn't drop histograms
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
49
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
49
);
...
@@ -123,21 +113,13 @@ public:
...
@@ -123,21 +113,13 @@ public:
}
}
void
testMinPossibleLref
()
{
void
testMinPossibleLref
()
{
// setup
// setup
and run the algorithm (includes basic checks)
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
UnwrapMonitor
algo
;
UnwrapMonitor
algo
;
setupAlgorithm
(
algo
,
inWS
,
0.01
);
setupAlgorithm
(
algo
,
inWS
,
0.01
);
const
MatrixWorkspace_const_sptr
outWS
=
runAlgorithm
(
algo
,
inWS
);
// run the algorithm
// specific checks
TS_ASSERT
(
algo
.
execute
());
TS_ASSERT
(
algo
.
isExecuted
());
// verify the output workspace
const
MatrixWorkspace_const_sptr
outWS
=
algo
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT_EQUALS
(
inWS
->
getNumberHistograms
(),
outWS
->
getNumberHistograms
());
// shouldn't drop histograms
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
50
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
50
);
TS_ASSERT_DELTA
(
outY
[
0
],
100.0
,
1e-6
);
TS_ASSERT_DELTA
(
outY
[
0
],
100.0
,
1e-6
);
...
@@ -148,21 +130,13 @@ public:
...
@@ -148,21 +130,13 @@ public:
}
}
void
testLargeLref
()
{
void
testLargeLref
()
{
// setup
// setup
and run the algorithm (includes basic checks)
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
const
MatrixWorkspace_sptr
inWS
=
this
->
makeFakeWorkspace
();
UnwrapMonitor
algo
;
UnwrapMonitor
algo
;
setupAlgorithm
(
algo
,
inWS
,
100.0
);
setupAlgorithm
(
algo
,
inWS
,
100.0
);
const
MatrixWorkspace_const_sptr
outWS
=
runAlgorithm
(
algo
,
inWS
);
// run the algorithm
// specific checks
TS_ASSERT
(
algo
.
execute
());
TS_ASSERT
(
algo
.
isExecuted
());
// verify the output workspace
const
MatrixWorkspace_const_sptr
outWS
=
algo
.
getProperty
(
"OutputWorkspace"
);
TS_ASSERT_EQUALS
(
inWS
->
getNumberHistograms
(),
outWS
->
getNumberHistograms
());
// shouldn't drop histograms
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
const
Mantid
::
MantidVec
outY
=
outWS
->
readY
(
0
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
10
);
TS_ASSERT_EQUALS
(
outY
.
size
(),
10
);
...
...
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