]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/optional/test/optional_test.cpp
1 // Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
3 // Use, modification, and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/lib/optional for documentation.
9 // You are welcome to contact the author at:
10 // fernando_cacciola@hotmail.com
13 // 12 May 2008 (added more swap tests)
15 #ifndef BOOST_NO_IOSTREAM
17 #endif // BOOST_NO_IOSTREAM
21 #define BOOST_ENABLE_ASSERT_HANDLER
23 #include "boost/bind/apply.hpp" // Included just to test proper interaction with boost::apply<> as reported by Daniel Wallin
24 #include "boost/mpl/bool.hpp"
25 #include "boost/mpl/bool_fwd.hpp" // For mpl::true_ and mpl::false_
27 #include "boost/optional/optional.hpp"
33 #include "boost/none.hpp"
35 #include "boost/core/lightweight_test.hpp"
37 #include "optional_test_common.hpp"
39 void test_implicit_construction ( optional
<double> opt
, double v
, double z
)
44 void test_implicit_construction ( optional
<X
> opt
, X
const& v
, X
const& z
)
49 void test_default_implicit_construction ( double, optional
<double> opt
)
54 void test_default_implicit_construction ( X
const&, optional
<X
> opt
)
61 // Check ordinary functionality:
62 // Initialization, assignment, comparison and value-accessing.
65 void test_basics( T
const* )
67 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
73 // Default construction.
74 // 'def' state is Uninitialized.
75 // T::T() is not called (and it is not even defined)
77 check_uninitialized(def
);
79 // Implicit construction
80 // The first parameter is implicitely converted to optional<T>(a);
81 test_implicit_construction(a
,a
,z
);
83 // Direct initialization.
84 // 'oa' state is Initialized with 'a'
85 // T::T( T const& x ) is used.
86 set_pending_copy( ARG(T
) ) ;
87 optional
<T
> oa ( a
) ;
88 check_is_not_pending_copy( ARG(T
) );
89 check_initialized(oa
);
96 // Value-Assignment upon Uninitialized optional.
97 // T::T( T const& x ) is used.
98 set_pending_copy( ARG(T
) ) ;
100 check_is_not_pending_copy( ARG(T
) ) ;
101 check_initialized(ob
);
104 // Value-Assignment upon Initialized optional.
105 // T::operator=( T const& x ) is used
106 set_pending_assign( ARG(T
) ) ;
107 set_pending_copy ( ARG(T
) ) ;
108 set_pending_dtor ( ARG(T
) ) ;
110 check_is_not_pending_assign( ARG(T
) ) ;
111 check_is_pending_copy ( ARG(T
) ) ;
112 check_is_pending_dtor ( ARG(T
) ) ;
113 check_initialized(ob
);
116 // Assignment initialization.
117 // T::T ( T const& x ) is used to copy new value.
118 set_pending_copy( ARG(T
) ) ;
119 optional
<T
> const oa2 ( oa
) ;
120 check_is_not_pending_copy( ARG(T
) ) ;
121 check_initialized_const(oa2
);
122 check_value_const(oa2
,a
,z
);
125 // T::operator= ( T const& x ) is used to copy new value.
126 set_pending_assign( ARG(T
) ) ;
128 check_is_not_pending_assign( ARG(T
) ) ;
129 check_initialized(oa
);
132 // Uninitializing Assignment upon Initialized Optional
133 // T::~T() is used to destroy previous value in oa.
134 set_pending_dtor( ARG(T
) ) ;
135 set_pending_copy( ARG(T
) ) ;
137 check_is_not_pending_dtor( ARG(T
) ) ;
138 check_is_pending_copy ( ARG(T
) ) ;
139 check_uninitialized(oa
);
141 // Uninitializing Assignment upon Uninitialized Optional
142 // (Dtor is not called this time)
143 set_pending_dtor( ARG(T
) ) ;
144 set_pending_copy( ARG(T
) ) ;
146 check_is_pending_dtor( ARG(T
) ) ;
147 check_is_pending_copy( ARG(T
) ) ;
148 check_uninitialized(oa
);
150 // Deinitialization of Initialized Optional
151 // T::~T() is used to destroy previous value in ob.
152 set_pending_dtor( ARG(T
) ) ;
154 check_is_not_pending_dtor( ARG(T
) ) ;
155 check_uninitialized(ob
);
157 // Deinitialization of Uninitialized Optional
158 // (Dtor is not called this time)
159 set_pending_dtor( ARG(T
) ) ;
161 check_is_pending_dtor( ARG(T
) ) ;
162 check_uninitialized(ob
);
167 void test_conditional_ctor_and_get_valur_or ( T
const* )
169 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
175 optional
<T
> const cdef0(false,a
);
177 optional
<T
> def0(false,a
);
178 optional
<T
> def1
= boost::make_optional(false,a
); // T is not within boost so ADL won't find make_optional unqualified
179 check_uninitialized(def0
);
180 check_uninitialized(def1
);
182 optional
<T
> const co0(true,a
);
184 optional
<T
> o0(true,a
);
185 optional
<T
> o1
= boost::make_optional(true,a
); // T is not within boost so ADL won't find make_optional unqualified
187 check_initialized(o0
);
188 check_initialized(o1
);
192 T b
= def0
.get_value_or(z
);
193 BOOST_TEST( b
== z
) ;
195 b
= get_optional_value_or(def0
,z
);
196 BOOST_TEST( b
== z
) ;
198 b
= o0
.get_value_or(z
);
199 BOOST_TEST( b
== a
) ;
201 b
= get_optional_value_or(o0
,z
);
202 BOOST_TEST( b
== a
) ;
208 T
const& crzz
= def0
.get_value_or(crz
);
209 BOOST_TEST( crzz
== crz
) ;
211 T
& rzz
= def0
.get_value_or(rz
);
212 BOOST_TEST( rzz
== rz
) ;
214 T
const& crzzz
= get_optional_value_or(cdef0
,crz
);
215 BOOST_TEST( crzzz
== crz
) ;
217 T
& rzzz
= get_optional_value_or(def0
,rz
);
218 BOOST_TEST( rzzz
== rz
) ;
220 T
const& crb
= o0
.get_value_or(crz
);
221 BOOST_TEST( crb
== a
) ;
223 T
& rb
= o0
.get_value_or(rz
);
224 BOOST_TEST( rb
== b
) ;
226 T
const& crbb
= get_optional_value_or(co0
,crz
);
227 BOOST_TEST( crbb
== b
) ;
229 T
const& crbbb
= get_optional_value_or(o0
,crz
);
230 BOOST_TEST( crbbb
== b
) ;
232 T
& rbb
= get_optional_value_or(o0
,rz
);
233 BOOST_TEST( rbb
== b
) ;
237 optional
<T
&> defref(false,ra
);
240 optional
<T
&> ref(true,ra
);
245 BOOST_TEST( *ref
== a
) ;
247 T
& r1
= defref
.get_value_or(z
);
248 BOOST_TEST( r1
== z
) ;
250 T
& r2
= ref
.get_value_or(z
);
251 BOOST_TEST( r2
== a
) ;
255 // Test Direct Value Manipulation
258 void test_direct_value_manip( T
const* )
260 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
264 optional
<T
> const c_opt0(x
) ;
267 BOOST_TEST( c_opt0
.get().V() == x
.V() ) ;
268 BOOST_TEST( opt0
.get().V() == x
.V() ) ;
270 BOOST_TEST( c_opt0
->V() == x
.V() ) ;
271 BOOST_TEST( opt0
->V() == x
.V() ) ;
273 BOOST_TEST( (*c_opt0
).V() == x
.V() ) ;
274 BOOST_TEST( (* opt0
).V() == x
.V() ) ;
278 BOOST_TEST( get(opt0
).V() == y
.V() ) ;
282 // Test Uninitialized access assert
285 void test_uninitialized_access( T
const* )
287 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
291 bool passed
= false ;
294 // This should throw because 'def' is uninitialized
295 T
const& n
= def
.get() ;
296 boost::ignore_unused(n
);
305 // This should throw because 'def' is uninitialized
307 boost::ignore_unused(n
);
317 boost::ignore_unused(v
);
318 // This should throw because 'def' is uninitialized
328 // This should throw because 'def' is uninitialized
329 T v
= *(def
.operator->()) ;
330 boost::ignore_unused(v
);
337 #if BOOST_WORKAROUND( BOOST_INTEL_CXX_VERSION, <= 700) // Intel C++ 7.0
338 void prevent_buggy_optimization( bool v
) {}
342 // Test Direct Initialization of optional for a T with throwing copy-ctor.
345 void test_throwing_direct_init( T
const* )
347 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
351 int count
= get_instance_count( ARG(T
) ) ;
353 set_throw_on_copy( ARG(T
) ) ;
355 bool passed
= false ;
359 // Attempt to copy construct 'a' and throw.
360 // 'opt' won't be constructed.
361 set_pending_copy( ARG(T
) ) ;
363 #if BOOST_WORKAROUND( BOOST_INTEL_CXX_VERSION, <= 700) // Intel C++ 7.0
364 // Intel C++ 7.0 specific:
365 // For some reason, when "check_is_not_pending_copy",
366 // after the exception block is reached,
367 // X::pending_copy==true even though X's copy ctor set it to false.
368 // I guessed there is some sort of optimization bug,
369 // and it seems to be the since the following additional line just
370 // solves the problem (!?)
371 prevent_buggy_optimization(X::pending_copy
);
380 check_is_not_pending_copy( ARG(T
) );
381 check_instance_count(count
, ARG(T
) );
383 reset_throw_on_copy( ARG(T
) ) ;
388 // Test Value Assignment to an Uninitialized optional for a T with a throwing copy-ctor
391 void test_throwing_val_assign_on_uninitialized( T
const* )
393 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
397 int count
= get_instance_count( ARG(T
) ) ;
399 set_throw_on_copy( ARG(T
) ) ;
403 bool passed
= false ;
407 // Attempt to copy construct 'a' and throw.
408 // opt should be left uninitialized.
409 set_pending_copy( ARG(T
) ) ;
417 check_is_not_pending_copy( ARG(T
) );
418 check_instance_count(count
, ARG(T
) );
419 check_uninitialized(opt
);
421 reset_throw_on_copy( ARG(T
) ) ;
425 // Test Value Reset on an Initialized optional for a T with a throwing copy-ctor
428 void test_throwing_val_assign_on_initialized( T
const* )
430 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
437 int count
= get_instance_count( ARG(T
) ) ;
439 optional
<T
> opt ( b
) ;
442 check_instance_count(count
, ARG(T
) );
444 check_value(opt
,b
,z
);
446 set_throw_on_assign( ARG(T
) ) ;
448 bool passed
= false ;
452 // Attempt to assign 'a' and throw.
453 // opt is kept initialized but its value not neccesarily fully assigned
454 // (in this test, incompletely assigned is flaged with the value -1 being set)
455 set_pending_assign( ARG(T
) ) ;
463 check_is_not_pending_assign( ARG(T
) );
464 check_instance_count(count
, ARG(T
) );
465 check_initialized(opt
);
466 check_value(opt
,x
,z
);
468 reset_throw_on_assign ( ARG(T
) ) ;
472 // Test Copy Initialization from an Initialized optional for a T with a throwing copy-ctor
475 void test_throwing_copy_initialization( T
const* )
477 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
484 int count
= get_instance_count( ARG(T
) ) ;
486 set_throw_on_copy( ARG(T
) ) ;
488 bool passed
= false ;
492 // Attempt to copy construct 'opt' and throw.
493 // opt1 won't be constructed.
494 set_pending_copy( ARG(T
) ) ;
495 optional
<T
> opt1
= opt
;
502 check_is_not_pending_copy( ARG(T
) );
503 check_instance_count(count
, ARG(T
) );
505 // Nothing should have happened to the source optional.
506 check_initialized(opt
);
507 check_value(opt
,a
,z
);
509 reset_throw_on_copy( ARG(T
) ) ;
513 // Test Assignment to an Uninitialized optional from an Initialized optional
514 // for a T with a throwing copy-ctor
517 void test_throwing_assign_to_uninitialized( T
const* )
519 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
525 optional
<T
> opt1(a
) ;
527 int count
= get_instance_count( ARG(T
) ) ;
529 set_throw_on_copy( ARG(T
) ) ;
531 bool passed
= false ;
535 // Attempt to copy construct 'opt1.value()' into opt0 and throw.
536 // opt0 should be left uninitialized.
537 set_pending_copy( ARG(T
) ) ;
545 check_is_not_pending_copy( ARG(T
) );
546 check_instance_count(count
, ARG(T
) );
547 check_uninitialized(opt0
);
549 reset_throw_on_copy( ARG(T
) ) ;
553 // Test Assignment to an Initialized optional from an Initialized optional
554 // for a T with a throwing copy-ctor
557 void test_throwing_assign_to_initialized( T
const* )
559 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
566 optional
<T
> opt0(a
) ;
567 optional
<T
> opt1(b
) ;
569 int count
= get_instance_count( ARG(T
) ) ;
571 set_throw_on_assign( ARG(T
) ) ;
573 bool passed
= false ;
577 // Attempt to copy construct 'opt1.value()' into opt0 and throw.
578 // opt0 is kept initialized but its value not neccesarily fully assigned
579 // (in this test, incompletely assigned is flaged with the value -1 being set)
580 set_pending_assign( ARG(T
) ) ;
588 // opt0 was left uninitialized
589 check_is_not_pending_assign( ARG(T
) );
590 check_instance_count(count
, ARG(T
) );
591 check_initialized(opt0
);
592 check_value(opt0
,x
,z
);
594 reset_throw_on_assign( ARG(T
) ) ;
598 // Test swap in a no-throwing case
601 void test_no_throwing_swap( T
const* )
603 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
611 optional
<T
> opt0(a
) ;
612 optional
<T
> opt1(b
) ;
614 int count
= get_instance_count( ARG(T
) ) ;
617 check_uninitialized(def0
);
618 check_uninitialized(def1
);
621 check_uninitialized(opt0
);
622 check_initialized(def0
);
623 check_value(def0
,a
,z
);
625 // restore def0 and opt0
629 check_instance_count(count
, ARG(T
) );
630 check_initialized(opt0
);
631 check_initialized(opt1
);
632 check_value(opt0
,b
,z
);
633 check_value(opt1
,a
,z
);
637 // Test swap in a throwing case
640 void test_throwing_swap( T
const* )
642 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
648 optional
<T
> opt0(a
) ;
649 optional
<T
> opt1(b
) ;
651 set_throw_on_assign( ARG(T
) ) ;
654 // Case 1: Both Initialized.
656 bool passed
= false ;
659 // This should attempt to swap optionals and fail at swap(X&,X&).
668 // optional's swap doesn't affect the initialized states of the arguments. Therefore,
669 // the following must hold:
670 check_initialized(opt0
);
671 check_initialized(opt1
);
672 check_value(opt0
,x
,a
);
673 check_value(opt1
,b
,x
);
677 // Case 2: Only one Initialized.
679 reset_throw_on_assign( ARG(T
) ) ;
684 set_throw_on_copy( ARG(T
) ) ;
689 // This should attempt to swap optionals and fail at opt0.reset(*opt1)
690 // Both opt0 and op1 are left unchanged (unswaped)
699 check_uninitialized(opt0
);
700 check_initialized(opt1
);
701 check_value(opt1
,a
,x
);
703 reset_throw_on_copy( ARG(T
) ) ;
707 // This verifies relational operators.
710 void test_relops( T
const* )
712 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
720 optional
<T
> opt0(v0
);
721 optional
<T
> opt1(v1
);
722 optional
<T
> opt2(v2
);
725 BOOST_TEST ( def0
== def0
) ;
726 BOOST_TEST ( opt0
== opt0
) ;
727 BOOST_TEST ( !(def0
!= def0
) ) ;
728 BOOST_TEST ( !(opt0
!= opt0
) ) ;
730 // Check when both are uininitalized.
731 BOOST_TEST ( def0
== def1
) ; // both uninitialized compare equal
732 BOOST_TEST ( !(def0
< def1
) ) ; // uninitialized is never less than uninitialized
733 BOOST_TEST ( !(def0
> def1
) ) ; // uninitialized is never greater than uninitialized
734 BOOST_TEST ( !(def0
!= def1
) ) ;
735 BOOST_TEST ( def0
<= def1
) ;
736 BOOST_TEST ( def0
>= def1
) ;
738 // Check when only lhs is uninitialized.
739 BOOST_TEST ( def0
!= opt0
) ; // uninitialized is never equal to initialized
740 BOOST_TEST ( !(def0
== opt0
) ) ;
741 BOOST_TEST ( def0
< opt0
) ; // uninitialized is always less than initialized
742 BOOST_TEST ( !(def0
> opt0
) ) ;
743 BOOST_TEST ( def0
<= opt0
) ;
744 BOOST_TEST ( !(def0
>= opt0
) ) ;
746 // Check when only rhs is uninitialized.
747 BOOST_TEST ( opt0
!= def0
) ; // initialized is never equal to uninitialized
748 BOOST_TEST ( !(opt0
== def0
) ) ;
749 BOOST_TEST ( !(opt0
< def0
) ) ; // initialized is never less than uninitialized
750 BOOST_TEST ( opt0
> def0
) ;
751 BOOST_TEST ( !(opt0
<= def0
) ) ;
752 BOOST_TEST ( opt0
>= opt0
) ;
754 // If both are initialized, values are compared
755 BOOST_TEST ( opt0
!= opt1
) ;
756 BOOST_TEST ( opt1
== opt2
) ;
757 BOOST_TEST ( opt0
< opt1
) ;
758 BOOST_TEST ( opt1
> opt0
) ;
759 BOOST_TEST ( opt1
<= opt2
) ;
760 BOOST_TEST ( opt1
>= opt0
) ;
762 // Compare against a value directly
763 BOOST_TEST ( opt0
== v0
) ;
764 BOOST_TEST ( opt0
!= v1
) ;
765 BOOST_TEST ( opt1
== v2
) ;
766 BOOST_TEST ( opt0
< v1
) ;
767 BOOST_TEST ( opt1
> v0
) ;
768 BOOST_TEST ( opt1
<= v2
) ;
769 BOOST_TEST ( opt1
>= v0
) ;
770 BOOST_TEST ( v0
!= opt1
) ;
771 BOOST_TEST ( v1
== opt2
) ;
772 BOOST_TEST ( v0
< opt1
) ;
773 BOOST_TEST ( v1
> opt0
) ;
774 BOOST_TEST ( v1
<= opt2
) ;
775 BOOST_TEST ( v1
>= opt0
) ;
776 BOOST_TEST ( def0
!= v0
) ;
777 BOOST_TEST ( !(def0
== v0
) ) ;
778 BOOST_TEST ( def0
< v0
) ;
779 BOOST_TEST ( !(def0
> v0
) ) ;
780 BOOST_TEST ( def0
<= v0
) ;
781 BOOST_TEST ( !(def0
>= v0
) ) ;
782 BOOST_TEST ( v0
!= def0
) ;
783 BOOST_TEST ( !(v0
== def0
) ) ;
784 BOOST_TEST ( !(v0
< def0
) ) ;
785 BOOST_TEST ( v0
> def0
) ;
786 BOOST_TEST ( !(v0
<= def0
) ) ;
787 BOOST_TEST ( v0
>= opt0
) ;
791 void test_none( T
const* )
793 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
798 optional
<T
> def1(none
) ;
799 optional
<T
> non_def( T(1234) ) ;
801 BOOST_TEST ( def0
== none
) ;
802 BOOST_TEST ( non_def
!= none
) ;
803 BOOST_TEST ( !def1
) ;
804 BOOST_TEST ( !(non_def
< none
) ) ;
805 BOOST_TEST ( non_def
> none
) ;
806 BOOST_TEST ( !(non_def
<= none
) ) ;
807 BOOST_TEST ( non_def
>= none
) ;
810 BOOST_TEST ( !non_def
) ;
812 test_default_implicit_construction(T(1),none
);
816 void test_arrow( T
const* )
818 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
823 optional
<T
> const coa(a
) ;
825 BOOST_TEST ( coa
->V() == 1234 ) ;
829 BOOST_TEST ( a
.V() = 1234 ) ;
830 BOOST_TEST ( (*oa
).V() = 4321 ) ;
833 void test_with_builtin_types()
835 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
837 test_basics( ARG(double) );
838 test_conditional_ctor_and_get_valur_or( ARG(double) );
839 test_uninitialized_access( ARG(double) );
840 test_no_throwing_swap( ARG(double) );
841 test_relops( ARG(double) ) ;
842 test_none( ARG(double) ) ;
845 // MSVC < 11.0 doesn't destroy X when we call ptr->VBase::VBase.
846 // Make sure that we work around this bug.
847 struct VBase
: virtual X
849 VBase(int v
) : X(v
) {}
850 // MSVC 8.0 doesn't generate this correctly...
851 VBase(const VBase
& other
) : X(static_cast<const X
&>(other
)) {}
854 void test_with_class_type()
856 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
858 test_basics( ARG(X
) );
859 test_basics( ARG(VBase
) );
860 test_conditional_ctor_and_get_valur_or( ARG(X
) );
861 test_direct_value_manip( ARG(X
) );
862 test_uninitialized_access( ARG(X
) );
863 test_throwing_direct_init( ARG(X
) );
864 test_throwing_val_assign_on_uninitialized( ARG(X
) );
865 test_throwing_val_assign_on_initialized( ARG(X
) );
866 test_throwing_copy_initialization( ARG(X
) );
867 test_throwing_assign_to_uninitialized( ARG(X
) );
868 test_throwing_assign_to_initialized( ARG(X
) );
869 test_no_throwing_swap( ARG(X
) );
870 test_throwing_swap( ARG(X
) );
871 test_relops( ARG(X
) ) ;
872 test_none( ARG(X
) ) ;
873 test_arrow( ARG(X
) ) ;
874 BOOST_TEST ( X::count
== 0 ) ;
877 int eat ( bool ) { return 1 ; }
878 int eat ( char ) { return 1 ; }
879 int eat ( int ) { return 1 ; }
880 int eat ( void const* ) { return 1 ; }
882 template<class T
> int eat ( T
) { return 0 ; }
885 // This verifies that operator safe_bool() behaves properly.
888 void test_no_implicit_conversions_impl( T
const& )
890 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
893 BOOST_TEST ( eat(def
) == 0 ) ;
896 void test_no_implicit_conversions()
898 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
905 test_no_implicit_conversions_impl(b
);
906 test_no_implicit_conversions_impl(c
);
907 test_no_implicit_conversions_impl(i
);
908 test_no_implicit_conversions_impl(p
);
912 // Test for support for classes with overridden operator&
913 class CustomAddressOfClass
918 CustomAddressOfClass() : n(0) {}
919 CustomAddressOfClass(CustomAddressOfClass
const& that
) : n(that
.n
) {}
920 explicit CustomAddressOfClass(int m
) : n(m
) {}
921 int* operator& () { return &n
; }
922 bool operator== (CustomAddressOfClass
const& that
) const { return n
== that
.n
; }
925 void test_custom_addressof_operator()
927 boost::optional
< CustomAddressOfClass
> o1(CustomAddressOfClass(10));
929 BOOST_TEST(o1
.get() == CustomAddressOfClass(10));
931 o1
= CustomAddressOfClass(20);
933 BOOST_TEST(o1
.get() == CustomAddressOfClass(20));
943 test_with_class_type();
944 test_with_builtin_types();
945 test_no_implicit_conversions();
946 test_custom_addressof_operator();
950 BOOST_ERROR("Unexpected Exception caught!");
953 return boost::report_errors();