2 my $copyright = 'Copyright (C) 2007,2009,2012,2014,2015,2016 Olly Betts';
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 my $generated_warning =
21 "/* Warning: This file is generated by $0 - do not modify directly! */\n";
23 my %uncopyableclasses = (
26 my %copyableclasses = (
30 my %no_get_description = (
31 'FeatureVector' => '',
35 'ListNETRanker' => '',
41 /** @file api_generated.cc
42 * @brief test common features of API classes
45 print $generated_warning;
49 * This program is free software; you can redistribute it and/or modify
50 * it under the terms of the GNU General Public License as published by
51 * the Free Software Foundation; either version 2 of the License, or
52 * (at your option) any later version.
54 * This program is distributed in the hope that it will be useful,
55 * but WITHOUT ANY WARRANTY; without even the implied warranty of
56 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57 * GNU General Public License for more details.
59 * You should have received a copy of the GNU General Public License
60 * along with this program; if not, write to the Free Software
61 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
66 #include "api_generated.h"
68 #define XAPIAN_DEPRECATED(D) D
70 #include <xapian-letor.h>
73 #include "testutils.h"
77 /// Check uncopyable API classes which should have a default ctor actually do.
78 DEFINE_TESTCASE(defaultctor1, !backend) {
81 for my $class (sort keys %uncopyableclasses) {
82 my $params = $uncopyableclasses{$class};
84 $params = "($params)";
86 my $get_description = ! exists $no_get_description{$class};
87 my $object = lc $class;
88 $class = "Xapian::$class";
89 print " $class $object$params;\n";
90 print " TEST(!$object.get_description().empty());\n" if $get_description;
97 /// Test that API classes have a copy ctor and assignment operator.
98 DEFINE_TESTCASE(copyassign1, !backend) {
101 for my $class (sort keys %copyableclasses) {
102 my $params = $copyableclasses{$class};
103 if ($params =~ /INMEMORY/) {
104 print "#ifdef XAPIAN_HAS_INMEMORY_BACKEND\n";
107 $params = "($params)";
109 my $get_description = ! exists $no_get_description{$class};
110 my $object = lc $class;
111 $class = "Xapian::$class";
112 print " $class $object$params;\n";
113 print " TEST(!$object.get_description().empty());\n" if $get_description;
114 print " $class copy_$object($object);\n";
115 print " $object = copy_$object;\n";
116 if ($params =~ /INMEMORY/) {