ss_decl_name_matcher.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/lang/cplus/sem/ss_decl_name.g.hh>
00029 #include <lestes/lang/cplus/sem/ss_decl_name_matcher.g.hh>
00030 #include <lestes/lang/cplus/sem/ss_type_builtin.g.hh>
00031 #include <lestes/std/source_location.hh>
00032 
00033 package(lestes);
00034 package(lang);
00035 package(cplus);
00036 package(sem);
00037 
00038 int run_test()
00039 {
00040         ptr<source_location> l = source_location::create(file_info::create("",NULL),1,1);
00041         ptr<source_location> ll = source_location::create(file_info::create("",NULL),2,3);
00042 
00043         ptr<ss_decl_name> nvoid1 = ss_conversion_name::create( l, ss_void::instance() );
00044         ptr<ss_decl_name> nvoid2 = ss_conversion_name::create( ll, ss_void::instance() );
00045         ptr<ss_decl_name> nsint = ss_conversion_name::create( ll, ss_type_sint::instance() );
00046 
00047         ptr<ss_decl_name> dummy = ss_dummy_name::create( ll );
00048 
00049         ptr<ss_decl_name> ord1 = ss_ordinary_name::create( l, "name" );
00050         ptr<ss_decl_name> ord2 = ss_ordinary_name::create( ll, "name" );
00051         ptr<ss_decl_name> ordx = ss_ordinary_name::create( ll, "x" );
00052 
00053         ptr<ss_decl_name> nopbe1 = ss_operator_sbe::create( l );
00054         ptr<ss_decl_name> nopbe2 = ss_operator_sbe::create( ll );
00055         ptr<ss_decl_name> nopbg = ss_operator_sbg::create( ll );
00056 
00057         lassert( nvoid1->matches(nvoid2) );
00058         lassert( nvoid2->matches(nvoid1) );
00059         lassert( !nvoid1->matches(nsint) );
00060 
00061         lassert( !dummy->matches(dummy) );
00062 
00063         lassert( ord1->matches(ord2) );
00064         lassert( ord2->matches(ord1) );
00065         lassert( ordx->matches(ordx) );
00066         lassert( !ord1->matches(ordx) );
00067 
00068         lassert( nopbe1->matches(nopbe2) );
00069         lassert( nopbe2->matches(nopbe1) );
00070         lassert( !nopbe2->matches(nopbg) );
00071 
00072         lassert( !dummy->matches(nopbg) );
00073         lassert( !ord1->matches(nsint) );
00074         lassert( !nopbe1->matches(nvoid1) );
00075 
00076         return 0;
00077 }
00078 
00079 end_package(sem);
00080 end_package(cplus);
00081 end_package(lang);
00082 end_package(lestes);
00083 
00084 int main()
00085 {
00086         return ::lestes::lang::cplus::sem::run_test();
00087 }

Generated on Mon Feb 12 18:23:20 2007 for lestes by doxygen 1.5.1-20070107