1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 16:57:16 +01:00
SqMod/vendor/MaxmindDB/t/no_map_get_value_t.c

35 lines
970 B
C
Raw Normal View History

2021-01-31 17:48:31 +01:00
#include "maxminddb_test_helper.h"
2021-08-22 19:15:19 +02:00
void run_tests(int mode, const char *mode_desc) {
2021-01-31 17:48:31 +01:00
const char *filename = "MaxMind-DB-string-value-entries.mmdb";
const char *path = test_database_path(filename);
MMDB_s *mmdb = open_ok(path, mode, mode_desc);
free((void *)path);
const char *ip = "1.1.1.1";
MMDB_lookup_result_s result =
lookup_string_ok(mmdb, ip, filename, mode_desc);
MMDB_entry_data_s entry_data;
int status = MMDB_get_value(&result.entry, &entry_data, NULL);
2021-08-22 19:15:19 +02:00
cmp_ok(status,
"==",
MMDB_SUCCESS,
2021-01-31 17:48:31 +01:00
"status for MMDB_get_value() is MMDB_SUCCESS");
ok(entry_data.has_data, "found a value when varargs list is just NULL");
2021-08-22 19:15:19 +02:00
cmp_ok(entry_data.type,
"==",
MMDB_DATA_TYPE_UTF8_STRING,
2021-01-31 17:48:31 +01:00
"returned entry type is utf8_string");
MMDB_close(mmdb);
free(mmdb);
}
2021-08-22 19:15:19 +02:00
int main(void) {
2021-01-31 17:48:31 +01:00
plan(NO_PLAN);
for_all_modes(&run_tests);
done_testing();
}