00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <lestes/common.hh>
00036 #include <lestes/std/pair.hh>
00037 #include <utility>
00038
00039 using namespace ::lestes::std;
00040
00041 int main()
00042 {
00043 ptr< pair<int,int> > q0 = pair<int,int>::create( 3, 4 );
00044 ptr< pair<int,int> > x0 = pair<int,int>::create( 3, 4 );
00045 ptr< pair<int,int> > y0 = pair<int,int>::create( x0 );
00046 ptr< pair<int,int> > z0 = pair<int,int>::create( );
00047
00048 lassert(*q0 == *x0);
00049 lassert(*x0 == *q0);
00050 lassert(*y0 == *x0);
00051 lassert(*y0 != *z0);
00052
00053 ptr< pair< srp <object>, int > > q1 = pair< srp<object>, int >::create( NULL, 4 );
00054 ptr< pair< srp <object>, int > > x1 = pair< srp<object>, int >::create( NULL, 4 );
00055 ptr< pair< srp <object>, int > > y1 = pair< srp<object>, int >::create( x1 );
00056 ptr< pair< srp <object>, int > > z1 = pair< srp<object>, int >::create( );
00057
00058 lassert(*q1 == *x1);
00059 lassert(*x1 == *q1);
00060 lassert(*y1 == *x1);
00061 lassert(*y1 != *z1);
00062
00063 ptr< pair< int, srp<object> > > q2 = pair< int, srp<object> >::create( 3, NULL );
00064 ptr< pair< int, srp<object> > > x2 = pair< int, srp<object> >::create( 3, NULL );
00065 ptr< pair< int, srp<object> > > y2 = pair< int, srp<object> >::create( x2 );
00066 ptr< pair< int, srp<object> > > z2 = pair< int, srp<object> >::create( );
00067
00068 lassert(*q2 == *x2);
00069 lassert(*x2 == *q2);
00070 lassert(*y2 == *x2);
00071 lassert(*y2 != *z2);
00072
00073 ptr< pair< srp<object>, srp<object> > > r3 = pair< srp<object>, srp <object> >::create( x0, x1 );
00074 ptr< pair< srp<object>, srp<object> > > q3 = pair< srp<object>, srp <object> >::create( NULL, NULL );
00075 ptr< pair< srp<object>, srp<object> > > x3 = pair< srp<object>, srp <object> >::create( NULL, NULL );
00076 ptr< pair< srp<object>, srp<object> > > y3 = pair< srp<object>, srp <object> >::create( x3 );
00077 ptr< pair< srp<object>, srp<object> > > z3 = pair< srp<object>, srp <object> >::create( );
00078
00079 lassert(*q3 == *x3);
00080 lassert(*x3 == *q3);
00081 lassert(*y3 == *x3);
00082 lassert(*y3 == *z3);
00083
00084 lassert(*r3 != *q3);
00085
00086
00087
00088
00089
00090 ptr< pair<int,int> > m1 = pair<int,int>::create( ::std::make_pair(2,3) );
00091 ptr< pair< srp<object>, int > > m2 = pair< srp<object>, int >::create( ::std::make_pair(m1,3) );
00092 ptr< pair< int, srp<object> > > m3 = pair< int, srp<object> >::create( ::std::make_pair(2,m1) );
00093 ptr< pair< srp<object>, srp<object> > > m4 = pair< srp<object>, srp<object> >::create( ::std::make_pair(m2,m3) );
00094
00095
00096 return 0;
00097 }