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
935783b1
Commit
935783b1
authored
14 years ago
by
Janik Zikovsky
Browse files
Options
Downloads
Patches
Plain Diff
Refs #2269: More robust file handling in test.
parent
5763dc92
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/Framework/Nexus/test/LoadNexusProcessedTest.h
+4
-7
4 additions, 7 deletions
Code/Mantid/Framework/Nexus/test/LoadNexusProcessedTest.h
Code/Mantid/Framework/Nexus/test/SaveNexusProcessedTest.h
+10
-6
10 additions, 6 deletions
Code/Mantid/Framework/Nexus/test/SaveNexusProcessedTest.h
with
14 additions
and
13 deletions
Code/Mantid/Framework/Nexus/test/LoadNexusProcessedTest.h
+
4
−
7
View file @
935783b1
...
...
@@ -363,16 +363,13 @@ public:
std
::
string
filename_root
=
"LoadNexusProcessed_ExecEvent_"
;
// Call a function that writes out the file
EventWorkspace_sptr
origWS
=
SaveNexusProcessedTest
::
do_testExec_EventWorkspaces
(
filename_root
,
type
,
false
,
false
);
std
::
string
outputFile
;
EventWorkspace_sptr
origWS
=
SaveNexusProcessedTest
::
do_testExec_EventWorkspaces
(
filename_root
,
type
,
outputFile
,
false
,
false
);
LoadNexusProcessed
alg
;
TS_ASSERT_THROWS_NOTHING
(
alg
.
initialize
());
TS_ASSERT
(
alg
.
isInitialized
()
);
std
::
ostringstream
filename
;
filename
<<
filename_root
<<
static_cast
<
int
>
(
type
)
<<
".nxs"
;
testFile
=
filename
.
str
();
alg
.
setPropertyValue
(
"Filename"
,
testFile
);
std
::
string
outputFile
=
alg
.
getPropertyValue
(
"Filename"
);
alg
.
setPropertyValue
(
"Filename"
,
outputFile
);
alg
.
setPropertyValue
(
"OutputWorkspace"
,
output_ws
);
TS_ASSERT_THROWS_NOTHING
(
alg
.
execute
());
...
...
@@ -422,7 +419,7 @@ public:
//TS_ASSERT( equals(origWS, ws, 1e-4) );
//Clear old file
//
if( Poco::File(outputFile).exists() ) Poco::File(outputFile).remove();
if
(
Poco
::
File
(
outputFile
).
exists
()
)
Poco
::
File
(
outputFile
).
remove
();
}
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/Nexus/test/SaveNexusProcessedTest.h
+
10
−
6
View file @
935783b1
...
...
@@ -307,7 +307,7 @@ public:
static
EventWorkspace_sptr
do_testExec_EventWorkspaces
(
std
::
string
filename_root
,
EventType
type
,
bool
makeDifferentTypes
=
false
,
bool
clearfiles
=
false
)
std
::
string
&
outputFile
,
bool
makeDifferentTypes
,
bool
clearfiles
)
{
std
::
vector
<
std
::
vector
<
int
>
>
groups
(
5
);
groups
[
0
].
push_back
(
10
);
...
...
@@ -345,7 +345,7 @@ public:
// specify name of file to save workspace to
std
::
ostringstream
mess
;
mess
<<
filename_root
<<
static_cast
<
int
>
(
type
)
<<
".nxs"
;
std
::
string
outputFile
=
mess
.
str
();
outputFile
=
mess
.
str
();
std
::
string
dataName
=
"spectra"
;
std
::
string
title
=
"A simple workspace saved in Processed Nexus format"
;
...
...
@@ -368,22 +368,26 @@ public:
void
testExec_EventWorkspace_TofEvent
()
{
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_"
,
TOF
,
false
,
clearfiles
);
std
::
string
outputFile
;
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_"
,
TOF
,
outputFile
,
false
,
clearfiles
);
}
void
testExec_EventWorkspace_WeightedEvent
()
{
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_"
,
WEIGHTED
,
false
,
clearfiles
);
std
::
string
outputFile
;
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_"
,
WEIGHTED
,
outputFile
,
false
,
clearfiles
);
}
void
testExec_EventWorkspace_WeightedEventNoTime
()
{
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_"
,
WEIGHTED_NOTIME
,
false
,
clearfiles
);
std
::
string
outputFile
;
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_"
,
WEIGHTED_NOTIME
,
outputFile
,
false
,
clearfiles
);
}
void
testExec_EventWorkspace_DifferentTypes
()
{
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_DifferentTypes_"
,
WEIGHTED_NOTIME
,
true
,
clearfiles
);
std
::
string
outputFile
;
do_testExec_EventWorkspaces
(
"SaveNexusProcessed_DifferentTypes_"
,
WEIGHTED_NOTIME
,
outputFile
,
true
,
clearfiles
);
}
...
...
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