maxminddb_test_helper.h (libmaxminddb-1.5.0) | : | maxminddb_test_helper.h (libmaxminddb-1.5.2) | ||
---|---|---|---|---|
/* Some test files may require something newer */ | /* Some test files may require something newer */ | |||
#if !defined(_GNU_SOURCE) && !defined(_POSIX_C_SOURCE) | #if !defined(_GNU_SOURCE) && !defined(_POSIX_C_SOURCE) | |||
#define _POSIX_C_SOURCE 200112L | #define _POSIX_C_SOURCE 200112L | |||
#endif | #endif | |||
#if HAVE_CONFIG_H | #if HAVE_CONFIG_H | |||
#include <config.h> | #include <config.h> | |||
#endif | #endif | |||
#include "libtap/tap.h" | ||||
#include "maxminddb-compat-util.h" | ||||
#include "maxminddb.h" | ||||
#include <math.h> | #include <math.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <string.h> | #include <string.h> | |||
#include "maxminddb.h" | ||||
#include "maxminddb-compat-util.h" | ||||
#include "libtap/tap.h" | ||||
#ifdef _WIN32 | #ifdef _WIN32 | |||
#include <winsock2.h> | #include <winsock2.h> | |||
#include <ws2tcpip.h> | #include <ws2tcpip.h> | |||
#define R_OK 4 | #define R_OK 4 | |||
#else | #else | |||
#include <netdb.h> | #include <netdb.h> | |||
#endif | #endif | |||
skipping to change at line 36 | skipping to change at line 36 | |||
#if (_MSC_VER && _MSC_VER < 1900) | #if (_MSC_VER && _MSC_VER < 1900) | |||
/* _snprintf has security issues, but I don't think it is worth | /* _snprintf has security issues, but I don't think it is worth | |||
worrying about for the unit tests. */ | worrying about for the unit tests. */ | |||
#define snprintf _snprintf | #define snprintf _snprintf | |||
#endif | #endif | |||
#ifndef MMDB_TEST_HELPER_C | #ifndef MMDB_TEST_HELPER_C | |||
#define MMDB_TEST_HELPER_C (1) | #define MMDB_TEST_HELPER_C (1) | |||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) | #define UNUSED(x) UNUSED_##x __attribute__((__unused__)) | |||
#else | #else | |||
# define UNUSED | #define UNUSED | |||
#endif | #endif | |||
#define MAX_DESCRIPTION_LENGTH 500 | #define MAX_DESCRIPTION_LENGTH 500 | |||
extern void for_all_record_sizes(const char *filename_fmt, | extern void for_all_record_sizes(const char *filename_fmt, | |||
void (*tests)(int record_size, | void (*tests)(int record_size, | |||
const char *filename, | const char *filename, | |||
const char *description)); | const char *description)); | |||
extern void for_all_modes(void (*tests)(int mode, const char *description)); | extern void for_all_modes(void (*tests)(int mode, const char *description)); | |||
extern const char *test_database_path(const char *filename); | extern const char *test_database_path(const char *filename); | |||
extern const char *dup_entry_string_or_bail(MMDB_entry_data_s entry_data); | extern const char *dup_entry_string_or_bail(MMDB_entry_data_s entry_data); | |||
extern MMDB_s *open_ok(const char *db_file, int mode, const char *mode_desc); | extern MMDB_s *open_ok(const char *db_file, int mode, const char *mode_desc); | |||
extern MMDB_lookup_result_s lookup_string_ok(MMDB_s *mmdb, const char *ip, | extern MMDB_lookup_result_s lookup_string_ok(MMDB_s *mmdb, | |||
const char *ip, | ||||
const char *file, | const char *file, | |||
const char *mode_desc); | const char *mode_desc); | |||
extern MMDB_lookup_result_s lookup_sockaddr_ok(MMDB_s *mmdb, const char *ip, | extern MMDB_lookup_result_s lookup_sockaddr_ok(MMDB_s *mmdb, | |||
const char *ip, | ||||
const char *file, | const char *file, | |||
const char *mode_desc); | const char *mode_desc); | |||
extern void test_lookup_errors(int gai_error, int mmdb_error, | extern void test_lookup_errors(int gai_error, | |||
const char *function, const char *ip, | int mmdb_error, | |||
const char *file, const char *mode_desc); | const char *function, | |||
const char *ip, | ||||
const char *file, | ||||
const char *mode_desc); | ||||
extern MMDB_entry_data_s data_ok(MMDB_lookup_result_s *result, | extern MMDB_entry_data_s data_ok(MMDB_lookup_result_s *result, | |||
uint32_t expect_type, | uint32_t expect_type, | |||
const char *description, ...); | const char *description, | |||
...); | ||||
extern void compare_double(double got, double expect); | extern void compare_double(double got, double expect); | |||
extern void compare_float(float got, float expect); | extern void compare_float(float got, float expect); | |||
#endif | #endif | |||
End of changes. 8 change blocks. | ||||
11 lines changed or deleted | 17 lines changed or added |