File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ SRC = src/expr/require_expr.cpp \
5
5
src/ansi-c/c_to_expr.cpp \
6
6
unit_tests.cpp \
7
7
catch_example.cpp \
8
+ util/expr_iterator.cpp \
9
+ optional.cpp \
10
+ analyses/call_graph.cpp \
11
+ java_bytecode/java_bytecode_convert_class/convert_abstract_class.cpp \
8
12
# Empty last line
9
13
10
14
# Test source files
Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: nonstd::optional unit tests
4
+
5
+ Author: Diffblue Limited. All rights reserved.
6
+
7
+ \*******************************************************************/
8
+
9
+ #include " catch.hpp"
10
+ #include < util/optional.h>
11
+
12
+ TEST_CASE (" Optional without a value" , " [core][util][optional]" )
13
+ {
14
+ optionalt<bool > maybe_value;
15
+ REQUIRE (maybe_value.has_value ()==false );
16
+ REQUIRE_THROWS_AS (maybe_value.value (), bad_optional_accesst);
17
+ }
18
+
19
+ TEST_CASE (" Optional with a value" , " [core][util][optional]" )
20
+ {
21
+ optionalt<bool > maybe_value=false ;
22
+ REQUIRE (maybe_value.has_value ());
23
+ REQUIRE (maybe_value.value ()==false );
24
+ }
25
+
26
+
27
+ TEST_CASE (" Optional with a value (operator access)" , " [core][util][optional]" )
28
+ {
29
+ optionalt<bool > maybe_value=true ;
30
+ REQUIRE (maybe_value.has_value ());
31
+ REQUIRE (*maybe_value==true );
32
+ }
You can’t perform that action at this time.
0 commit comments