Ticket #287: xapian-bug287-testcase.patch

File xapian-bug287-testcase.patch, 1.1 KB (added by Olly Betts, 16 years ago)

Crude patch against trunk's api_wrdb.cc which shows the problem

  • api_wrdb.cc

     
    21752175
    21762176    return true;
    21772177}
     2178
     2179static const int bug287_terms[] = { 219, 221, 222, 223, 224, 225, 226 };
     2180static const int bug287_copies[] = { 74, 116, 199, 21, 45, 155, 189 };
     2181
     2182DEFINE_TESTCASE(bug287, flint) {
     2183    {
     2184        Xapian::WritableDatabase db = get_named_writable_database("bug287", string());
     2185
     2186        for (size_t i = 0; i < sizeof(bug287_terms) / sizeof(bug287_terms[0]); ++i) {
     2187            Xapian::Document doc;
     2188            doc.add_term("XC" + om_tostring(bug287_terms[i]));
     2189            doc.add_term("XTabc");
     2190            doc.add_term("XAdef");
     2191            doc.add_term("XRghi");
     2192            doc.add_term("XYabc");
     2193            size_t copies = bug287_copies[i];
     2194            while (copies--) db.add_document(doc);
     2195        }
     2196
     2197        db.flush();
     2198
     2199        for (size_t i = 0; i < sizeof(bug287_terms) / sizeof(bug287_terms[0]); ++i) {
     2200            db.delete_document("XC" + om_tostring(bug287_terms[i]));
     2201        }
     2202    }
     2203
     2204    if (system("../bin/xapian-check .flint/dbw__bug287") != 0) return false;
     2205
     2206    return true;
     2207}