"Fossies" - the Fresh Open Source Software Archive

Member "libmaxminddb-1.5.2/t/metadata_pointers_t.c" (18 Feb 2021, 925 Bytes) of package /linux/misc/libmaxminddb-1.5.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "metadata_pointers_t.c": 1.5.0_vs_1.5.2.

    1 #include "maxminddb_test_helper.h"
    2 
    3 void run_tests(int mode, const char *mode_desc) {
    4     const char *filename = "MaxMind-DB-test-metadata-pointers.mmdb";
    5     const char *path = test_database_path(filename);
    6     MMDB_s *mmdb = open_ok(path, mode, mode_desc);
    7     free((void *)path);
    8 
    9     char *repeated_string = "Lots of pointers in metadata";
   10 
   11     is(mmdb->metadata.database_type,
   12        repeated_string,
   13        "decoded pointer database_type");
   14 
   15     for (uint16_t i = 0; i < mmdb->metadata.description.count; i++) {
   16         const char *language =
   17             mmdb->metadata.description.descriptions[i]->language;
   18         const char *description =
   19             mmdb->metadata.description.descriptions[i]->description;
   20         is(description, repeated_string, "%s description", language);
   21     }
   22 
   23     MMDB_close(mmdb);
   24     free(mmdb);
   25 }
   26 
   27 int main(void) {
   28     plan(NO_PLAN);
   29     for_all_modes(&run_tests);
   30     done_testing();
   31 }