"Fossies" - the Fresh Open Source Software Archive 
Member "libmaxminddb-1.5.2/t/maxminddb_test_helper.h" (18 Feb 2021, 2505 Bytes) of package /linux/misc/libmaxminddb-1.5.2.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "maxminddb_test_helper.h":
1.5.0_vs_1.5.2.
1 /* Some test files may require something newer */
2 #if !defined(_GNU_SOURCE) && !defined(_POSIX_C_SOURCE)
3 #define _POSIX_C_SOURCE 200112L
4 #endif
5
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 #include "libtap/tap.h"
10 #include "maxminddb-compat-util.h"
11 #include "maxminddb.h"
12 #include <math.h>
13 #include <stdio.h>
14 #include <string.h>
15
16 #ifdef _WIN32
17 #include <winsock2.h>
18 #include <ws2tcpip.h>
19
20 #define R_OK 4
21
22 #else
23 #include <netdb.h>
24 #endif
25
26 #if (_MSC_VER && _MSC_VER < 1900)
27 /* _snprintf has security issues, but I don't think it is worth
28 worrying about for the unit tests. */
29 #define snprintf _snprintf
30 #endif
31
32 #ifndef MMDB_TEST_HELPER_C
33 #define MMDB_TEST_HELPER_C (1)
34
35 #ifdef __GNUC__
36 #define UNUSED(x) UNUSED_##x __attribute__((__unused__))
37 #else
38 #define UNUSED
39 #endif
40
41 #define MAX_DESCRIPTION_LENGTH 500
42
43 extern void for_all_record_sizes(const char *filename_fmt,
44 void (*tests)(int record_size,
45 const char *filename,
46 const char *description));
47 extern void for_all_modes(void (*tests)(int mode, const char *description));
48 extern const char *test_database_path(const char *filename);
49 extern const char *dup_entry_string_or_bail(MMDB_entry_data_s entry_data);
50 extern MMDB_s *open_ok(const char *db_file, int mode, const char *mode_desc);
51 extern MMDB_lookup_result_s lookup_string_ok(MMDB_s *mmdb,
52 const char *ip,
53 const char *file,
54 const char *mode_desc);
55 extern MMDB_lookup_result_s lookup_sockaddr_ok(MMDB_s *mmdb,
56 const char *ip,
57 const char *file,
58 const char *mode_desc);
59 extern void test_lookup_errors(int gai_error,
60 int mmdb_error,
61 const char *function,
62 const char *ip,
63 const char *file,
64 const char *mode_desc);
65 extern MMDB_entry_data_s data_ok(MMDB_lookup_result_s *result,
66 uint32_t expect_type,
67 const char *description,
68 ...);
69 extern void compare_double(double got, double expect);
70 extern void compare_float(float got, float expect);
71
72 #endif