libept
tag.test.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005,2007 Enrico Zini <enrico@debian.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */
18 
19 #if 0
20 #include <ept/tests/test-utils.h>
21 #include <ept/debtags/tag.h>
22 #include <ept/debtags/vocabulary.h>
23 #include <ept/debtags/maint/path.h>
24 
25 #include <tagcoll/utils/set.h>
26 
27 using namespace std;
28 using namespace ept::debtags;
29 
30 namespace tut {
31 
32 struct ept_debtags_tag_shar
33 {
38  Vocabulary voc;
39 
40  ept_debtags_tag_shar()
41  : odsd("./"), odid("./"), odusd("./"), oduid("./") {}
42 };
43 
44 TESTGRP( ept_debtags_tag );
45 
46 template<> template<>
47 void to::test<1>()
48 {
49  Tag a, b;
50  ensure( a == b );
51  ensure( !a.valid() );
52  ensure( !b.valid() );
53 }
54 
55 template<> template<>
56 void to::test<2>()
57 {
58  Tag a;
59  int x = 1;
60  try {
61  a.shortDescription();
62  x = 2;
63  } catch (...) {
64  x = 3;
65  }
66  ensure_equals( x, 3 );
67 }
68 
69 template<> template<>
70 void to::test< 3 >()
71 {
72  Facet f = voc.facetByName( "works-with" );
73  Tag t = voc.tagByName( "works-with::people" );
74  ensure( t.valid() );
75  ensure( f.valid() );
76  ensure( t.facet() == f );
77  ensure( tagcoll::utils::set_contains(f.tags(), t) );
78 }
79 
80 template<> template<>
81 void to::test< 4 >()
82 {
83  Facet f = voc.facetByName( "works-with" );
84  Tag t = voc.tagByName( "works-with::people" );
85  ensure( t.valid() );
86  ensure( f.valid() );
87  ensure( f.hasTag( t.name() ) );
88 }
89 
90 template<> template<>
91 void to::test< 5 >()
92 {
93  Tag t = voc.tagByName( "works-with::people" );
94  ensure( t.valid() );
95  ensure( t.facet().hasTag( t.name() ) );
96  ensure( tagcoll::utils::set_contains(t.facet().tags(), t) );
97 }
98 
99 }
100 
101 /*
102 #include <ept/cache/tag.tcc>
103 #include <ept/cache/debtags/vocabulary.tcc>
104 */
105 
106 // vim:set ts=3 sw=3:
107 #endif