X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=t%2Fsrc%2Fgom_write.c;h=fd73319678910f35f21b18fb6baf43e5c5fe0b0e;hb=480d2b0a13a25c0a67d8a1006465b0b35966fe06;hp=65aef2e597d3438f2568d269e511c76966b5bcf5;hpb=560a739640bb8ab266e1335afb9a8cef9eb4f1aa;p=gedcom-parse.git diff --git a/t/src/gom_write.c b/t/src/gom_write.c index 65aef2e..fd73319 100644 --- a/t/src/gom_write.c +++ b/t/src/gom_write.c @@ -73,13 +73,12 @@ int update_header(char* encoding) if (head == NULL) return 1; else { - /* - value = gom_set_string(&head->charset.name, encoding); - if (value == NULL || strcmp(value, encoding)) - return 1; - else - return 0; - */ + /* force warning for anything except UNICODE */ + if (!strcmp(encoding, "UNICODE")) { + value = gom_set_string(&head->charset.name, encoding); + if (value == NULL || strcmp(value, encoding)) + return 1; + } value = gom_set_string(&head->note, long_note); if (value == NULL || strcmp(value, long_note)) return 1; @@ -88,11 +87,34 @@ int update_header(char* encoding) } } -int main(int argc, char* argv[]) +int test_timestamps() { - int result; + int result = 0; struct tm* tm_ptr; time_t tval; + /* Make sure we get a reproduceable output, in different timezones */ + tval = TIMESTAMP; + tm_ptr = gmtime(&tval); + tm_ptr->tm_isdst = 0; + tval = mktime(tm_ptr); + result = gom_header_update_timestamp(tval); + + /* Also change timestamp of submitter */ + if (result == 0) { + struct submitter* subm = gom_get_first_submitter(); + if (!subm) + result = 100; + else { + result = gom_update_timestamp(&(subm->change_date), tval); + } + } + + return result; +} + +int main(int argc, char* argv[]) +{ + int result; int total_conv_fails = 0; char* outfilename = NULL; char* infilename = NULL; @@ -226,14 +248,8 @@ int main(int argc, char* argv[]) if (result == 0) result |= update_header(encoding); } - /* Make sure we get a reproduceable output, in different timezones */ - if (result == 0) { - tval = TIMESTAMP; - tm_ptr = gmtime(&tval); - tm_ptr->tm_isdst = 0; - tval = mktime(tm_ptr); - result = gom_header_update_timestamp(tval); - } + if (result == 0) + result |= test_timestamps(); if (result == 0) result |= gom_write_file(gedfilename, &total_conv_fails); if (result == 0 && total_conv_fails == 0) {