1 /*
2  **********************************************************************
3  * Copyright (C) Miroslav Lichvar  2016
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  *
18  **********************************************************************
19  */
20 
21 #ifndef GOT_TEST_H
22 #define GOT_TEST_H
23 
24 #include <addressing.h>
25 
26 extern void test_unit(void);
27 
28 #define TEST_CHECK(expr) \
29   do { \
30     if (!(expr)) { \
31       TST_Fail(__LINE__); \
32       exit(1); \
33     } \
34   } while (0)
35 
36 #define TEST_REQUIRE(expr) \
37   do { \
38     if (!(expr)) { \
39       TST_Skip(__LINE__); \
40       exit(0); \
41     } \
42   } while (0)
43 
44 extern void TST_Fail(int line);
45 extern void TST_Skip(int line);
46 
47 extern double TST_GetRandomDouble(double min, double max);
48 extern void TST_GetRandomAddress(IPAddr *ip, int family, int bits);
49 extern void TST_SwapAddressBit(IPAddr *ip, unsigned int b);
50 extern void TST_RegisterDummyDrivers(void);
51 
52 #endif
53