Add BufferedFile::read_uint4_be() method
[xapian.git] / xapian-letor / tests / apitest.cc
blob5727b884454ef0a6c572c2d928bd7273307bd5c4
1 /* apitest.cc: tests the Xapian API
3 * Copyright 1999,2000,2001 BrightStation PLC
4 * Copyright 2002 Ananova Ltd
5 * Copyright 2003,2004,2006,2007,2008,2009 Olly Betts
6 * Copyright 2008 Lemur Consulting Ltd
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 * USA
24 #include <config.h>
26 #include "apitest.h"
28 #include "api_all.h"
29 #include "backendmanager.h"
30 #include "stringutils.h"
31 #include "testrunner.h"
32 #include "testsuite.h"
34 #include <xapian.h>
36 #include <string>
37 #include <vector>
39 using namespace std;
41 Xapian::Database
42 get_database(const string &dbname)
44 return backendmanager->get_database(dbname);
47 Xapian::Database
48 get_database(const string &dbname, const string &dbname2)
50 vector<string> dbnames;
51 dbnames.push_back(dbname);
52 dbnames.push_back(dbname2);
53 return backendmanager->get_database(dbnames);
56 string
57 get_database_path(const string &dbname)
59 return backendmanager->get_database_path(dbname);
62 string
63 get_database_path(const std::string &dbname,
64 void (*gen)(Xapian::WritableDatabase&,
65 const std::string &),
66 const std::string &arg)
68 return backendmanager->get_database_path(dbname, gen, arg);
71 Xapian::Database
72 get_database(const std::string &dbname,
73 void (*gen)(Xapian::WritableDatabase&,
74 const std::string &),
75 const std::string &arg)
77 return backendmanager->get_database(dbname, gen, arg);
80 class ApiTestRunner : public TestRunner
82 public:
83 int run() const {
84 int result = 0;
85 #include "api_collated.h"
86 test_driver::report(test_driver::subtotal,
87 "backend " + backendmanager->get_dbtype());
88 test_driver::total += test_driver::subtotal;
89 test_driver::subtotal.reset();
90 return result;
94 int main(int argc, char **argv)
96 ApiTestRunner runner;
97 return runner.run_tests(argc, argv);