no_map_get_value_t.c (libmaxminddb-1.5.0) | : | no_map_get_value_t.c (libmaxminddb-1.5.2) | ||
---|---|---|---|---|
#include "maxminddb_test_helper.h" | #include "maxminddb_test_helper.h" | |||
void run_tests(int mode, const char *mode_desc) | void run_tests(int mode, const char *mode_desc) { | |||
{ | ||||
const char *filename = "MaxMind-DB-string-value-entries.mmdb"; | const char *filename = "MaxMind-DB-string-value-entries.mmdb"; | |||
const char *path = test_database_path(filename); | const char *path = test_database_path(filename); | |||
MMDB_s *mmdb = open_ok(path, mode, mode_desc); | MMDB_s *mmdb = open_ok(path, mode, mode_desc); | |||
free((void *)path); | free((void *)path); | |||
const char *ip = "1.1.1.1"; | const char *ip = "1.1.1.1"; | |||
MMDB_lookup_result_s result = | MMDB_lookup_result_s result = | |||
lookup_string_ok(mmdb, ip, filename, mode_desc); | lookup_string_ok(mmdb, ip, filename, mode_desc); | |||
MMDB_entry_data_s entry_data; | MMDB_entry_data_s entry_data; | |||
int status = MMDB_get_value(&result.entry, &entry_data, NULL); | int status = MMDB_get_value(&result.entry, &entry_data, NULL); | |||
cmp_ok(status, "==", MMDB_SUCCESS, | cmp_ok(status, | |||
"==", | ||||
MMDB_SUCCESS, | ||||
"status for MMDB_get_value() is MMDB_SUCCESS"); | "status for MMDB_get_value() is MMDB_SUCCESS"); | |||
ok(entry_data.has_data, "found a value when varargs list is just NULL"); | ok(entry_data.has_data, "found a value when varargs list is just NULL"); | |||
cmp_ok(entry_data.type, "==", MMDB_DATA_TYPE_UTF8_STRING, | cmp_ok(entry_data.type, | |||
"==", | ||||
MMDB_DATA_TYPE_UTF8_STRING, | ||||
"returned entry type is utf8_string"); | "returned entry type is utf8_string"); | |||
MMDB_close(mmdb); | MMDB_close(mmdb); | |||
free(mmdb); | free(mmdb); | |||
} | } | |||
int main(void) | int main(void) { | |||
{ | ||||
plan(NO_PLAN); | plan(NO_PLAN); | |||
for_all_modes(&run_tests); | for_all_modes(&run_tests); | |||
done_testing(); | done_testing(); | |||
} | } | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added |