libept
0.5.25
|
00001 /* 00002 * Copyright (C) 2005,2007 Enrico Zini <enrico@debian.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00019 #if 0 00020 #include <ept/tests/test-utils.h> 00021 #include <ept/debtags/tag.h> 00022 #include <ept/debtags/vocabulary.h> 00023 #include <ept/debtags/maint/path.h> 00024 00025 #include <tagcoll/utils/set.h> 00026 00027 using namespace std; 00028 using namespace ept::debtags; 00029 00030 namespace tut { 00031 00032 struct ept_debtags_tag_shar 00033 { 00034 Path::OverrideDebtagsSourceDir odsd; 00035 Path::OverrideDebtagsIndexDir odid; 00036 Path::OverrideDebtagsUserSourceDir odusd; 00037 Path::OverrideDebtagsUserIndexDir oduid; 00038 Vocabulary voc; 00039 00040 ept_debtags_tag_shar() 00041 : odsd("./"), odid("./"), odusd("./"), oduid("./") {} 00042 }; 00043 00044 TESTGRP( ept_debtags_tag ); 00045 00046 template<> template<> 00047 void to::test<1>() 00048 { 00049 Tag a, b; 00050 ensure( a == b ); 00051 ensure( !a.valid() ); 00052 ensure( !b.valid() ); 00053 } 00054 00055 template<> template<> 00056 void to::test<2>() 00057 { 00058 Tag a; 00059 int x = 1; 00060 try { 00061 a.shortDescription(); 00062 x = 2; 00063 } catch (...) { 00064 x = 3; 00065 } 00066 ensure_equals( x, 3 ); 00067 } 00068 00069 template<> template<> 00070 void to::test< 3 >() 00071 { 00072 Facet f = voc.facetByName( "works-with" ); 00073 Tag t = voc.tagByName( "works-with::people" ); 00074 ensure( t.valid() ); 00075 ensure( f.valid() ); 00076 ensure( t.facet() == f ); 00077 ensure( tagcoll::utils::set_contains(f.tags(), t) ); 00078 } 00079 00080 template<> template<> 00081 void to::test< 4 >() 00082 { 00083 Facet f = voc.facetByName( "works-with" ); 00084 Tag t = voc.tagByName( "works-with::people" ); 00085 ensure( t.valid() ); 00086 ensure( f.valid() ); 00087 ensure( f.hasTag( t.name() ) ); 00088 } 00089 00090 template<> template<> 00091 void to::test< 5 >() 00092 { 00093 Tag t = voc.tagByName( "works-with::people" ); 00094 ensure( t.valid() ); 00095 ensure( t.facet().hasTag( t.name() ) ); 00096 ensure( tagcoll::utils::set_contains(t.facet().tags(), t) ); 00097 } 00098 00099 } 00100 00101 /* 00102 #include <ept/cache/tag.tcc> 00103 #include <ept/cache/debtags/vocabulary.tcc> 00104 */ 00105 00106 // vim:set ts=3 sw=3: 00107 #endif