[letor] Fix to use correct XAPIAN_LDFLAGS
[xapian.git] / xapian-letor / tests / apitest.cc
blob437a362a7a1b39eb4f91b6ecada354880667be28
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 class ApiTestRunner : public TestRunner
64 public:
65 int run() const {
66 int result = 0;
67 #include "api_collated.h"
68 test_driver::report(test_driver::subtotal,
69 "backend " + backendmanager->get_dbtype());
70 test_driver::total += test_driver::subtotal;
71 test_driver::subtotal.reset();
72 return result;
76 int main(int argc, char **argv)
78 ApiTestRunner runner;
79 return runner.run_tests(argc, argv);