]> git.ipfire.org Git - location/libloc.git/blobdiff - src/test-country.c
test: Add another country for test
[location/libloc.git] / src / test-country.c
index 99516bb8feb88261cba4d175638aa068b53ba105..2f2bd986cc106b6b450ee279d964917c9a365b38 100644 (file)
@@ -67,6 +67,14 @@ int main(int argc, char** argv) {
        // Free country
        loc_country_unref(country);
 
+       // Add another country
+       err = loc_writer_add_country(writer, &country, "YY");
+       if (err) {
+               fprintf(stderr, "Could not create country: YY\n");
+               exit(EXIT_FAILURE);
+       }
+       loc_country_unref(country);
+
        FILE* f = fopen("test.db", "w");
        if (!f) {
                fprintf(stderr, "Could not open file for writing: %s\n", strerror(errno));
@@ -97,9 +105,9 @@ int main(int argc, char** argv) {
        }
 
        // Lookup an address in the subnet
-       err = loc_database_get_country(db, &country, "XX");
+       err = loc_database_get_country(db, &country, "YY");
        if (err) {
-               fprintf(stderr, "Could not find country XX\n");
+               fprintf(stderr, "Could not find country: YY\n");
                exit(EXIT_FAILURE);
        }
        loc_country_unref(country);