Index: api_db.cc =================================================================== RCS file: /home/cvs/xapian/xapian-core/tests/api_db.cc,v retrieving revision 1.168 diff -u -r1.168 api_db.cc --- api_db.cc 9 Mar 2004 19:06:20 -0000 1.168 +++ api_db.cc 27 Apr 2004 08:47:13 -0000 @@ -1414,6 +1414,22 @@ return true; } +// regression test for bug with iterating through an mset - bug caused +// an access to uninitialised memory when iteration through partial mset +// reached end. (This test only reliably fails when run under valgrind.) +static bool test_partialmset1() +{ + Xapian::Query myquery = query(Xapian::Query::OP_OR, "this", "word"); + Xapian::MSet mymset = do_get_simple_query_mset(myquery, 10, 1); + + Xapian::MSetIterator it; + for (it = mymset.begin(); it != mymset.end(); it++) { + TEST_NOT_EQUAL(it.get_document().get_data(), ""); + } + + return true; +} + // test that prefetching documents works (at least, gives same results) static bool test_fetchdocs1() { @@ -3255,6 +3271,7 @@ {"poscollapse1", test_poscollapse1}, {"poscollapse2", test_poscollapse2}, {"repeatquery1", test_repeatquery1}, + {"partialmset1", test_partialmset1}, {"fetchdocs1", test_fetchdocs1}, {"absentterm1", test_absentterm1}, {"absentterm2", test_absentterm2},