1 /** @file api_generated.cc 2 * @brief test common features of API classes 3 */ 4 /* Warning: This file is generated by ./generate-api_generated - do not modify directly! */ 5 /* Copyright (C) 2007,2009 Olly Betts 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 22 #include <config.h> 23 24 #include "api_generated.h" 25 26 #include <xapian.h> 27 28 #include "apitest.h" 29 #include "testutils.h" 30 31 using namespace std; 32 33 /// Check uncopyable API classes which should have a default ctor actually do. 34 DEFINE_TESTCASE(defaultctor1, !backend) { 35 Xapian::BM25Weight bm25weight; 36 Xapian::BoolWeight boolweight; 37 Xapian::DecreasingValueWeightPostingSource decreasingvalueweightpostingsource(0); 38 (void)decreasingvalueweightpostingsource.get_description(); 39 Xapian::FixedWeightPostingSource fixedweightpostingsource(0); 40 (void)fixedweightpostingsource.get_description(); 41 Xapian::TradWeight tradweight; 42 Xapian::ValueCountMatchSpy valuecountmatchspy(0); 43 (void)valuecountmatchspy.get_description(); 44 Xapian::ValueMapPostingSource valuemappostingsource(0); 45 (void)valuemappostingsource.get_description(); 46 Xapian::ValuePostingSource valuepostingsource(0); 47 (void)valuepostingsource.get_description(); 48 Xapian::ValueWeightPostingSource valueweightpostingsource(0); 49 (void)valueweightpostingsource.get_description(); 50 return true; 51 } 52 53 /// Test that API classes have a copy ctor and assignment operator. 54 DEFINE_TESTCASE(copyassign1, !backend) { 55 Xapian::Database database; 56 (void)database.get_description(); 57 Xapian::Database copy_database(database); 58 database = copy_database; 59 60 Xapian::DateValueRangeProcessor datevaluerangeprocessor(0); 61 Xapian::DateValueRangeProcessor copy_datevaluerangeprocessor(datevaluerangeprocessor); 62 datevaluerangeprocessor = copy_datevaluerangeprocessor; 63 64 Xapian::Document document; 65 (void)document.get_description(); 66 Xapian::Document copy_document(document); 67 document = copy_document; 68 69 Xapian::ESet eset; 70 (void)eset.get_description(); 71 Xapian::ESet copy_eset(eset); 72 eset = copy_eset; 73 74 Xapian::ESetIterator esetiterator; 75 (void)esetiterator.get_description(); 76 Xapian::ESetIterator copy_esetiterator(esetiterator); 77 esetiterator = copy_esetiterator; 78 79 #ifdef XAPIAN_HAS_INMEMORY_BACKEND 80 Xapian::Enquire enquire(Xapian::InMemory::open()); 81 (void)enquire.get_description(); 82 Xapian::Enquire copy_enquire(enquire); 83 enquire = copy_enquire; 84 #endif 85 86 Xapian::MSet mset; 87 (void)mset.get_description(); 88 Xapian::MSet copy_mset(mset); 89 mset = copy_mset; 90 91 Xapian::MSetIterator msetiterator; 92 (void)msetiterator.get_description(); 93 Xapian::MSetIterator copy_msetiterator(msetiterator); 94 msetiterator = copy_msetiterator; 95 96 Xapian::MultiValueKeyMaker multivaluekeymaker; 97 Xapian::MultiValueKeyMaker copy_multivaluekeymaker(multivaluekeymaker); 98 multivaluekeymaker = copy_multivaluekeymaker; 99 100 Xapian::NumberValueRangeProcessor numbervaluerangeprocessor(0, ""); 101 Xapian::NumberValueRangeProcessor copy_numbervaluerangeprocessor(numbervaluerangeprocessor); 102 numbervaluerangeprocessor = copy_numbervaluerangeprocessor; 103 104 Xapian::PositionIterator positioniterator; 105 (void)positioniterator.get_description(); 106 Xapian::PositionIterator copy_positioniterator(positioniterator); 107 positioniterator = copy_positioniterator; 108 109 Xapian::PostingIterator postingiterator; 110 (void)postingiterator.get_description(); 111 Xapian::PostingIterator copy_postingiterator(postingiterator); 112 postingiterator = copy_postingiterator; 113 114 Xapian::Query query; 115 (void)query.get_description(); 116 Xapian::Query copy_query(query); 117 query = copy_query; 118 119 Xapian::QueryParser queryparser; 120 (void)queryparser.get_description(); 121 Xapian::QueryParser copy_queryparser(queryparser); 122 queryparser = copy_queryparser; 123 124 Xapian::RSet rset; 125 (void)rset.get_description(); 126 Xapian::RSet copy_rset(rset); 127 rset = copy_rset; 128 129 Xapian::Registry registry; 130 Xapian::Registry copy_registry(registry); 131 registry = copy_registry; 132 133 Xapian::SimpleStopper simplestopper; 134 (void)simplestopper.get_description(); 135 Xapian::SimpleStopper copy_simplestopper(simplestopper); 136 simplestopper = copy_simplestopper; 137 138 Xapian::Stem stem; 139 (void)stem.get_description(); 140 Xapian::Stem copy_stem(stem); 141 stem = copy_stem; 142 143 Xapian::StringValueRangeProcessor stringvaluerangeprocessor(0); 144 Xapian::StringValueRangeProcessor copy_stringvaluerangeprocessor(stringvaluerangeprocessor); 145 stringvaluerangeprocessor = copy_stringvaluerangeprocessor; 146 147 Xapian::TermGenerator termgenerator; 148 (void)termgenerator.get_description(); 149 Xapian::TermGenerator copy_termgenerator(termgenerator); 150 termgenerator = copy_termgenerator; 151 152 Xapian::TermIterator termiterator; 153 (void)termiterator.get_description(); 154 Xapian::TermIterator copy_termiterator(termiterator); 155 termiterator = copy_termiterator; 156 157 Xapian::ValueIterator valueiterator; 158 (void)valueiterator.get_description(); 159 Xapian::ValueIterator copy_valueiterator(valueiterator); 160 valueiterator = copy_valueiterator; 161 162 Xapian::WritableDatabase writabledatabase; 163 (void)writabledatabase.get_description(); 164 Xapian::WritableDatabase copy_writabledatabase(writabledatabase); 165 writabledatabase = copy_writabledatabase; 166 167 return true; 168 } 169