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-test-metadata-pointers.mmdb";
|
|
|
|
const char *path = test_database_path(filename);
|
|
|
|
MMDB_s *mmdb = open_ok(path, mode, mode_desc);
|
|
|
|
free((void *)path);
|
|
|
|
|
|
|
|
char *repeated_string = "Lots of pointers in metadata";
|
|
|
|
|
2021-08-22 19:15:19 +02:00
|
|
|
is(mmdb->metadata.database_type,
|
|
|
|
repeated_string,
|
2021-01-31 17:48:31 +01:00
|
|
|
"decoded pointer database_type");
|
|
|
|
|
|
|
|
for (uint16_t i = 0; i < mmdb->metadata.description.count; i++) {
|
|
|
|
const char *language =
|
|
|
|
mmdb->metadata.description.descriptions[i]->language;
|
|
|
|
const char *description =
|
|
|
|
mmdb->metadata.description.descriptions[i]->description;
|
|
|
|
is(description, repeated_string, "%s description", language);
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|