LCOV - code coverage report
Current view: top level - tests - api_nodb.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 954b5873a738 Lines: 349 350 99.7 %
Date: 2019-06-30 05:20:33 Functions: 22 22 100.0 %
Branches: 602 3652 16.5 %

           Branch data     Line data    Source code
       1                 :            : /** @file api_nodb.cc
       2                 :            :  * @brief tests which don't use any of the backends
       3                 :            :  */
       4                 :            : /* Copyright 1999,2000,2001 BrightStation PLC
       5                 :            :  * Copyright 2002 Ananova Ltd
       6                 :            :  * Copyright 2002,2003,2004,2005,2006,2007,2008,2009,2010,2015,2016,2017 Olly Betts
       7                 :            :  * Copyright 2006 Lemur Consulting Ltd
       8                 :            :  * Copyright (C) 2016 Vivek Pal
       9                 :            :  *
      10                 :            :  * This program is free software; you can redistribute it and/or
      11                 :            :  * modify it under the terms of the GNU General Public License as
      12                 :            :  * published by the Free Software Foundation; either version 2 of the
      13                 :            :  * License, or (at your option) any later version.
      14                 :            :  *
      15                 :            :  * This program is distributed in the hope that it will be useful,
      16                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      17                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      18                 :            :  * GNU General Public License for more details.
      19                 :            :  *
      20                 :            :  * You should have received a copy of the GNU General Public License
      21                 :            :  * along with this program; if not, write to the Free Software
      22                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
      23                 :            :  * USA
      24                 :            :  */
      25                 :            : 
      26                 :            : #include <config.h>
      27                 :            : 
      28                 :            : #include "api_nodb.h"
      29                 :            : 
      30                 :            : #include <xapian.h>
      31                 :            : 
      32                 :            : #include "apitest.h"
      33                 :            : #include "testsuite.h"
      34                 :            : #include "testutils.h"
      35                 :            : 
      36                 :            : #include <list>
      37                 :            : #include <string>
      38                 :            : #include <vector>
      39                 :            : 
      40                 :            : using namespace std;
      41                 :            : 
      42                 :            : // always succeeds
      43                 :          1 : DEFINE_TESTCASE(trivial1, !backend) {
      44                 :          1 :     return true;
      45                 :            : }
      46                 :            : 
      47                 :            : // tests that get_query_terms() returns the terms in the right order
      48                 :          1 : DEFINE_TESTCASE(getqterms1, !backend) {
      49                 :          1 :     list<string> answers_list;
      50 [ +  - ][ +  - ]:          1 :     answers_list.push_back("one");
      51 [ +  - ][ +  - ]:          1 :     answers_list.push_back("two");
      52 [ +  - ][ +  - ]:          1 :     answers_list.push_back("three");
      53 [ +  - ][ +  - ]:          1 :     answers_list.push_back("four");
      54                 :            : 
      55                 :            :     Xapian::Query myquery(Xapian::Query::OP_OR,
      56                 :            :             Xapian::Query(Xapian::Query::OP_AND,
      57                 :            :                     Xapian::Query("one", 1, 1),
      58                 :            :                     Xapian::Query("three", 1, 3)),
      59                 :            :             Xapian::Query(Xapian::Query::OP_OR,
      60                 :            :                     Xapian::Query("four", 1, 4),
      61 [ +  - ][ +  - ]:          2 :                     Xapian::Query("two", 1, 2)));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      62                 :            : 
      63                 :          2 :     list<string> list1;
      64                 :            :     {
      65                 :          1 :         Xapian::TermIterator t;
      66 [ +  - ][ +  - ]:          5 :         for (t = myquery.get_terms_begin(); t != myquery.get_terms_end(); ++t)
         [ +  - ][ +  + ]
      67 [ +  - ][ +  - ]:          5 :             list1.push_back(*t);
      68                 :            :     }
      69 [ +  - ][ -  + ]:          1 :     TEST(list1 == answers_list);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      70 [ +  - ][ +  - ]:          2 :     list<string> list2(myquery.get_terms_begin(), myquery.get_terms_end());
      71 [ +  - ][ -  + ]:          1 :     TEST(list2 == answers_list);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      72                 :          1 :     return true;
      73                 :            : }
      74                 :            : 
      75                 :            : // tests that get_query_terms() doesn't SEGV on an empty query
      76                 :            : // (regression test for bug in 0.9.0)
      77                 :          1 : DEFINE_TESTCASE(getqterms2, !backend) {
      78                 :          1 :     Xapian::Query empty_query;
      79 [ +  - ][ -  + ]:          1 :     TEST_EQUAL(empty_query.get_terms_begin(), empty_query.get_terms_end());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      80                 :          1 :     return true;
      81                 :            : }
      82                 :            : 
      83                 :            : // tests that empty queries work correctly
      84                 :          1 : DEFINE_TESTCASE(emptyquery2, !backend) {
      85                 :            :     // test that Query::empty() is true for an empty query.
      86 [ -  + ][ #  # ]:          1 :     TEST(Xapian::Query().empty());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      87                 :            :     // test that an empty query has length 0
      88 [ -  + ][ #  # ]:          1 :     TEST(Xapian::Query().get_length() == 0);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      89                 :          1 :     vector<Xapian::Query> v;
      90 [ +  - ][ -  + ]:          1 :     TEST(Xapian::Query(Xapian::Query::OP_OR, v.begin(), v.end()).empty());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      91 [ +  - ][ -  + ]:          1 :     TEST(Xapian::Query(Xapian::Query::OP_OR, v.begin(), v.end()).get_length() == 0);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
      92                 :          1 :     return true;
      93                 :            : }
      94                 :            : 
      95                 :            : /// Regression test for behaviour for an empty query with AND_NOT.
      96                 :          1 : DEFINE_TESTCASE(emptyquery3, !backend) {
      97                 :            :     static const Xapian::Query::op ops[] = {
      98                 :            :         Xapian::Query::OP_AND,
      99                 :            :         Xapian::Query::OP_OR,
     100                 :            :         Xapian::Query::OP_XOR,
     101                 :            :         Xapian::Query::OP_AND_MAYBE,
     102                 :            :         Xapian::Query::OP_AND_NOT
     103                 :            :     };
     104                 :            : 
     105         [ +  + ]:          6 :     for (size_t i = 0; i < sizeof(ops) / sizeof(ops[0]); ++i) {
     106 [ +  - ][ +  - ]:          5 :         tout << "Testing op #" << i << endl;
                 [ +  - ]
     107                 :          5 :         Xapian::Query empty;
     108 [ +  - ][ +  - ]:         10 :         Xapian::Query q("test");
     109         [ +  - ]:         10 :         Xapian::Query qcombine(ops[i], empty, q);
     110 [ +  - ][ +  - ]:          5 :         tout << qcombine.get_description() << endl;
                 [ +  - ]
     111         [ +  - ]:         10 :         Xapian::Query qcombine2(ops[i], q, empty);
     112 [ +  - ][ +  - ]:          5 :         tout << qcombine2.get_description() << endl;
                 [ +  - ]
     113         [ +  - ]:         10 :         Xapian::Query qcombine3(ops[i], empty, empty);
     114 [ +  - ][ +  - ]:          5 :         tout << qcombine3.get_description() << endl;
                 [ +  - ]
     115                 :          5 :     }
     116                 :            : 
     117                 :          1 :     return true;
     118                 :            : }
     119                 :            : 
     120                 :            : // tests that query lengths are calculated correctly
     121                 :          1 : DEFINE_TESTCASE(querylen1, !backend) {
     122                 :            :     // test that a simple query has the right length
     123                 :          1 :     Xapian::Query myquery;
     124 [ +  - ][ +  - ]:          2 :     myquery = Xapian::Query(Xapian::Query::OP_OR,
         [ +  - ][ +  - ]
                 [ +  - ]
     125                 :            :                       Xapian::Query("foo"),
     126         [ +  - ]:          1 :                       Xapian::Query("bar"));
     127 [ +  - ][ +  - ]:          2 :     myquery = Xapian::Query(Xapian::Query::OP_AND,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     128                 :            :                       myquery,
     129                 :            :                       Xapian::Query(Xapian::Query::OP_OR,
     130                 :            :                               Xapian::Query("wibble"),
     131         [ +  - ]:          1 :                               Xapian::Query("spoon")));
     132                 :            : 
     133 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(myquery.get_length(), 4);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     134 [ -  + ][ #  # ]:          1 :     TEST(!myquery.empty());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     135                 :          1 :     return true;
     136                 :            : }
     137                 :            : 
     138                 :            : // tests that query lengths are calculated correctly
     139                 :          1 : DEFINE_TESTCASE(querylen2, !backend) {
     140                 :            :     // test with an even bigger and strange query
     141                 :            :     string terms[3] = {
     142                 :            :         "foo",
     143                 :            :         "bar",
     144                 :            :         "baz"
     145 [ +  - ][ +  - ]:          4 :     };
                 [ +  - ]
           [ #  #  #  # ]
     146                 :            :     Xapian::Query queries[3] = {
     147                 :            :         Xapian::Query("wibble"),
     148                 :            :         Xapian::Query("wobble"),
     149                 :            :         Xapian::Query(Xapian::Query::OP_OR, string("jelly"), string("belly"))
     150 [ +  - ][ +  - ]:          5 :     };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
           [ #  #  #  #  
                   #  # ]
     151                 :            : 
     152                 :          2 :     Xapian::Query myquery;
     153         [ +  - ]:          2 :     vector<string> v1(terms, terms + 3);
     154         [ +  - ]:          2 :     vector<Xapian::Query> v2(queries, queries + 3);
     155                 :          2 :     vector<Xapian::Query *> v3;
     156 [ +  - ][ +  - ]:          2 :     Xapian::Query query1(Xapian::Query::OP_AND, string("ball"), string("club"));
                 [ +  - ]
     157 [ +  - ][ +  - ]:          2 :     Xapian::Query query2("ring");
     158         [ +  - ]:          1 :     v3.push_back(&query1);
     159         [ +  - ]:          1 :     v3.push_back(&query2);
     160                 :            : 
     161         [ +  - ]:          2 :     Xapian::Query myq1 = Xapian::Query(Xapian::Query::OP_AND, v1.begin(), v1.end());
     162 [ +  - ][ +  - ]:          1 :     tout << "myq1=" << myq1 << "\n";
                 [ +  - ]
     163 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(myq1.get_length(), 3);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     164                 :            : 
     165         [ +  - ]:          2 :     Xapian::Query myq2_1 = Xapian::Query(Xapian::Query::OP_OR, v2.begin(), v2.end());
     166 [ +  - ][ +  - ]:          1 :     tout << "myq2_1=" << myq2_1 << "\n";
                 [ +  - ]
     167 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(myq2_1.get_length(), 4);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     168                 :            : 
     169         [ +  - ]:          2 :     Xapian::Query myq2_2 = Xapian::Query(Xapian::Query::OP_AND, v3.begin(), v3.end());
     170 [ +  - ][ +  - ]:          1 :     tout << "myq2_2=" << myq2_2 << "\n";
                 [ +  - ]
     171 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(myq2_2.get_length(), 3);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     172                 :            : 
     173         [ +  - ]:          2 :     Xapian::Query myq2 = Xapian::Query(Xapian::Query::OP_OR, myq2_1, myq2_2);
     174 [ +  - ][ +  - ]:          1 :     tout << "myq2=" << myq2 << "\n";
                 [ +  - ]
     175 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(myq2.get_length(), 7);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     176                 :            : 
     177 [ +  - ][ +  - ]:          1 :     myquery = Xapian::Query(Xapian::Query::OP_OR, myq1, myq2);
     178 [ +  - ][ +  - ]:          1 :     tout << "myquery=" << myquery << "\n";
                 [ +  - ]
     179 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(myquery.get_length(), 10);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     180                 :            : 
     181 [ +  + ][ #  # ]:          4 :     return true;
     182                 :            : }
     183                 :            : 
     184                 :            : // tests that queries validate correctly
     185                 :          1 : DEFINE_TESTCASE(queryvalid1, !backend) {
     186 [ +  - ][ +  - ]:          1 :     Xapian::Query q2(Xapian::Query::OP_XOR, Xapian::Query("foo"), Xapian::Query("bar"));
         [ +  - ][ +  - ]
                 [ +  - ]
     187 [ +  - ][ +  - ]:          1 :     tout << "XOR (\"foo\", \"bar\") checked" << endl;
     188                 :          1 :     return true;
     189                 :            : }
     190                 :            : 
     191                 :            : /** Check we no longer flatten subqueries combined with the same operator.
     192                 :            :  *
     193                 :            :  *  Prior to 1.3.0 we did flatten these, but it's simpler to just handle this
     194                 :            :  *  when we convert the query to a PostList tree, and that works better with
     195                 :            :  *  Query objects being immutable.
     196                 :            :  */
     197                 :          1 : DEFINE_TESTCASE(dontflattensubqueries1, !backend) {
     198                 :            :     Xapian::Query queries1[3] = {
     199                 :            :         Xapian::Query("wibble"),
     200                 :            :         Xapian::Query("wobble"),
     201                 :            :         Xapian::Query(Xapian::Query::OP_OR, string("jelly"), string("belly"))
     202 [ +  - ][ +  - ]:          4 :     };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
           [ #  #  #  # ]
     203                 :            : 
     204                 :            :     Xapian::Query queries2[3] = {
     205                 :            :         Xapian::Query(Xapian::Query::OP_AND, string("jelly"), string("belly")),
     206                 :            :         Xapian::Query("wibble"),
     207                 :            :         Xapian::Query("wobble")
     208 [ +  - ][ +  - ]:          5 :     };
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
           [ #  #  #  #  
                   #  # ]
     209                 :            : 
     210         [ +  - ]:          2 :     vector<Xapian::Query> vec1(queries1, queries1 + 3);
     211         [ +  - ]:          2 :     Xapian::Query myquery1(Xapian::Query::OP_OR, vec1.begin(), vec1.end());
     212 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(myquery1.get_description(),
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     213                 :            :                "Query((wibble OR wobble OR (jelly OR belly)))");
     214                 :            : 
     215         [ +  - ]:          2 :     vector<Xapian::Query> vec2(queries2, queries2 + 3);
     216         [ +  - ]:          2 :     Xapian::Query myquery2(Xapian::Query::OP_AND, vec2.begin(), vec2.end());
     217 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(myquery2.get_description(),
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     218                 :            :                "Query(((jelly AND belly) AND wibble AND wobble))");
     219                 :            : 
     220 [ +  + ][ #  # ]:          4 :     return true;
     221                 :            : }
     222                 :            : 
     223                 :            : // test behaviour when creating a query from an empty vector
     224                 :          1 : DEFINE_TESTCASE(emptyquerypart1, !backend) {
     225                 :          1 :     vector<string> emptyterms;
     226         [ +  - ]:          2 :     Xapian::Query query(Xapian::Query::OP_OR, emptyterms.begin(), emptyterms.end());
     227 [ +  - ][ +  - ]:          1 :     TEST(Xapian::Query(Xapian::Query::OP_AND, query, Xapian::Query("x")).empty());
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     228 [ +  - ][ +  - ]:          1 :     TEST(Xapian::Query(Xapian::Query::OP_AND, query, Xapian::Query("x")).get_length() == 0);
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     229 [ +  - ][ +  - ]:          1 :     TEST(!Xapian::Query(Xapian::Query::OP_OR, query, Xapian::Query("x")).empty());
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     230 [ +  - ][ +  - ]:          1 :     TEST(Xapian::Query(Xapian::Query::OP_OR, query, Xapian::Query("x")).get_length() == 1);
         [ +  - ][ -  + ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     231                 :          1 :     return true;
     232                 :            : }
     233                 :            : 
     234                 :          1 : DEFINE_TESTCASE(stemlangs1, !backend) {
     235         [ +  - ]:          1 :     string langs = Xapian::Stem::get_available_languages();
     236 [ +  - ][ +  - ]:          1 :     tout << "available languages '" << langs << "'" << endl;
         [ +  - ][ +  - ]
     237 [ -  + ][ #  # ]:          1 :     TEST(!langs.empty());
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     238                 :            : 
     239                 :            :     // Also test the language codes and none.
     240         [ +  - ]:          1 :     langs += " da nl en fi fr de hu it no pt ro ru es sv tr none";
     241                 :            : 
     242                 :          1 :     string::size_type i = 0;
     243                 :            :     while (true) {
     244                 :         45 :         string::size_type spc = langs.find(' ', i);
     245                 :            :         // The only spaces in langs should be a single one between each pair
     246                 :            :         // of language names.
     247 [ -  + ][ #  # ]:         45 :         TEST_NOT_EQUAL(i, spc);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     248                 :            : 
     249                 :            :         // Try making a stemmer for this language.  We should be able to create
     250                 :            :         // it without an exception being thrown.
     251         [ +  - ]:         45 :         string language(langs, i, spc - i);
     252 [ +  - ][ +  - ]:         45 :         tout << "checking language code '" << language << "' works" << endl;
         [ +  - ][ +  - ]
     253 [ +  - ][ +  + ]:         90 :         Xapian::Stem stemmer(language);
     254         [ +  + ]:         45 :         if (language.size() > 2) {
     255         [ +  - ]:         30 :             string expected("Xapian::Stem(");
     256         [ +  - ]:         30 :             expected += language;
     257         [ +  - ]:         30 :             expected += ')';
     258 [ +  - ][ -  + ]:         30 :             TEST_EQUAL(stemmer.get_description(), expected);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     259                 :            :         }
     260                 :            : 
     261         [ +  + ]:         45 :         if (spc == string::npos) break;
     262         [ +  + ]:         45 :         i = spc + 1;
     263                 :         44 :     }
     264                 :            : 
     265                 :            :     // Stem("") should give an object which doesn't change any input.
     266 [ +  - ][ +  - ]:          2 :     Xapian::Stem stem_nothing = Xapian::Stem("");
     267 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(stem_nothing.get_description(), "Xapian::Stem(none)");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     268                 :            : 
     269                 :          1 :     return true;
     270                 :            : }
     271                 :            : 
     272                 :            : // Some simple tests of the built in weighting schemes.
     273                 :          1 : DEFINE_TESTCASE(weight1, !backend) {
     274                 :            :     Xapian::Weight * wt;
     275                 :            : 
     276                 :          1 :     Xapian::BoolWeight boolweight;
     277 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(boolweight.name(), "Xapian::BoolWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     278 [ +  - ][ +  - ]:          1 :     wt = Xapian::BoolWeight().unserialise(boolweight.serialise());
     279 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(boolweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     280         [ +  - ]:          1 :     delete wt;
     281                 :            : 
     282                 :          2 :     Xapian::CoordWeight coordweight;
     283 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(coordweight.name(), "Xapian::CoordWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     284 [ +  - ][ +  - ]:          1 :     wt = Xapian::CoordWeight().unserialise(coordweight.serialise());
     285 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(coordweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     286         [ +  - ]:          1 :     delete wt;
     287                 :            : 
     288                 :          2 :     Xapian::TradWeight tradweight_dflt;
     289                 :          2 :     Xapian::TradWeight tradweight(1.0);
     290 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(tradweight.name(), "Xapian::TradWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     291 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(tradweight_dflt.serialise(), tradweight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     292 [ +  - ][ +  - ]:          1 :     wt = Xapian::TradWeight().unserialise(tradweight.serialise());
     293 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(tradweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     294         [ +  - ]:          1 :     delete wt;
     295                 :            : 
     296                 :          2 :     Xapian::TradWeight tradweight2(2.0);
     297 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(tradweight.serialise(), tradweight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     298                 :            : 
     299                 :          2 :     Xapian::BM25Weight bm25weight_dflt;
     300                 :          2 :     Xapian::BM25Weight bm25weight(1, 0, 1, 0.5, 0.5);
     301 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bm25weight.name(), "Xapian::BM25Weight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     302 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bm25weight_dflt.serialise(), bm25weight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     303 [ +  - ][ +  - ]:          1 :     wt = Xapian::BM25Weight().unserialise(bm25weight.serialise());
     304 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bm25weight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     305         [ +  - ]:          1 :     delete wt;
     306                 :            : 
     307                 :          2 :     Xapian::BM25Weight bm25weight2(1, 0.5, 1, 0.5, 0.5);
     308 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(bm25weight.serialise(), bm25weight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     309                 :            : 
     310                 :          2 :     Xapian::BM25PlusWeight bm25plusweight_dflt;
     311                 :          2 :     Xapian::BM25PlusWeight bm25plusweight(1, 0, 1, 0.5, 0.5, 1.0);
     312 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bm25plusweight.name(), "Xapian::BM25PlusWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     313 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bm25plusweight_dflt.serialise(), bm25plusweight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     314 [ +  - ][ +  - ]:          1 :     wt = Xapian::BM25PlusWeight().unserialise(bm25plusweight.serialise());
     315 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bm25plusweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     316         [ +  - ]:          1 :     delete wt;
     317                 :            : 
     318                 :          2 :     Xapian::BM25PlusWeight bm25plusweight2(1, 0, 1, 0.5, 0.5, 2.0);
     319 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(bm25plusweight.serialise(), bm25plusweight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     320                 :            : 
     321         [ +  - ]:          2 :     Xapian::TfIdfWeight tfidfweight_dflt;
     322 [ +  - ][ +  - ]:          2 :     Xapian::TfIdfWeight tfidfweight("ntn");
     323 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(tfidfweight.name(), "Xapian::TfIdfWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     324 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(tfidfweight_dflt.serialise(), tfidfweight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     325 [ +  - ][ +  - ]:          1 :     wt = Xapian::TfIdfWeight().unserialise(tfidfweight.serialise());
                 [ +  - ]
     326 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(tfidfweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     327         [ +  - ]:          1 :     delete wt;
     328                 :            : 
     329 [ +  - ][ +  - ]:          2 :     Xapian::TfIdfWeight tfidfweight2("bpn");
     330 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(tfidfweight.serialise(), tfidfweight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     331                 :            : 
     332                 :          2 :     Xapian::InL2Weight inl2weight_dflt;
     333         [ +  - ]:          2 :     Xapian::InL2Weight inl2weight(1.0);
     334 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(inl2weight.name(), "Xapian::InL2Weight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     335 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(inl2weight_dflt.serialise(), inl2weight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     336 [ +  - ][ +  - ]:          1 :     wt = Xapian::InL2Weight().unserialise(inl2weight.serialise());
     337 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(inl2weight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     338         [ +  - ]:          1 :     delete wt;
     339                 :            : 
     340         [ +  - ]:          2 :     Xapian::InL2Weight inl2weight2(2.0);
     341 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(inl2weight.serialise(), inl2weight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     342                 :            : 
     343                 :          2 :     Xapian::IfB2Weight ifb2weight_dflt;
     344         [ +  - ]:          2 :     Xapian::IfB2Weight ifb2weight(1.0);
     345 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(ifb2weight.name(), "Xapian::IfB2Weight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     346 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(ifb2weight_dflt.serialise(), ifb2weight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     347 [ +  - ][ +  - ]:          1 :     wt = Xapian::IfB2Weight().unserialise(ifb2weight.serialise());
     348 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(ifb2weight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     349         [ +  - ]:          1 :     delete wt;
     350                 :            : 
     351         [ +  - ]:          2 :     Xapian::IfB2Weight ifb2weight2(2.0);
     352 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(ifb2weight.serialise(), ifb2weight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     353                 :            : 
     354                 :          2 :     Xapian::IneB2Weight ineb2weight_dflt;
     355         [ +  - ]:          2 :     Xapian::IneB2Weight ineb2weight(1.0);
     356 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(ineb2weight.name(), "Xapian::IneB2Weight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     357 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(ineb2weight_dflt.serialise(), ineb2weight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     358 [ +  - ][ +  - ]:          1 :     wt = Xapian::IneB2Weight().unserialise(ineb2weight.serialise());
     359 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(ineb2weight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     360         [ +  - ]:          1 :     delete wt;
     361                 :            : 
     362         [ +  - ]:          2 :     Xapian::IneB2Weight ineb2weight2(2.0);
     363 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(ineb2weight.serialise(), ineb2weight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     364                 :            : 
     365                 :          2 :     Xapian::BB2Weight bb2weight_dflt;
     366         [ +  - ]:          2 :     Xapian::BB2Weight bb2weight(1.0);
     367 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bb2weight.name(), "Xapian::BB2Weight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     368 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bb2weight_dflt.serialise(), bb2weight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     369 [ +  - ][ +  - ]:          1 :     wt = Xapian::BB2Weight().unserialise(bb2weight.serialise());
     370 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(bb2weight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     371         [ +  - ]:          1 :     delete wt;
     372                 :            : 
     373         [ +  - ]:          2 :     Xapian::BB2Weight bb2weight2(2.0);
     374 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(bb2weight.serialise(), bb2weight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     375                 :            : 
     376                 :          2 :     Xapian::DLHWeight dlhweight;
     377 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(dlhweight.name(), "Xapian::DLHWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     378 [ +  - ][ +  - ]:          1 :     wt = Xapian::DLHWeight().unserialise(dlhweight.serialise());
     379 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(dlhweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     380         [ +  - ]:          1 :     delete wt;
     381                 :            : 
     382                 :          2 :     Xapian::PL2Weight pl2weight_dflt;
     383         [ +  - ]:          2 :     Xapian::PL2Weight pl2weight(1.0);
     384 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(pl2weight.name(), "Xapian::PL2Weight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     385 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(pl2weight_dflt.serialise(), pl2weight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     386 [ +  - ][ +  - ]:          1 :     wt = Xapian::PL2Weight().unserialise(pl2weight.serialise());
     387 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(pl2weight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     388         [ +  - ]:          1 :     delete wt;
     389                 :            : 
     390         [ +  - ]:          2 :     Xapian::PL2Weight pl2weight2(2.0);
     391 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(pl2weight.serialise(), pl2weight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     392                 :            : 
     393                 :          2 :     Xapian::PL2PlusWeight pl2plusweight_dflt;
     394         [ +  - ]:          2 :     Xapian::PL2PlusWeight pl2plusweight(1.0, 0.8);
     395 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(pl2plusweight.name(), "Xapian::PL2PlusWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     396 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(pl2plusweight_dflt.serialise(), pl2plusweight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     397 [ +  - ][ +  - ]:          1 :     wt = Xapian::PL2PlusWeight().unserialise(pl2plusweight.serialise());
     398 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(pl2plusweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     399         [ +  - ]:          1 :     delete wt;
     400                 :            : 
     401         [ +  - ]:          2 :     Xapian::PL2PlusWeight pl2plusweight2(2.0, 0.9);
     402 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(pl2plusweight.serialise(), pl2plusweight2.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     403                 :            : 
     404                 :          2 :     Xapian::DPHWeight dphweight;
     405 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(dphweight.name(), "Xapian::DPHWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     406 [ +  - ][ +  - ]:          1 :     wt = Xapian::DPHWeight().unserialise(dphweight.serialise());
     407 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(dphweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     408         [ +  - ]:          1 :     delete wt;
     409                 :            : 
     410                 :          2 :     Xapian::LMWeight unigramlmweight_dflt;
     411                 :          2 :     Xapian::LMWeight unigramlmweight(32000, Xapian::Weight::DIRICHLET_SMOOTHING, 2034.0, 0.0);
     412 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(unigramlmweight.name(), "Xapian::LMWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     413 [ +  - ][ +  - ]:          1 :     TEST_NOT_EQUAL(unigramlmweight_dflt.serialise(), unigramlmweight.serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     414 [ +  - ][ +  - ]:          1 :     wt = Xapian::LMWeight().unserialise(unigramlmweight.serialise());
     415 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(unigramlmweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     416         [ +  - ]:          1 :     delete wt;
     417                 :            : 
     418                 :          2 :     Xapian::DiceCoeffWeight dicecoeffweight;
     419 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(dicecoeffweight.name(), "Xapian::DiceCoeffWeight");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     420 [ +  - ][ +  - ]:          1 :     wt = Xapian::DiceCoeffWeight().unserialise(dicecoeffweight.serialise());
     421 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(dicecoeffweight.serialise(), wt->serialise());
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     422         [ +  - ]:          1 :     delete wt;
     423                 :            : 
     424                 :          1 :     return true;
     425                 :            : }
     426                 :            : 
     427                 :            : // Regression test.
     428                 :          1 : DEFINE_TESTCASE(nosuchdb1, !backend) {
     429                 :            :     // This is a "nodb" test because it doesn't test a particular backend.
     430                 :            :     try {
     431 [ +  - ][ -  + ]:          2 :         Xapian::Database db("NOsuChdaTabASe");
     432 [ #  # ][ #  # ]:          1 :         FAIL_TEST("Managed to open 'NOsuChdaTabASe'");
         [ #  # ][ #  # ]
     433         [ -  + ]:          2 :     } catch (const Xapian::DatabaseOpeningError & e) {
     434                 :            :         // We don't really require this exact message, but in Xapian <= 1.1.0
     435                 :            :         // this gave "Couldn't detect type of database".
     436 [ -  + ][ -  +  :          1 :         TEST_STRINGS_EQUAL(e.get_msg(), "Couldn't stat 'NOsuChdaTabASe'");
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     437                 :            :     }
     438                 :            : 
     439                 :            :     try {
     440   [ -  +  +  - ]:          1 :         Xapian::Database::check("NOsuChdaTabASe");
     441   [ #  #  #  #  :          0 :         FAIL_TEST("Managed to check 'NOsuChdaTabASe'");
             #  #  #  # ]
     442         [ -  + ]:          2 :     } catch (const Xapian::DatabaseOpeningError & e) {
     443                 :            :         // In 1.4.3 and earlier, this threw DatabaseError with the message:
     444                 :            :         // "File is not a Xapian database or database table" (confusing as
     445                 :            :         // there is no file).
     446 [ -  + ][ -  +  :          1 :         TEST_STRINGS_EQUAL(e.get_msg(),
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     447                 :            :                            "Couldn't find Xapian database or table to check");
     448                 :            :     }
     449                 :            : 
     450                 :          2 :     return true;
     451                 :            : }
     452                 :            : 
     453                 :            : // Feature tests for value manipulations.
     454                 :          1 : DEFINE_TESTCASE(addvalue1, !backend) {
     455                 :            :     // Regression test for add_value on an existing value (bug#82).
     456         [ +  - ]:          1 :     Xapian::Document doc;
     457 [ +  - ][ +  - ]:          1 :     doc.add_value(1, "original");
     458 [ +  - ][ +  - ]:          1 :     doc.add_value(1, "replacement");
     459 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(doc.get_value(1), "replacement");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     460                 :            : 
     461 [ +  - ][ +  - ]:          1 :     doc.add_value(2, "too");
     462 [ +  - ][ +  - ]:          1 :     doc.add_value(3, "free");
     463 [ +  - ][ +  - ]:          1 :     doc.add_value(4, "for");
     464                 :            : 
     465         [ +  - ]:          1 :     doc.remove_value(2);
     466         [ +  - ]:          1 :     doc.remove_value(4);
     467 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(doc.get_value(0), "");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     468 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(doc.get_value(1), "replacement");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     469 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(doc.get_value(2), "");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     470 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(doc.get_value(3), "free");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     471 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(doc.get_value(4), "");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     472                 :            : 
     473                 :          1 :     return true;
     474                 :            : }
     475                 :            : 
     476                 :            : // tests that the collapsing on termpos optimisation gives correct query length
     477                 :          1 : DEFINE_TESTCASE(poscollapse2, !backend) {
     478 [ +  - ][ +  - ]:          1 :     Xapian::Query q(Xapian::Query::OP_OR, Xapian::Query("this", 1, 1), Xapian::Query("this", 1, 1));
         [ +  - ][ +  - ]
                 [ +  - ]
     479 [ -  + ][ #  # ]:          1 :     TEST_EQUAL(q.get_length(), 2);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     480                 :          1 :     return true;
     481                 :            : }
     482                 :            : 
     483                 :            : // Regression test: query on an uninitialised database segfaulted with 1.0.0.
     484                 :            : // As of 1.5.0, this is just handled as an empty database.
     485                 :          1 : DEFINE_TESTCASE(uninitdb1, !backend) {
     486         [ +  - ]:          1 :     Xapian::Database db;
     487         [ +  - ]:          1 :     Xapian::Enquire enq(db);
     488                 :          1 :     return true;
     489                 :            : }
     490                 :            : 
     491                 :            : // Test a scaleweight query applied to a match nothing query
     492                 :          1 : DEFINE_TESTCASE(scaleweight3, !backend) {
     493         [ +  - ]:          1 :     Xapian::Query matchnothing(Xapian::Query::MatchNothing);
     494         [ +  - ]:          2 :     Xapian::Query query(Xapian::Query::OP_SCALE_WEIGHT, matchnothing, 3.0);
     495 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(query.get_description(), "Query()");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     496                 :          1 :     return true;
     497                 :            : }
     498                 :            : 
     499                 :            : // Regression test - before 1.1.0, you could add docid 0 to an RSet.
     500                 :          1 : DEFINE_TESTCASE(rset3, !backend) {
     501         [ +  - ]:          1 :     Xapian::RSet rset;
     502 [ +  - ][ -  + ]:          1 :     TEST_EXCEPTION(Xapian::InvalidArgumentError, rset.add_document(0));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ -  + ][ -  +  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
                 [ +  - ]
     503 [ +  - ][ -  +  :          1 :     TEST(rset.empty());
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     504 [ +  - ][ -  +  :          1 :     TEST_EQUAL(rset.size(), 0);
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     505         [ +  - ]:          1 :     rset.add_document(1);
     506         [ +  - ]:          1 :     rset.add_document(static_cast<Xapian::docid>(-1));
     507 [ +  - ][ -  +  :          1 :     TEST_EXCEPTION(Xapian::InvalidArgumentError, rset.add_document(0));
          #  #  #  #  #  
          #  #  #  #  #  
           #  # ][ -  + ]
           [ -  +  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
           #  # ][ +  - ]
     508 [ +  - ][ -  +  :          1 :     TEST(!rset.empty());
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     509 [ +  - ][ -  +  :          1 :     TEST_EQUAL(rset.size(), 2);
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     510                 :          1 :     return true;
     511                 :            : }
     512                 :            : 
     513                 :            : // Regression test - RSet::get_description() gave a malformed answer in 1.0.7.
     514                 :          1 : DEFINE_TESTCASE(rset4, !backend) {
     515         [ +  - ]:          1 :     Xapian::RSet rset;
     516 [ +  - ][ +  - ]:          1 :     TEST_STRINGS_EQUAL(rset.get_description(), "RSet()");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     517         [ +  - ]:          1 :     rset.add_document(2);
     518                 :            :     // In 1.0.7 this gave: RSet(RSet(RSet::Internal(, 2))
     519 [ +  - ][ +  - ]:          1 :     TEST_STRINGS_EQUAL(rset.get_description(), "RSet(2)");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     520         [ +  - ]:          1 :     rset.add_document(1);
     521 [ +  - ][ +  - ]:          1 :     TEST_STRINGS_EQUAL(rset.get_description(), "RSet(1,2)");
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     522                 :          1 :     return true;
     523                 :            : }
     524                 :            : 
     525                 :            : // Direct test of ValueSetMatchDecider
     526                 :          1 : DEFINE_TESTCASE(valuesetmatchdecider1, !backend) {
     527         [ +  - ]:          1 :     Xapian::ValueSetMatchDecider vsmd1(0, true);
     528 [ +  - ][ +  - ]:          1 :     vsmd1.add_value("42");
     529         [ +  - ]:          2 :     Xapian::ValueSetMatchDecider vsmd2(0, false);
     530 [ +  - ][ +  - ]:          1 :     vsmd2.remove_value("nosuch"); // Test removing a value which isn't present.
     531 [ +  - ][ +  - ]:          1 :     vsmd2.add_value("42");
     532         [ +  - ]:          2 :     Xapian::ValueSetMatchDecider vsmd3(0, true);
     533 [ +  - ][ +  - ]:          1 :     vsmd3.add_value("42");
     534 [ +  - ][ +  - ]:          1 :     vsmd3.add_value("blah");
     535                 :            : 
     536         [ +  - ]:          2 :     Xapian::Document doc;
     537 [ +  - ][ -  + ]:          1 :     TEST(!vsmd1(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     538 [ +  - ][ -  + ]:          1 :     TEST(vsmd2(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     539 [ +  - ][ -  + ]:          1 :     TEST(!vsmd3(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     540 [ +  - ][ +  - ]:          1 :     doc.add_value(0, "42");
     541 [ +  - ][ -  + ]:          1 :     TEST(vsmd1(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     542 [ +  - ][ -  + ]:          1 :     TEST(!vsmd2(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     543 [ +  - ][ -  + ]:          1 :     TEST(vsmd3(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     544 [ +  - ][ +  - ]:          1 :     doc.add_value(0, "blah");
     545 [ +  - ][ -  + ]:          1 :     TEST(!vsmd1(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     546 [ +  - ][ -  + ]:          1 :     TEST(vsmd2(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     547 [ +  - ][ -  + ]:          1 :     TEST(vsmd3(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     548                 :            : 
     549 [ +  - ][ +  - ]:          1 :     vsmd3.remove_value("nosuch"); // Test removing a value which isn't present.
     550 [ +  - ][ +  - ]:          1 :     vsmd3.remove_value("blah");
     551 [ +  - ][ -  + ]:          1 :     TEST(!vsmd1(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     552 [ +  - ][ -  + ]:          1 :     TEST(vsmd2(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     553 [ +  - ][ -  + ]:          1 :     TEST(!vsmd3(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     554 [ +  - ][ +  - ]:          1 :     doc.add_value(0, "42");
     555 [ +  - ][ -  + ]:          1 :     TEST(vsmd1(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     556 [ +  - ][ -  + ]:          1 :     TEST(!vsmd2(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     557 [ +  - ][ -  + ]:          1 :     TEST(vsmd3(doc));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     558                 :            : 
     559                 :          1 :     return true;
     560                 :            : }
     561                 :            : 
     562                 :            : // Test that requesting termfreq or termweight on an empty mset returns 0.
     563                 :            : // New behaviour as of 1.5.0 - previously both methods threw
     564                 :            : // Xapian::InvalidOperationError.
     565                 :          1 : DEFINE_TESTCASE(emptymset1, !backend) {
     566         [ +  - ]:          1 :     Xapian::MSet emptymset;
     567 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(emptymset.get_termfreq("foo"), 0);
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     568 [ +  - ][ +  - ]:          1 :     TEST_EQUAL(emptymset.get_termweight("foo"), 0.0);
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     569                 :          1 :     return true;
     570                 :            : }
     571                 :            : 
     572                 :          1 : DEFINE_TESTCASE(expanddeciderfilterprefix1, !backend) {
     573         [ +  - ]:          1 :     string prefix = "tw";
     574         [ +  - ]:          2 :     Xapian::ExpandDeciderFilterPrefix decider(prefix);
     575 [ +  - ][ +  - ]:          1 :     TEST(!decider("one"));
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     576 [ +  - ][ +  - ]:          1 :     TEST(!decider("t"));
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     577 [ +  - ][ +  - ]:          1 :     TEST(!decider(""));
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     578 [ +  - ][ +  - ]:          1 :     TEST(!decider("Two"));
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     579 [ +  - ][ +  - ]:          1 :     TEST(decider("two"));
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     580 [ +  - ][ +  - ]:          1 :     TEST(decider("twitter"));
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     581 [ +  - ][ -  + ]:          1 :     TEST(decider(prefix));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     582                 :            : 
     583                 :          1 :     return true;
     584                 :            : }

Generated by: LCOV version 1.11