map.test.cc

Go to the documentation of this file.
00001 /*
00002    The lestes compiler suite
00003    Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
00004    Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
00005    Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
00006    Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
00007    Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
00008    Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
00009    Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; version 2 of the License.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    See the full text of the GNU General Public License version 2, and
00021    the limitations in the file doc/LICENSE.
00022 
00023    By accepting the license the licensee waives any and all claims
00024    against the copyright holder(s) related in whole or in part to the
00025    work, its use, and/or the inability to use it.
00026  
00027  */
00028 #include <lestes/common.hh>
00029 #include <lestes/std/map.hh>
00030 
00031 package(lestes);
00032 package(std);
00033 
00034 struct integer : object { int value; };
00035 
00036 typedef map< int,		int		> map_ii;
00037 typedef map< srp<integer>,      int             > map_pi;
00038 typedef map< int,		srp<integer> > map_ip;
00039 typedef map< srp<integer>,      srp<integer>    > map_pp;
00040 
00041 int map_test()
00042 {
00043         ptr<map_ii> mii1 = map_ii::create();
00044         mii1->insert( map_ii::value_type( 0, 1 ) );
00045         mii1->insert( map_ii::value_type( 1, 2 ) );
00046         ptr<map_ii> mii2 = map_ii::create();
00047         mii2->insert( map_ii::value_type( 0, 1 ) );
00048         mii2->insert( map_ii::value_type( 1, 2 ) );
00049         lassert( *mii1 == *mii2 );
00050         mii2->insert( map_ii::value_type( 2, 3 ) );
00051         lassert( *mii1 != *mii2 );
00052         ptr<map_ii> mii3 = map_ii::create(mii2);
00053         lassert( *mii3 == *mii2 );
00054 
00055         ptr<map_pi> mpi1 = map_pi::create();
00056         ptr<map_ip> mip1 = map_ip::create();
00057         ptr<map_pp> mpp1 = map_pp::create();
00058         return 0;
00059 }
00060 
00061 end_package(std);
00062 end_package(lestes);
00063 
00064 extern "C"
00065 int main()
00066 {
00067         return lestes::std::map_test();
00068 }

Generated on Mon Feb 12 18:22:40 2007 for lestes by doxygen 1.5.1-20070107