xapian-core  2.0.0
testmacros.h
Go to the documentation of this file.
1 
4 /* Copyright (C) 2009,2012,2025 Olly Betts
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see
18  * <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef XAPIAN_INCLUDED_TESTMACROS_H
22 #define XAPIAN_INCLUDED_TESTMACROS_H
23 
24 #ifdef XAPIAN_UNITTEST
25 # define DEFINE_TESTCASE(T) static void test_##T()
26 #else
27 // We ignore the condition `C` here - it's picked up by the collate-test script
28 // which generates code to check the conditions.
29 # define DEFINE_TESTCASE(T,C) void test_##T()
30 #endif
31 #define TESTCASE(T) { #T, test_##T }
32 #define END_OF_TESTCASES { 0, 0 }
33 
35 #define TEST_REL(A,REL,B) \
36  TEST_AND_EXPLAIN((A) REL (B), \
37  "Evaluates to: " << (A) << " "#REL" " << (B))
38 
39 #endif // XAPIAN_INCLUDED_TESTMACROS_H