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
4a9ea9da
Commit
4a9ea9da
authored
11 years ago
by
Russell Taylor
Browse files
Options
Downloads
Patches
Plain Diff
Re #8669. Add a test for the creation of integer-typed logs.
parent
22dbb6e1
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
Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h
+11
-3
11 additions, 3 deletions
Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h
with
11 additions
and
3 deletions
Code/Mantid/Framework/Algorithms/test/AddSampleLogTest.h
+
11
−
3
View file @
4a9ea9da
...
...
@@ -42,6 +42,9 @@ public:
MatrixWorkspace_sptr
ws
=
WorkspaceCreationHelper
::
Create2DWorkspace
(
10
,
10
);
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number"
,
"1.234"
,
1.234
);
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number"
,
"2.456"
,
2.456
);
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number"
,
"-987654321"
,
-
987654321
);
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number"
,
"963"
,
963
);
}
void
test_BadNumber
()
...
...
@@ -62,10 +65,15 @@ public:
ws
->
mutableRun
().
setStartAndEndTime
(
DateAndTime
(
"2013-12-18T13:40:00"
),
DateAndTime
(
"2013-12-18T13:42:00"
));
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number Series"
,
"1.234"
,
1.234
);
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number Series"
,
"2.456"
,
2.456
);
ExecuteAlgorithm
(
ws
,
"My Name"
,
"Number Series"
,
"-1"
,
-
1
);
ExecuteAlgorithm
(
ws
,
"Another Name"
,
"Number Series"
,
"0"
,
0
);
ExecuteAlgorithm
(
ws
,
"Another Name"
,
"Number Series"
,
"123456789"
,
123456789
);
}
template
<
typename
T
>
void
ExecuteAlgorithm
(
MatrixWorkspace_sptr
testWS
,
std
::
string
LogName
,
std
::
string
LogType
,
std
::
string
LogText
,
double
expectedValue
,
bool
fails
=
false
)
T
expectedValue
,
bool
fails
=
false
)
{
//add the workspace to the ADS
AnalysisDataService
::
Instance
().
addOrReplace
(
"AddSampleLogTest_Temporary"
,
testWS
);
...
...
@@ -104,13 +112,13 @@ public:
}
else
if
(
LogType
==
"Number"
)
{
PropertyWithValue
<
double
>
*
testProp
=
dynamic_cast
<
PropertyWithValue
<
double
>*>
(
prop
);
auto
testProp
=
dynamic_cast
<
PropertyWithValue
<
T
>*>
(
prop
);
TS_ASSERT
(
testProp
);
TS_ASSERT_DELTA
((
*
testProp
)(),
expectedValue
,
1e-5
);
}
else
if
(
LogType
==
"Number Series"
)
{
TimeSeriesProperty
<
double
>
*
testProp
=
dynamic_cast
<
TimeSeriesProperty
<
double
>*>
(
prop
);
auto
testProp
=
dynamic_cast
<
TimeSeriesProperty
<
T
>*>
(
prop
);
TS_ASSERT
(
testProp
);
TS_ASSERT_EQUALS
(
testProp
->
firstTime
(),
DateAndTime
(
"2013-12-18T13:40:00"
));
TS_ASSERT_DELTA
(
testProp
->
firstValue
(),
expectedValue
,
1e-5
);
...
...
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