Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HEPnOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
HEP
HEPnOS
Commits
55244187
Commit
55244187
authored
Oct 15, 2018
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved tests
parent
301fd5cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
test/PtrTest.cpp
test/PtrTest.cpp
+41
-0
test/PtrTest.hpp
test/PtrTest.hpp
+2
-0
No files found.
test/PtrTest.cpp
View file @
55244187
#include <map>
#include <boost/serialization/map.hpp>
#include "PtrTest.hpp"
#include "CppUnitAdditionalMacros.hpp"
#include "TestObjects.hpp"
...
...
@@ -92,3 +94,42 @@ void PtrTest::testPtrLoad() {
CPPUNIT_ASSERT
(
objB
==
*
ptrB
);
}
void
PtrTest
::
testPtrLoadFromArray
()
{
auto
mds
=
(
*
datastore
)[
"matthieu"
];
auto
run
=
mds
[
42
];
auto
subrun
=
run
[
3
];
auto
event
=
subrun
[
22
];
CPPUNIT_ASSERT
(
mds
.
valid
());
CPPUNIT_ASSERT
(
run
.
valid
());
CPPUNIT_ASSERT
(
subrun
.
valid
());
CPPUNIT_ASSERT
(
event
.
valid
());
std
::
vector
<
TestObjectA
>
vecA
(
3
);
vecA
[
0
].
x
()
=
43
;
vecA
[
0
].
y
()
=
4.3
;
vecA
[
1
].
x
()
=
44
;
vecA
[
1
].
y
()
=
4.4
;
vecA
[
2
].
x
()
=
45
;
vecA
[
2
].
y
()
=
4.5
;
auto
prodIDvec
=
event
.
store
(
"somekey"
,
vecA
);
auto
ptrToVecA
=
datastore
->
makePtr
<
TestObjectA
>
(
prodIDvec
,
1
);
CPPUNIT_ASSERT
(
vecA
[
1
]
==
*
ptrToVecA
);
std
::
map
<
unsigned
,
TestObjectA
>
mapA
;
mapA
[
0
].
x
()
=
43
;
mapA
[
0
].
y
()
=
4.3
;
mapA
[
1
].
x
()
=
44
;
mapA
[
1
].
y
()
=
4.4
;
mapA
[
2
].
x
()
=
45
;
mapA
[
2
].
y
()
=
4.5
;
auto
prodIDmap
=
event
.
store
(
"somekey"
,
mapA
);
auto
ptrToMapA
=
datastore
->
makePtr
<
TestObjectA
,
std
::
map
<
unsigned
,
TestObjectA
>>
(
prodIDmap
,
1
);
CPPUNIT_ASSERT
(
mapA
[
1
]
==
*
ptrToMapA
);
}
test/PtrTest.hpp
View file @
55244187
...
...
@@ -12,6 +12,7 @@ class PtrTest : public CppUnit::TestFixture
CPPUNIT_TEST
(
testFillDataStore
);
CPPUNIT_TEST
(
testMakePtr
);
CPPUNIT_TEST
(
testPtrLoad
);
CPPUNIT_TEST
(
testPtrLoadFromArray
);
CPPUNIT_TEST_SUITE_END
();
public:
...
...
@@ -22,6 +23,7 @@ class PtrTest : public CppUnit::TestFixture
void
testFillDataStore
();
void
testMakePtr
();
void
testPtrLoad
();
void
testPtrLoadFromArray
();
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment