tests/apitest.h

Go to the documentation of this file.
00001 
00004 /* Copyright (C) 2007 Olly Betts
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  */
00020 
00021 #ifndef XAPIAN_INCLUDED_APITEST_H
00022 #define XAPIAN_INCLUDED_APITEST_H
00023 
00024 #include <xapian.h>
00025 
00026 #include "testsuite.h"
00027 
00028 #define DEFINE_TESTCASE(S,COND) bool test_##S()
00029 
00030 const char * get_dbtype();
00031 
00032 Xapian::Database get_database(const std::string &db);
00033 
00034 Xapian::Database get_database(const std::string &db1, const std::string &db2);
00035 
00036 Xapian::WritableDatabase get_writable_database(const std::string &db = "");
00037 
00038 Xapian::WritableDatabase get_named_writable_database(const std::string &name, const std::string &source = "");
00039 
00040 Xapian::Database get_remote_database(const std::string &db, unsigned timeout);
00041 
00042 Xapian::Database get_writable_database_as_database();
00043 
00044 Xapian::WritableDatabase get_writable_database_again();
00045 
00046 #define SKIP_TEST_UNLESS_BACKEND(B) \
00047     if (strcmp(get_dbtype(), (B)) != 0) SKIP_TEST("Test only supported for "#B" backend"); else (void)0
00048 
00049 #define SKIP_TEST_FOR_BACKEND(B) \
00050     if (strcmp(get_dbtype(), (B)) == 0) SKIP_TEST("Test not supported for "#B" backend"); else (void)0
00051 
00052 #endif // XAPIAN_INCLUDED_APITEST_H

Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.