1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-15 13:27:11 +02:00
Files
bin
cmake
module
Base
Core
Entity
Library
Misc
Vendor
AES256
B64
Hash
MDBC
MaxmindDB
bin
cmake
dev-bin
doc
include
projects
src
t
Makefile.am
bad_databases_t.c
bad_pointers_t.c
basic_lookup_t.c
compile_c++_t.pl
data-pool-t.c
data_entry_list_t.c
data_types_t.c
dump_t.c
external_symbols_t.pl
get_value_pointer_bug_t.c
get_value_t.c
ipv4_start_cache_t.c
ipv6_lookup_in_ipv4_t.c
maxminddb_test_helper.c
maxminddb_test_helper.h
metadata_pointers_t.c
metadata_t.c
mmdblookup_t.pl
no_map_get_value_t.c
read_node_t.c
threads_t.c
version_t.c
AUTHORS
CMakeLists.txt
Changes.md
LICENSE
Makefile.am
NOTICE
README.dev.md
README.md
appveyor.yml
bootstrap
common.mk
configure.ac
PUGIXML
SQLite
SimpleIni
SimpleSocket
TinyDir
Whirlpool
CMakeLists.txt
CMakeLists.txt
Core.cpp
Core.hpp
Logger.cpp
Logger.hpp
Main.cpp
Register.cpp
SqBase.hpp
sdk
.gitignore
.gitmodules
CMakeLists.txt
LICENSE
README.md
SqMod/module/Vendor/MaxmindDB/t/ipv4_start_cache_t.c
2020-03-22 16:33:48 +02:00

37 lines
968 B
C

#include "maxminddb_test_helper.h"
void test_one_ip(MMDB_s *mmdb, const char *ip, const char *filename,
const char *mode_desc)
{
MMDB_lookup_result_s result =
lookup_string_ok(mmdb, ip, filename, mode_desc);
ok(
result.found_entry,
"got a result for an IPv4 address included in a larger-than-IPv4 subnet - %s - %s",
ip, mode_desc);
data_ok(&result, MMDB_DATA_TYPE_UTF8_STRING, "string value for IP", NULL);
}
void run_tests(int mode, const char *mode_desc)
{
const char *filename = "MaxMind-DB-no-ipv4-search-tree.mmdb";
const char *path = test_database_path(filename);
MMDB_s *mmdb = open_ok(path, mode, mode_desc);
free((void *)path);
test_one_ip(mmdb, "1.1.1.1", filename, mode_desc);
test_one_ip(mmdb, "255.255.255.255", filename, mode_desc);
MMDB_close(mmdb);
free(mmdb);
}
int main(void)
{
plan(NO_PLAN);
for_all_modes(&run_tests);
done_testing();
}