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
14 #include "boost/optional/optional.hpp"
15 #include "boost/optional/optional_io.hpp"
21 #include "boost/core/lightweight_test.hpp"
23 using boost::optional
;
26 void test2( Opt o
, Opt buff
)
30 const int markv
= 123 ;
33 s
<< o
<< " " << markv
;
36 BOOST_TEST( buff
== o
) ;
37 BOOST_TEST( mark
== markv
) ;
44 test2( boost::make_optional(v
), optional
<T
> ());
45 test2( boost::make_optional(v
), boost::make_optional(w
));
46 test2( optional
<T
> () , optional
<T
> ());
47 test2( optional
<T
> () , boost::make_optional(w
));
52 void subtest_tag_none_reversibility_with_optional(optional
<T
> ov
)
61 void subtest_tag_none_equivalence_with_optional()
63 std::stringstream s
, r
;
67 BOOST_TEST_EQ(s
.str(), r
.str());
71 void test_tag_none(T v
)
73 subtest_tag_none_reversibility_with_optional(optional
<T
>(v
));
74 subtest_tag_none_reversibility_with_optional(optional
<T
>());
75 subtest_tag_none_equivalence_with_optional
<T
>();
82 test(std::string("hello"), std::string("buffer"));
84 test_tag_none(std::string("text"));
86 return boost::report_errors();