1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
2 // Copyright (C) 2014 Andrzej Krzemienski.
4 // Use, modification, and distribution is subject to the Boost Software
5 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // See http://www.boost.org/lib/optional for documentation.
10 // You are welcome to contact the author at:
11 // fernando_cacciola@hotmail.com
13 #include "boost/optional/optional.hpp"
14 #include "boost/optional/optional_io.hpp"
15 #include "boost/core/lightweight_test.hpp"
17 #ifndef BOOST_NO_IOSTREAM
27 using boost::optional
;
30 void test2( Opt o
, Opt buff
)
34 const int markv
= 123 ;
37 s
<< o
<< " " << markv
;
40 BOOST_TEST( buff
== o
) ;
41 BOOST_TEST( mark
== markv
) ;
48 test2( boost::make_optional(v
), optional
<T
> ());
49 test2( boost::make_optional(v
), boost::make_optional(w
));
50 test2( optional
<T
> () , optional
<T
> ());
51 test2( optional
<T
> () , boost::make_optional(w
));
56 void subtest_tag_none_reversibility_with_optional(optional
<T
> ov
)
65 void subtest_tag_none_equivalence_with_optional()
67 std::stringstream s
, r
;
71 BOOST_TEST_EQ(s
.str(), r
.str());
75 void test_tag_none(T v
)
77 subtest_tag_none_reversibility_with_optional(optional
<T
>(v
));
78 subtest_tag_none_reversibility_with_optional(optional
<T
>());
79 subtest_tag_none_equivalence_with_optional
<T
>();
86 test(std::string("hello"), std::string("buffer"));
88 test_tag_none(std::string("text"));
90 return boost::report_errors();
93 #else // BOOST_NO_IOSTREAM
97 return boost::report_errors();
100 #endif // BOOST_NO_IOSTREAM