try to rebuild log when first entry missing

This commit is contained in:
jlamothe 2023-11-14 19:33:02 +00:00
parent 47638ef0b7
commit a772db08ce

View File

@ -42,6 +42,7 @@ struct LogData
static void append_to_empty(TestState *);
static void append_to_existing(TestState *);
static void missing_last(TestState *);
static void missing_first(TestState *);
static void chk_last(TestState *, LogData *, const char *);
static void mk_log_data(LogData *);
@ -62,6 +63,7 @@ test_append_test_log(TestState *s)
append_to_empty(s);
append_to_existing(s);
missing_last(s);
missing_first(s);
}
// Local Functions
@ -153,6 +155,32 @@ missing_last(TestState *s)
free(ld.state.last_log);
}
static void
missing_first(TestState *s)
{
LogData ld;
print("\tfirst_log missing\n");
mk_log_data(&ld);
ld.state.first_log = 0;
append_test_log(&ld.state, "baz");
// first_log should point to second
print("\t\tfirst_log\n");
chk_ptr_eq(
s,
"ERROR: append_test_log(): first_log missing: first_log:",
ld.state.first_log,
&ld.second
);
chk_last(
s,
&ld,
"ERROR: append_test_log(): first_log missing: last_log:"
);
free(ld.state.last_log);
}
static void
chk_last(TestState *s, LogData *ld, const char *context)
{