]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/optional/test/optional_test.cpp
3354430bfa54c0e63401010b22a76c87922910da
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)
19 #define BOOST_ENABLE_ASSERT_HANDLER
21 #include "boost/bind/apply.hpp" // Included just to test proper interaction with boost::apply<> as reported by Daniel Wallin
22 #include "boost/mpl/bool.hpp"
23 #include "boost/mpl/bool_fwd.hpp" // For mpl::true_ and mpl::false_
25 #include "boost/optional/optional.hpp"
31 #include "boost/none.hpp"
33 #include "boost/core/lightweight_test.hpp"
35 #include "optional_test_common.hpp"
37 void test_implicit_construction ( optional
<double> opt
, double v
, double z
)
42 void test_implicit_construction ( optional
<X
> opt
, X
const& v
, X
const& z
)
47 void test_default_implicit_construction ( double, optional
<double> opt
)
52 void test_default_implicit_construction ( X
const&, optional
<X
> opt
)
59 // Check ordinary functionality:
60 // Initialization, assignment, comparison and value-accessing.
63 void test_basics( T
const* )
65 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
71 // Default construction.
72 // 'def' state is Uninitialized.
73 // T::T() is not called (and it is not even defined)
75 check_uninitialized(def
);
77 // Implicit construction
78 // The first parameter is implicitely converted to optional<T>(a);
79 test_implicit_construction(a
,a
,z
);
81 // Direct initialization.
82 // 'oa' state is Initialized with 'a'
83 // T::T( T const& x ) is used.
84 set_pending_copy( ARG(T
) ) ;
85 optional
<T
> oa ( a
) ;
86 check_is_not_pending_copy( ARG(T
) );
87 check_initialized(oa
);
94 // Value-Assignment upon Uninitialized optional.
95 // T::T( T const& x ) is used.
96 set_pending_copy( ARG(T
) ) ;
98 check_is_not_pending_copy( ARG(T
) ) ;
99 check_initialized(ob
);
102 // Value-Assignment upon Initialized optional.
103 // T::operator=( T const& x ) is used
104 set_pending_assign( ARG(T
) ) ;
105 set_pending_copy ( ARG(T
) ) ;
106 set_pending_dtor ( ARG(T
) ) ;
108 check_is_not_pending_assign( ARG(T
) ) ;
109 check_is_pending_copy ( ARG(T
) ) ;
110 check_is_pending_dtor ( ARG(T
) ) ;
111 check_initialized(ob
);
114 // Assignment initialization.
115 // T::T ( T const& x ) is used to copy new value.
116 set_pending_copy( ARG(T
) ) ;
117 optional
<T
> const oa2 ( oa
) ;
118 check_is_not_pending_copy( ARG(T
) ) ;
119 check_initialized_const(oa2
);
120 check_value_const(oa2
,a
,z
);
123 // T::operator= ( T const& x ) is used to copy new value.
124 set_pending_assign( ARG(T
) ) ;
126 check_is_not_pending_assign( ARG(T
) ) ;
127 check_initialized(oa
);
130 // Uninitializing Assignment upon Initialized Optional
131 // T::~T() is used to destroy previous value in oa.
132 set_pending_dtor( ARG(T
) ) ;
133 set_pending_copy( ARG(T
) ) ;
135 check_is_not_pending_dtor( ARG(T
) ) ;
136 check_is_pending_copy ( ARG(T
) ) ;
137 check_uninitialized(oa
);
139 // Uninitializing Assignment upon Uninitialized Optional
140 // (Dtor is not called this time)
141 set_pending_dtor( ARG(T
) ) ;
142 set_pending_copy( ARG(T
) ) ;
144 check_is_pending_dtor( ARG(T
) ) ;
145 check_is_pending_copy( ARG(T
) ) ;
146 check_uninitialized(oa
);
148 // Deinitialization of Initialized Optional
149 // T::~T() is used to destroy previous value in ob.
150 set_pending_dtor( ARG(T
) ) ;
152 check_is_not_pending_dtor( ARG(T
) ) ;
153 check_uninitialized(ob
);
155 // Deinitialization of Uninitialized Optional
156 // (Dtor is not called this time)
157 set_pending_dtor( ARG(T
) ) ;
159 check_is_pending_dtor( ARG(T
) ) ;
160 check_uninitialized(ob
);
165 void test_conditional_ctor_and_get_valur_or ( T
const* )
167 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
173 optional
<T
> const cdef0(false,a
);
175 optional
<T
> def0(false,a
);
176 optional
<T
> def1
= boost::make_optional(false,a
); // T is not within boost so ADL won't find make_optional unqualified
177 check_uninitialized(def0
);
178 check_uninitialized(def1
);
180 optional
<T
> const co0(true,a
);
182 optional
<T
> o0(true,a
);
183 optional
<T
> o1
= boost::make_optional(true,a
); // T is not within boost so ADL won't find make_optional unqualified
185 check_initialized(o0
);
186 check_initialized(o1
);
190 T b
= def0
.get_value_or(z
);
191 BOOST_TEST( b
== z
) ;
193 b
= get_optional_value_or(def0
,z
);
194 BOOST_TEST( b
== z
) ;
196 b
= o0
.get_value_or(z
);
197 BOOST_TEST( b
== a
) ;
199 b
= get_optional_value_or(o0
,z
);
200 BOOST_TEST( b
== a
) ;
206 T
const& crzz
= def0
.get_value_or(crz
);
207 BOOST_TEST( crzz
== crz
) ;
209 T
& rzz
= def0
.get_value_or(rz
);
210 BOOST_TEST( rzz
== rz
) ;
212 T
const& crzzz
= get_optional_value_or(cdef0
,crz
);
213 BOOST_TEST( crzzz
== crz
) ;
215 T
& rzzz
= get_optional_value_or(def0
,rz
);
216 BOOST_TEST( rzzz
== rz
) ;
218 T
const& crb
= o0
.get_value_or(crz
);
219 BOOST_TEST( crb
== a
) ;
221 T
& rb
= o0
.get_value_or(rz
);
222 BOOST_TEST( rb
== b
) ;
224 T
const& crbb
= get_optional_value_or(co0
,crz
);
225 BOOST_TEST( crbb
== b
) ;
227 T
const& crbbb
= get_optional_value_or(o0
,crz
);
228 BOOST_TEST( crbbb
== b
) ;
230 T
& rbb
= get_optional_value_or(o0
,rz
);
231 BOOST_TEST( rbb
== b
) ;
235 optional
<T
&> defref(false,ra
);
238 optional
<T
&> ref(true,ra
);
243 BOOST_TEST( *ref
== a
) ;
245 T
& r1
= defref
.get_value_or(z
);
246 BOOST_TEST( r1
== z
) ;
248 T
& r2
= ref
.get_value_or(z
);
249 BOOST_TEST( r2
== a
) ;
253 // Test Direct Value Manipulation
256 void test_direct_value_manip( T
const* )
258 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
262 optional
<T
> const c_opt0(x
) ;
265 BOOST_TEST( c_opt0
.get().V() == x
.V() ) ;
266 BOOST_TEST( opt0
.get().V() == x
.V() ) ;
268 BOOST_TEST( c_opt0
->V() == x
.V() ) ;
269 BOOST_TEST( opt0
->V() == x
.V() ) ;
271 BOOST_TEST( (*c_opt0
).V() == x
.V() ) ;
272 BOOST_TEST( (* opt0
).V() == x
.V() ) ;
276 BOOST_TEST( get(opt0
).V() == y
.V() ) ;
280 // Test Uninitialized access assert
283 void test_uninitialized_access( T
const* )
285 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
289 bool passed
= false ;
292 // This should throw because 'def' is uninitialized
293 T
const& n
= def
.get() ;
294 boost::ignore_unused(n
);
303 // This should throw because 'def' is uninitialized
305 boost::ignore_unused(n
);
315 boost::ignore_unused(v
);
316 // This should throw because 'def' is uninitialized
326 // This should throw because 'def' is uninitialized
327 T v
= *(def
.operator->()) ;
328 boost::ignore_unused(v
);
335 #if BOOST_WORKAROUND( BOOST_INTEL_CXX_VERSION, <= 700) // Intel C++ 7.0
336 void prevent_buggy_optimization( bool v
) {}
340 // Test Direct Initialization of optional for a T with throwing copy-ctor.
343 void test_throwing_direct_init( T
const* )
345 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
349 int count
= get_instance_count( ARG(T
) ) ;
351 set_throw_on_copy( ARG(T
) ) ;
353 bool passed
= false ;
357 // Attempt to copy construct 'a' and throw.
358 // 'opt' won't be constructed.
359 set_pending_copy( ARG(T
) ) ;
361 #if BOOST_WORKAROUND( BOOST_INTEL_CXX_VERSION, <= 700) // Intel C++ 7.0
362 // Intel C++ 7.0 specific:
363 // For some reason, when "check_is_not_pending_copy",
364 // after the exception block is reached,
365 // X::pending_copy==true even though X's copy ctor set it to false.
366 // I guessed there is some sort of optimization bug,
367 // and it seems to be the since the following additional line just
368 // solves the problem (!?)
369 prevent_buggy_optimization(X::pending_copy
);
378 check_is_not_pending_copy( ARG(T
) );
379 check_instance_count(count
, ARG(T
) );
381 reset_throw_on_copy( ARG(T
) ) ;
386 // Test Value Assignment to an Uninitialized optional for a T with a throwing copy-ctor
389 void test_throwing_val_assign_on_uninitialized( T
const* )
391 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
395 int count
= get_instance_count( ARG(T
) ) ;
397 set_throw_on_copy( ARG(T
) ) ;
401 bool passed
= false ;
405 // Attempt to copy construct 'a' and throw.
406 // opt should be left uninitialized.
407 set_pending_copy( ARG(T
) ) ;
415 check_is_not_pending_copy( ARG(T
) );
416 check_instance_count(count
, ARG(T
) );
417 check_uninitialized(opt
);
419 reset_throw_on_copy( ARG(T
) ) ;
423 // Test Value Reset on an Initialized optional for a T with a throwing copy-ctor
426 void test_throwing_val_assign_on_initialized( T
const* )
428 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
435 int count
= get_instance_count( ARG(T
) ) ;
437 optional
<T
> opt ( b
) ;
440 check_instance_count(count
, ARG(T
) );
442 check_value(opt
,b
,z
);
444 set_throw_on_assign( ARG(T
) ) ;
446 bool passed
= false ;
450 // Attempt to assign 'a' and throw.
451 // opt is kept initialized but its value not neccesarily fully assigned
452 // (in this test, incompletely assigned is flaged with the value -1 being set)
453 set_pending_assign( ARG(T
) ) ;
461 check_is_not_pending_assign( ARG(T
) );
462 check_instance_count(count
, ARG(T
) );
463 check_initialized(opt
);
464 check_value(opt
,x
,z
);
466 reset_throw_on_assign ( ARG(T
) ) ;
470 // Test Copy Initialization from an Initialized optional for a T with a throwing copy-ctor
473 void test_throwing_copy_initialization( T
const* )
475 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
482 int count
= get_instance_count( ARG(T
) ) ;
484 set_throw_on_copy( ARG(T
) ) ;
486 bool passed
= false ;
490 // Attempt to copy construct 'opt' and throw.
491 // opt1 won't be constructed.
492 set_pending_copy( ARG(T
) ) ;
493 optional
<T
> opt1
= opt
;
500 check_is_not_pending_copy( ARG(T
) );
501 check_instance_count(count
, ARG(T
) );
503 // Nothing should have happened to the source optional.
504 check_initialized(opt
);
505 check_value(opt
,a
,z
);
507 reset_throw_on_copy( ARG(T
) ) ;
511 // Test Assignment to an Uninitialized optional from an Initialized optional
512 // for a T with a throwing copy-ctor
515 void test_throwing_assign_to_uninitialized( T
const* )
517 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
523 optional
<T
> opt1(a
) ;
525 int count
= get_instance_count( ARG(T
) ) ;
527 set_throw_on_copy( ARG(T
) ) ;
529 bool passed
= false ;
533 // Attempt to copy construct 'opt1.value()' into opt0 and throw.
534 // opt0 should be left uninitialized.
535 set_pending_copy( ARG(T
) ) ;
543 check_is_not_pending_copy( ARG(T
) );
544 check_instance_count(count
, ARG(T
) );
545 check_uninitialized(opt0
);
547 reset_throw_on_copy( ARG(T
) ) ;
551 // Test Assignment to an Initialized optional from an Initialized optional
552 // for a T with a throwing copy-ctor
555 void test_throwing_assign_to_initialized( T
const* )
557 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
564 optional
<T
> opt0(a
) ;
565 optional
<T
> opt1(b
) ;
567 int count
= get_instance_count( ARG(T
) ) ;
569 set_throw_on_assign( ARG(T
) ) ;
571 bool passed
= false ;
575 // Attempt to copy construct 'opt1.value()' into opt0 and throw.
576 // opt0 is kept initialized but its value not neccesarily fully assigned
577 // (in this test, incompletely assigned is flaged with the value -1 being set)
578 set_pending_assign( ARG(T
) ) ;
586 // opt0 was left uninitialized
587 check_is_not_pending_assign( ARG(T
) );
588 check_instance_count(count
, ARG(T
) );
589 check_initialized(opt0
);
590 check_value(opt0
,x
,z
);
592 reset_throw_on_assign( ARG(T
) ) ;
596 // Test swap in a no-throwing case
599 void test_no_throwing_swap( T
const* )
601 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
609 optional
<T
> opt0(a
) ;
610 optional
<T
> opt1(b
) ;
612 int count
= get_instance_count( ARG(T
) ) ;
615 check_uninitialized(def0
);
616 check_uninitialized(def1
);
619 check_uninitialized(opt0
);
620 check_initialized(def0
);
621 check_value(def0
,a
,z
);
623 // restore def0 and opt0
627 check_instance_count(count
, ARG(T
) );
628 check_initialized(opt0
);
629 check_initialized(opt1
);
630 check_value(opt0
,b
,z
);
631 check_value(opt1
,a
,z
);
635 // Test swap in a throwing case
638 void test_throwing_swap( T
const* )
640 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
646 optional
<T
> opt0(a
) ;
647 optional
<T
> opt1(b
) ;
649 set_throw_on_assign( ARG(T
) ) ;
652 // Case 1: Both Initialized.
654 bool passed
= false ;
657 // This should attempt to swap optionals and fail at swap(X&,X&).
666 // optional's swap doesn't affect the initialized states of the arguments. Therefore,
667 // the following must hold:
668 check_initialized(opt0
);
669 check_initialized(opt1
);
670 check_value(opt0
,x
,a
);
671 check_value(opt1
,b
,x
);
675 // Case 2: Only one Initialized.
677 reset_throw_on_assign( ARG(T
) ) ;
682 set_throw_on_copy( ARG(T
) ) ;
687 // This should attempt to swap optionals and fail at opt0.reset(*opt1)
688 // Both opt0 and op1 are left unchanged (unswaped)
697 check_uninitialized(opt0
);
698 check_initialized(opt1
);
699 check_value(opt1
,a
,x
);
701 reset_throw_on_copy( ARG(T
) ) ;
705 // This verifies relational operators.
708 void test_relops( T
const* )
710 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
718 optional
<T
> opt0(v0
);
719 optional
<T
> opt1(v1
);
720 optional
<T
> opt2(v2
);
723 BOOST_TEST ( def0
== def0
) ;
724 BOOST_TEST ( opt0
== opt0
) ;
725 BOOST_TEST ( !(def0
!= def0
) ) ;
726 BOOST_TEST ( !(opt0
!= opt0
) ) ;
728 // Check when both are uininitalized.
729 BOOST_TEST ( def0
== def1
) ; // both uninitialized compare equal
730 BOOST_TEST ( !(def0
< def1
) ) ; // uninitialized is never less than uninitialized
731 BOOST_TEST ( !(def0
> def1
) ) ; // uninitialized is never greater than uninitialized
732 BOOST_TEST ( !(def0
!= def1
) ) ;
733 BOOST_TEST ( def0
<= def1
) ;
734 BOOST_TEST ( def0
>= def1
) ;
736 // Check when only lhs is uninitialized.
737 BOOST_TEST ( def0
!= opt0
) ; // uninitialized is never equal to initialized
738 BOOST_TEST ( !(def0
== opt0
) ) ;
739 BOOST_TEST ( def0
< opt0
) ; // uninitialized is always less than initialized
740 BOOST_TEST ( !(def0
> opt0
) ) ;
741 BOOST_TEST ( def0
<= opt0
) ;
742 BOOST_TEST ( !(def0
>= opt0
) ) ;
744 // Check when only rhs is uninitialized.
745 BOOST_TEST ( opt0
!= def0
) ; // initialized is never equal to uninitialized
746 BOOST_TEST ( !(opt0
== def0
) ) ;
747 BOOST_TEST ( !(opt0
< def0
) ) ; // initialized is never less than uninitialized
748 BOOST_TEST ( opt0
> def0
) ;
749 BOOST_TEST ( !(opt0
<= def0
) ) ;
750 BOOST_TEST ( opt0
>= opt0
) ;
752 // If both are initialized, values are compared
753 BOOST_TEST ( opt0
!= opt1
) ;
754 BOOST_TEST ( opt1
== opt2
) ;
755 BOOST_TEST ( opt0
< opt1
) ;
756 BOOST_TEST ( opt1
> opt0
) ;
757 BOOST_TEST ( opt1
<= opt2
) ;
758 BOOST_TEST ( opt1
>= opt0
) ;
760 // Compare against a value directly
761 BOOST_TEST ( opt0
== v0
) ;
762 BOOST_TEST ( opt0
!= v1
) ;
763 BOOST_TEST ( opt1
== v2
) ;
764 BOOST_TEST ( opt0
< v1
) ;
765 BOOST_TEST ( opt1
> v0
) ;
766 BOOST_TEST ( opt1
<= v2
) ;
767 BOOST_TEST ( opt1
>= v0
) ;
768 BOOST_TEST ( v0
!= opt1
) ;
769 BOOST_TEST ( v1
== opt2
) ;
770 BOOST_TEST ( v0
< opt1
) ;
771 BOOST_TEST ( v1
> opt0
) ;
772 BOOST_TEST ( v1
<= opt2
) ;
773 BOOST_TEST ( v1
>= opt0
) ;
774 BOOST_TEST ( def0
!= v0
) ;
775 BOOST_TEST ( !(def0
== v0
) ) ;
776 BOOST_TEST ( def0
< v0
) ;
777 BOOST_TEST ( !(def0
> v0
) ) ;
778 BOOST_TEST ( def0
<= v0
) ;
779 BOOST_TEST ( !(def0
>= v0
) ) ;
780 BOOST_TEST ( v0
!= def0
) ;
781 BOOST_TEST ( !(v0
== def0
) ) ;
782 BOOST_TEST ( !(v0
< def0
) ) ;
783 BOOST_TEST ( v0
> def0
) ;
784 BOOST_TEST ( !(v0
<= def0
) ) ;
785 BOOST_TEST ( v0
>= opt0
) ;
789 void test_none( T
const* )
791 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
796 optional
<T
> def1(none
) ;
797 optional
<T
> non_def( T(1234) ) ;
799 BOOST_TEST ( def0
== none
) ;
800 BOOST_TEST ( non_def
!= none
) ;
801 BOOST_TEST ( !def1
) ;
802 BOOST_TEST ( !(non_def
< none
) ) ;
803 BOOST_TEST ( non_def
> none
) ;
804 BOOST_TEST ( !(non_def
<= none
) ) ;
805 BOOST_TEST ( non_def
>= none
) ;
808 BOOST_TEST ( !non_def
) ;
810 test_default_implicit_construction(T(1),none
);
814 void test_arrow( T
const* )
816 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
821 optional
<T
> const coa(a
) ;
823 BOOST_TEST ( coa
->V() == 1234 ) ;
827 BOOST_TEST ( a
.V() = 1234 ) ;
828 BOOST_TEST ( (*oa
).V() = 4321 ) ;
831 void test_with_builtin_types()
833 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
835 test_basics( ARG(double) );
836 test_conditional_ctor_and_get_valur_or( ARG(double) );
837 test_uninitialized_access( ARG(double) );
838 test_no_throwing_swap( ARG(double) );
839 test_relops( ARG(double) ) ;
840 test_none( ARG(double) ) ;
843 // MSVC < 11.0 doesn't destroy X when we call ptr->VBase::VBase.
844 // Make sure that we work around this bug.
845 struct VBase
: virtual X
847 VBase(int v
) : X(v
) {}
848 // MSVC 8.0 doesn't generate this correctly...
849 VBase(const VBase
& other
) : X(static_cast<const X
&>(other
)) {}
852 void test_with_class_type()
854 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
856 test_basics( ARG(X
) );
857 test_basics( ARG(VBase
) );
858 test_conditional_ctor_and_get_valur_or( ARG(X
) );
859 test_direct_value_manip( ARG(X
) );
860 test_uninitialized_access( ARG(X
) );
861 test_throwing_direct_init( ARG(X
) );
862 test_throwing_val_assign_on_uninitialized( ARG(X
) );
863 test_throwing_val_assign_on_initialized( ARG(X
) );
864 test_throwing_copy_initialization( ARG(X
) );
865 test_throwing_assign_to_uninitialized( ARG(X
) );
866 test_throwing_assign_to_initialized( ARG(X
) );
867 test_no_throwing_swap( ARG(X
) );
868 test_throwing_swap( ARG(X
) );
869 test_relops( ARG(X
) ) ;
870 test_none( ARG(X
) ) ;
871 test_arrow( ARG(X
) ) ;
872 BOOST_TEST ( X::count
== 0 ) ;
875 int eat ( bool ) { return 1 ; }
876 int eat ( char ) { return 1 ; }
877 int eat ( int ) { return 1 ; }
878 int eat ( void const* ) { return 1 ; }
880 template<class T
> int eat ( T
) { return 0 ; }
883 // This verifies that operator safe_bool() behaves properly.
886 void test_no_implicit_conversions_impl( T
const& )
888 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
891 BOOST_TEST ( eat(def
) == 0 ) ;
894 void test_no_implicit_conversions()
896 TRACE( std::endl
<< BOOST_CURRENT_FUNCTION
);
903 test_no_implicit_conversions_impl(b
);
904 test_no_implicit_conversions_impl(c
);
905 test_no_implicit_conversions_impl(i
);
906 test_no_implicit_conversions_impl(p
);
910 // Test for support for classes with overridden operator&
911 class CustomAddressOfClass
916 CustomAddressOfClass() : n(0) {}
917 CustomAddressOfClass(CustomAddressOfClass
const& that
) : n(that
.n
) {}
918 explicit CustomAddressOfClass(int m
) : n(m
) {}
919 int* operator& () { return &n
; }
920 bool operator== (CustomAddressOfClass
const& that
) const { return n
== that
.n
; }
923 void test_custom_addressof_operator()
925 boost::optional
< CustomAddressOfClass
> o1(CustomAddressOfClass(10));
927 BOOST_TEST(o1
.get() == CustomAddressOfClass(10));
929 o1
= CustomAddressOfClass(20);
931 BOOST_TEST(o1
.get() == CustomAddressOfClass(20));
941 test_with_class_type();
942 test_with_builtin_types();
943 test_no_implicit_conversions();
944 test_custom_addressof_operator();
948 BOOST_ERROR("Unexpected Exception caught!");
951 return boost::report_errors();