Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
4ecdc865
Commit
4ecdc865
authored
Oct 02, 2014
by
Marian Triebe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit test for `caf::optional`
parent
d58a5651
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
unit_testing/CMakeLists.txt
unit_testing/CMakeLists.txt
+1
-0
unit_testing/test_optional.cpp
unit_testing/test_optional.cpp
+54
-0
No files found.
unit_testing/CMakeLists.txt
View file @
4ecdc865
...
...
@@ -31,3 +31,4 @@ add_unit_test(sync_send)
add_unit_test
(
broker
)
add_unit_test
(
remote_actor ping_pong.cpp
)
add_unit_test
(
typed_remote_actor
)
add_unit_test
(
optional
)
unit_testing/test_optional.cpp
0 → 100644
View file @
4ecdc865
#include <string>
#include "caf/optional.hpp"
#include "test.hpp"
using
namespace
std
;
using
namespace
caf
;
int
main
()
{
{
optional
<
int
>
i
,
j
;
CAF_CHECK
(
i
==
j
);
CAF_CHECK
(
!
(
i
!=
j
));
}
{
optional
<
int
>
i
=
5
;
optional
<
int
>
j
=
6
;
CAF_CHECK
(
!
(
i
==
j
));
CAF_CHECK
(
i
!=
j
);
}
{
optional
<
int
>
i
;
optional
<
double
>
j
;
CAF_CHECK
(
i
==
j
);
CAF_CHECK
(
!
(
i
!=
j
));
}
{
struct
qwertz
{
qwertz
(
int
i
,
int
j
)
:
m_i
(
i
),
m_j
(
j
)
{
CAF_CHECKPOINT
();
}
int
m_i
;
int
m_j
;
};
{
optional
<
qwertz
>
i
;
CAF_CHECK
(
i
.
empty
());
}
{
qwertz
obj
(
1
,
2
);
optional
<
qwertz
>
j
(
obj
);
CAF_CHECK
(
!
j
.
empty
());
}
{
optional
<
qwertz
>
i
=
qwertz
(
1
,
2
);
CAF_CHECK
(
!
i
.
empty
());
optional
<
qwertz
>
j
=
{
{
1
,
2
}
};
CAF_CHECK
(
!
j
.
empty
());
}
}
return
CAF_TEST_RESULT
();
}
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