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
248b1bbf
Commit
248b1bbf
authored
6 years ago
by
Bhuvan Bezawada
Browse files
Options
Downloads
Patches
Plain Diff
Updated c++ unit tests for iterator
re #23145
parent
56fc6f0f
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/Geometry/test/DetectorInfoIteratorTest.h
+11
-24
11 additions, 24 deletions
Framework/Geometry/test/DetectorInfoIteratorTest.h
with
11 additions
and
24 deletions
Framework/Geometry/test/DetectorInfoIteratorTest.h
+
11
−
24
View file @
248b1bbf
#ifndef MANTID_GEOMETRY_DETECTORINFOITERATORTEST_H_
#define MANTID_GEOMETRY_DETECTORINFOITERATORTEST_H_
#include
<algorithm>
#include
<boost/make_shared.hpp>
#include
<cxxtest/TestSuite.h>
#include
<set>
#include
"MantidBeamline/DetectorInfo.h"
#include
"MantidGeometry/Instrument/Detector.h"
#include
"MantidGeometry/Instrument/DetectorInfo.h"
...
...
@@ -17,10 +12,15 @@
#include
"MantidKernel/V3D.h"
#include
"MantidTestHelpers/ComponentCreationHelper.h"
using
namespace
Mantid
::
Geometry
;
#include
<algorithm>
#include
<boost/make_shared.hpp>
#include
<cxxtest/TestSuite.h>
#include
<set>
using
Mantid
::
detid_t
;
using
Mantid
::
Kernel
::
V3D
;
using
namespace
ComponentCreationHelper
;
using
Mantid
::
detid_t
;
using
namespace
Mantid
::
Geometry
;
class
DetectorInfoIteratorTest
:
public
CxxTest
::
TestSuite
{
public:
...
...
@@ -147,38 +147,25 @@ public:
TS_ASSERT
(
iter
==
detectorInfo
.
begin
());
}
void
test_iterator_position
()
{
// Get the DetectorInfo object
auto
detectorInfo
=
create_detector_info_object
();
auto
iter
=
detectorInfo
.
begin
();
for
(
int
i
=
0
;
i
<
11
;
i
++
)
{
TS_ASSERT_EQUALS
(
iter
->
position
(),
i
);
++
iter
;
}
}
void
test_copy_iterator
()
{
// Get the DetectorInfo object
auto
detectorInfo
=
create_detector_info_object
();
auto
iter
=
detectorInfo
.
begin
();
// Create a copy
auto
iterCopy
=
DetectorInfoIterator
(
iter
);
// Check
TS_ASSERT_EQUALS
(
iter
->
getIndex
(),
0
);
TS_ASSERT_EQUALS
(
iterCopy
->
getIndex
(),
0
);
TS_ASSERT_EQUALS
(
iter
->
position
(),
0
);
TS_ASSERT_EQUALS
(
iterCopy
->
position
(),
0
);
// Increment
++
iter
;
++
iterCopy
;
// Check again
TS_ASSERT_EQUALS
(
iter
->
getIndex
(),
1
);
TS_ASSERT_EQUALS
(
iterCopy
->
getIndex
(),
1
);
TS_ASSERT_EQUALS
(
iter
->
position
(),
1
);
TS_ASSERT_EQUALS
(
iterCopy
->
position
(),
1
);
}
};
...
...
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