FreeTDS API
Loading...
Searching...
No Matches
test_base.h
1/* Base tests utilities
2 * Copyright (C) 2025 Aaron M. Ucko
3 * Copyright (C) 2025 Frediano Ziglio
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21#ifndef _tdsguard_afBM6E9n8CuIFSBHNNblq5_
22#define _tdsguard_afBM6E9n8CuIFSBHNNblq5_
23
24/*
25 * Base header for FreeTDS unit tests, even those just covering helpers
26 * from the utils and replacements trees. Should be included first
27 * (possibly via a common.h) to be certain of preceding <assert.h>.
28 */
29
30/* Ensure assert is always active. */
31#if defined(assert) && defined(NDEBUG)
32# error "Include test_base.h (or common.h) earlier"
33#endif
34
35#undef NDEBUG
36
37#include <config.h>
38
39#include <freetds/macros.h>
40
41/*
42 * Tests should define test_main in lieu of main so that they can be
43 * configured to suppress automation-unfriendly crash dialog boxes on
44 * Windows. To that end, they can use the TEST_MAIN macro, which cleanly
45 * avoids warnings for the tests that ignore their arguments (but still
46 * provides the details under conventional names for the remainder).
47 */
48int test_main(int argc, char **argv);
49
50#define TEST_MAIN() int test_main(int argc TDS_UNUSED, char **argv TDS_UNUSED)
51
52#endif /* _tdsguard_afBM6E9n8CuIFSBHNNblq5_ */