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
e11f0fb1
Commit
e11f0fb1
authored
6 years ago
by
Robert Applin
Browse files
Options
Downloads
Patches
Plain Diff
Add displayName and data instantiated unit tests Refs #23463
parent
3ed46361
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
qt/scientific_interfaces/Indirect/test/CMakeLists.txt
+3
-0
3 additions, 0 deletions
qt/scientific_interfaces/Indirect/test/CMakeLists.txt
qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h
+16
-13
16 additions, 13 deletions
qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h
with
19 additions
and
13 deletions
qt/scientific_interfaces/Indirect/test/CMakeLists.txt
+
3
−
0
View file @
e11f0fb1
...
...
@@ -13,6 +13,9 @@ mtd_add_qt_tests (TARGET_NAME MantidQtInterfacesIndirectTest
../../../../Framework/TestHelpers/inc
../
TEST_HELPER_SRCS
../../../../Framework/TestHelpers/src/ComponentCreationHelper.cpp
../../../../Framework/TestHelpers/src/InstrumentCreationHelper.cpp
../../../../Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
../../../../Framework/TestHelpers/src/TearDownWorld.cpp
LINK_LIBS
${
TCMALLOC_LIBRARIES_LINKTIME
}
...
...
This diff is collapsed.
Click to expand it.
qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h
+
16
−
13
View file @
e11f0fb1
...
...
@@ -5,7 +5,7 @@
#include
"IndirectFitData.h"
#include
"MantidAPI/MatrixWorkspace.h"
#include
"Mantid
API/WorkspaceFactory
.h"
#include
"Mantid
TestHelpers/WorkspaceCreationHelper
.h"
#include
<iostream>
...
...
@@ -21,24 +21,27 @@ public:
static
void
destroySuite
(
IndirectFitDataTest
*
suite
)
{
delete
suite
;
}
void
test_data_is_instantiated_correctly
()
{
MatrixWorkspace_sptr
workspace
=
WorkspaceFactory
::
Instance
().
create
(
"Workspace2D"
,
1
,
9
,
9
);
auto
workspace
=
WorkspaceCreationHelper
::
create2DWorkspace123
(
1
,
3
);
const
Spectra
spec
=
std
::
make_pair
(
0u
,
workspace
->
getNumberHistograms
()
-
1
);
// IndirectFitData data(workspace, spec);
// const std::string name = data.workspace()->getName();
// std::cout << name << "\n";
std
::
cout
<<
"HELLO"
;
workspace
->
setTitle
(
"Test Title"
);
IndirectFitData
data
(
workspace
,
spec
);
TS_ASSERT_EQUALS
(
data
.
workspace
()
->
getTitle
(),
"Test Title"
);
TS_ASSERT_EQUALS
(
data
.
workspace
()
->
getNumberHistograms
(),
1
);
}
void
test_displayName_returns_correct_name
()
{
// given -
// the workspace and data
// when -
// the parameters equal so and so
// then -
// the output name should be
auto
workspace
=
WorkspaceCreationHelper
::
create2DWorkspace123
(
1
,
3
);
const
Spectra
spec
=
std
::
make_pair
(
0u
,
workspace
->
getNumberHistograms
()
-
1
);
IndirectFitData
data
(
workspace
,
spec
);
const
std
::
string
formatString
=
"%1%_s%2%_Result"
;
const
std
::
string
rangeDelimiter
=
"_to_"
;
TS_ASSERT_EQUALS
(
data
.
displayName
(
formatString
,
rangeDelimiter
),
"_s0_Result"
);
}
};
...
...
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