File: apitest.h

package info (click to toggle)
xapian-core 1.4.3-2~bpo8+1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 21,224 kB
  • sloc: cpp: 113,806; ansic: 8,723; sh: 4,433; perl: 836; makefile: 567; tcl: 317; python: 40
file content (75 lines) | stat: -rw-r--r-- 2,868 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/** @file apitest.h
 * @brief test functionality of the Xapian API
 */
/* Copyright (C) 2007,2009,2011 Olly Betts
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */

#ifndef XAPIAN_INCLUDED_APITEST_H
#define XAPIAN_INCLUDED_APITEST_H

#include <xapian.h>

#include "testsuite.h"

std::string get_dbtype();

Xapian::Database get_database(const std::string &db);

Xapian::Database get_database(const std::string &db1, const std::string &db2);

Xapian::Database get_database(const std::string &db,
			      void (*gen)(Xapian::WritableDatabase&,
					  const std::string &),
			      const std::string &arg = std::string());

std::string get_database_path(const std::string &db);

std::string get_database_path(const std::string &db,
			      void (*gen)(Xapian::WritableDatabase&,
					  const std::string &),
			      const std::string &arg = std::string());

Xapian::WritableDatabase get_writable_database(const std::string &db = std::string());

Xapian::WritableDatabase get_named_writable_database(const std::string &name, const std::string &source = std::string());

std::string get_named_writable_database_path(const std::string &name);

Xapian::Database get_remote_database(const std::string &db, unsigned timeout);

Xapian::Database get_writable_database_as_database();

Xapian::WritableDatabase get_writable_database_again();

// Skip the test for any backend not of the specified type.
//
// More precisely, this skips the test for any backend for which the
// get_dbtype() function does not return a string starting with backend_prefix.
// This allows backends like "multi_chert" to be covered by specifying "multi".
void skip_test_unless_backend(const std::string & backend_prefix);

// Skip the test for any backend of the specified type.
//
// More precisely, this skips the test for any backend for which the
// get_dbtype() function returns a string starting with backend_prefix.  This
// allows backends like "multi_chert" to be covered by specifying "multi".
void skip_test_for_backend(const std::string & backend_prefix);

#define SKIP_TEST_UNLESS_BACKEND(B) skip_test_unless_backend(B)
#define SKIP_TEST_FOR_BACKEND(B) skip_test_for_backend(B)

#endif // XAPIAN_INCLUDED_APITEST_H