1 /** @file 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,2012,2014,2015,2016,2018 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 #define XAPIAN_DEPRECATED(D) D 27 #include <xapian.h> 28 29 #include "apitest.h" 30 #include "testutils.h" 31 32 using namespace std; 33 34 /// Check uncopyable API classes which should have a default ctor actually do. 35 DEFINE_TESTCASE(defaultctor1, !backend) { 36 Xapian::BB2Weight bb2weight; 37 Xapian::BM25Weight bm25weight; 38 Xapian::BoolWeight boolweight; 39 Xapian::DLHWeight dlhweight; 40 Xapian::DateRangeProcessor daterangeprocessor(0); 41 Xapian::DateValueRangeProcessor datevaluerangeprocessor(0); 42 Xapian::DecreasingValueWeightPostingSource decreasingvalueweightpostingsource(0); 43 TEST(!decreasingvalueweightpostingsource.get_description().empty()); 44 Xapian::FixedWeightPostingSource fixedweightpostingsource(0); 45 TEST(!fixedweightpostingsource.get_description().empty()); 46 Xapian::IfB2Weight ifb2weight; 47 Xapian::InL2Weight inl2weight; 48 Xapian::IneB2Weight ineb2weight; 49 Xapian::MultiValueKeyMaker multivaluekeymaker; 50 Xapian::NumberRangeProcessor numberrangeprocessor(0, ""); 51 Xapian::NumberValueRangeProcessor numbervaluerangeprocessor(0, ""); 52 Xapian::RangeProcessor rangeprocessor; 53 Xapian::SimpleStopper simplestopper; 54 TEST(!simplestopper.get_description().empty()); 55 Xapian::StringValueRangeProcessor stringvaluerangeprocessor(0); 56 Xapian::TfIdfWeight tfidfweight; 57 Xapian::TradWeight tradweight; 58 Xapian::ValueCountMatchSpy valuecountmatchspy(0); 59 TEST(!valuecountmatchspy.get_description().empty()); 60 Xapian::ValueMapPostingSource valuemappostingsource(0); 61 TEST(!valuemappostingsource.get_description().empty()); 62 Xapian::ValuePostingSource valuepostingsource(0); 63 TEST(!valuepostingsource.get_description().empty()); 64 Xapian::ValueWeightPostingSource valueweightpostingsource(0); 65 TEST(!valueweightpostingsource.get_description().empty()); 66 } 67 68 /// Test that API classes have a copy ctor and assignment operator. 69 DEFINE_TESTCASE(copyassign1, !backend) { 70 Xapian::Database database; 71 TEST(!database.get_description().empty()); 72 Xapian::Database copy_database(database); 73 TEST(!copy_database.get_description().empty()); 74 Xapian::Database move_database(std::move(database)); 75 TEST(!move_database.get_description().empty()); 76 database = copy_database; 77 TEST(!database.get_description().empty()); 78 copy_database = std::move(move_database); 79 TEST(!copy_database.get_description().empty()); 80 81 Xapian::Document document; 82 TEST(!document.get_description().empty()); 83 Xapian::Document copy_document(document); 84 TEST(!copy_document.get_description().empty()); 85 Xapian::Document move_document(std::move(document)); 86 TEST(!move_document.get_description().empty()); 87 document = copy_document; 88 TEST(!document.get_description().empty()); 89 copy_document = std::move(move_document); 90 TEST(!copy_document.get_description().empty()); 91 92 Xapian::ESet eset; 93 TEST(!eset.get_description().empty()); 94 Xapian::ESet copy_eset(eset); 95 TEST(!copy_eset.get_description().empty()); 96 Xapian::ESet move_eset(std::move(eset)); 97 TEST(!move_eset.get_description().empty()); 98 eset = copy_eset; 99 TEST(!eset.get_description().empty()); 100 copy_eset = std::move(move_eset); 101 TEST(!copy_eset.get_description().empty()); 102 103 Xapian::ESetIterator esetiterator; 104 TEST(!esetiterator.get_description().empty()); 105 Xapian::ESetIterator copy_esetiterator(esetiterator); 106 TEST(!copy_esetiterator.get_description().empty()); 107 Xapian::ESetIterator move_esetiterator(std::move(esetiterator)); 108 TEST(!move_esetiterator.get_description().empty()); 109 esetiterator = copy_esetiterator; 110 TEST(!esetiterator.get_description().empty()); 111 copy_esetiterator = std::move(move_esetiterator); 112 TEST(!copy_esetiterator.get_description().empty()); 113 114 #ifdef XAPIAN_HAS_INMEMORY_BACKEND 115 Xapian::Enquire enquire(Xapian::Database(std::string(), Xapian::DB_BACKEND_INMEMORY)); 116 TEST(!enquire.get_description().empty()); 117 Xapian::Enquire copy_enquire(enquire); 118 TEST(!copy_enquire.get_description().empty()); 119 Xapian::Enquire move_enquire(std::move(enquire)); 120 TEST(!move_enquire.get_description().empty()); 121 enquire = copy_enquire; 122 TEST(!enquire.get_description().empty()); 123 copy_enquire = std::move(move_enquire); 124 TEST(!copy_enquire.get_description().empty()); 125 #endif 126 127 Xapian::MSet mset; 128 TEST(!mset.get_description().empty()); 129 Xapian::MSet copy_mset(mset); 130 TEST(!copy_mset.get_description().empty()); 131 Xapian::MSet move_mset(std::move(mset)); 132 TEST(!move_mset.get_description().empty()); 133 mset = copy_mset; 134 TEST(!mset.get_description().empty()); 135 copy_mset = std::move(move_mset); 136 TEST(!copy_mset.get_description().empty()); 137 138 Xapian::MSetIterator msetiterator; 139 TEST(!msetiterator.get_description().empty()); 140 Xapian::MSetIterator copy_msetiterator(msetiterator); 141 TEST(!copy_msetiterator.get_description().empty()); 142 Xapian::MSetIterator move_msetiterator(std::move(msetiterator)); 143 TEST(!move_msetiterator.get_description().empty()); 144 msetiterator = copy_msetiterator; 145 TEST(!msetiterator.get_description().empty()); 146 copy_msetiterator = std::move(move_msetiterator); 147 TEST(!copy_msetiterator.get_description().empty()); 148 149 Xapian::PositionIterator positioniterator; 150 TEST(!positioniterator.get_description().empty()); 151 Xapian::PositionIterator copy_positioniterator(positioniterator); 152 TEST(!copy_positioniterator.get_description().empty()); 153 Xapian::PositionIterator move_positioniterator(std::move(positioniterator)); 154 TEST(!move_positioniterator.get_description().empty()); 155 positioniterator = copy_positioniterator; 156 TEST(!positioniterator.get_description().empty()); 157 copy_positioniterator = std::move(move_positioniterator); 158 TEST(!copy_positioniterator.get_description().empty()); 159 160 Xapian::PostingIterator postingiterator; 161 TEST(!postingiterator.get_description().empty()); 162 Xapian::PostingIterator copy_postingiterator(postingiterator); 163 TEST(!copy_postingiterator.get_description().empty()); 164 Xapian::PostingIterator move_postingiterator(std::move(postingiterator)); 165 TEST(!move_postingiterator.get_description().empty()); 166 postingiterator = copy_postingiterator; 167 TEST(!postingiterator.get_description().empty()); 168 copy_postingiterator = std::move(move_postingiterator); 169 TEST(!copy_postingiterator.get_description().empty()); 170 171 Xapian::Query query; 172 TEST(!query.get_description().empty()); 173 Xapian::Query copy_query(query); 174 TEST(!copy_query.get_description().empty()); 175 Xapian::Query move_query(std::move(query)); 176 TEST(!move_query.get_description().empty()); 177 query = copy_query; 178 TEST(!query.get_description().empty()); 179 copy_query = std::move(move_query); 180 TEST(!copy_query.get_description().empty()); 181 182 Xapian::QueryParser queryparser; 183 TEST(!queryparser.get_description().empty()); 184 Xapian::QueryParser copy_queryparser(queryparser); 185 TEST(!copy_queryparser.get_description().empty()); 186 Xapian::QueryParser move_queryparser(std::move(queryparser)); 187 TEST(!move_queryparser.get_description().empty()); 188 queryparser = copy_queryparser; 189 TEST(!queryparser.get_description().empty()); 190 copy_queryparser = std::move(move_queryparser); 191 TEST(!copy_queryparser.get_description().empty()); 192 193 Xapian::RSet rset; 194 TEST(!rset.get_description().empty()); 195 Xapian::RSet copy_rset(rset); 196 TEST(!copy_rset.get_description().empty()); 197 Xapian::RSet move_rset(std::move(rset)); 198 TEST(!move_rset.get_description().empty()); 199 rset = copy_rset; 200 TEST(!rset.get_description().empty()); 201 copy_rset = std::move(move_rset); 202 TEST(!copy_rset.get_description().empty()); 203 204 Xapian::Registry registry; 205 Xapian::Registry copy_registry(registry); 206 Xapian::Registry move_registry(std::move(registry)); 207 registry = copy_registry; 208 copy_registry = std::move(move_registry); 209 210 Xapian::Stem stem; 211 TEST(!stem.get_description().empty()); 212 Xapian::Stem copy_stem(stem); 213 TEST(!copy_stem.get_description().empty()); 214 Xapian::Stem move_stem(std::move(stem)); 215 TEST(!move_stem.get_description().empty()); 216 stem = copy_stem; 217 TEST(!stem.get_description().empty()); 218 copy_stem = std::move(move_stem); 219 TEST(!copy_stem.get_description().empty()); 220 221 Xapian::TermGenerator termgenerator; 222 TEST(!termgenerator.get_description().empty()); 223 Xapian::TermGenerator copy_termgenerator(termgenerator); 224 TEST(!copy_termgenerator.get_description().empty()); 225 Xapian::TermGenerator move_termgenerator(std::move(termgenerator)); 226 TEST(!move_termgenerator.get_description().empty()); 227 termgenerator = copy_termgenerator; 228 TEST(!termgenerator.get_description().empty()); 229 copy_termgenerator = std::move(move_termgenerator); 230 TEST(!copy_termgenerator.get_description().empty()); 231 232 Xapian::TermIterator termiterator; 233 TEST(!termiterator.get_description().empty()); 234 Xapian::TermIterator copy_termiterator(termiterator); 235 TEST(!copy_termiterator.get_description().empty()); 236 Xapian::TermIterator move_termiterator(std::move(termiterator)); 237 TEST(!move_termiterator.get_description().empty()); 238 termiterator = copy_termiterator; 239 TEST(!termiterator.get_description().empty()); 240 copy_termiterator = std::move(move_termiterator); 241 TEST(!copy_termiterator.get_description().empty()); 242 243 Xapian::ValueIterator valueiterator; 244 TEST(!valueiterator.get_description().empty()); 245 Xapian::ValueIterator copy_valueiterator(valueiterator); 246 TEST(!copy_valueiterator.get_description().empty()); 247 Xapian::ValueIterator move_valueiterator(std::move(valueiterator)); 248 TEST(!move_valueiterator.get_description().empty()); 249 valueiterator = copy_valueiterator; 250 TEST(!valueiterator.get_description().empty()); 251 copy_valueiterator = std::move(move_valueiterator); 252 TEST(!copy_valueiterator.get_description().empty()); 253 254 Xapian::WritableDatabase writabledatabase; 255 TEST(!writabledatabase.get_description().empty()); 256 Xapian::WritableDatabase copy_writabledatabase(writabledatabase); 257 TEST(!copy_writabledatabase.get_description().empty()); 258 Xapian::WritableDatabase move_writabledatabase(std::move(writabledatabase)); 259 TEST(!move_writabledatabase.get_description().empty()); 260 writabledatabase = copy_writabledatabase; 261 TEST(!writabledatabase.get_description().empty()); 262 copy_writabledatabase = std::move(move_writabledatabase); 263 TEST(!copy_writabledatabase.get_description().empty()); 264 265 } 266