more code
This commit is contained in:
parent
32d0ec167b
commit
d286d3e6e7
@ -1 +1,2 @@
|
||||
{ "timestamp":"2023-04-18T04:14:56Z", "event":"Fileheader", "part":1, "language":"English/UK", "Odyssey":true, "gameversion":"4.0.0.1477", "build":"r291050/r0 " }
|
||||
{ "timestamp":"2023-04-18T04:15:39Z", "event":"Commander", "FID":"F123456", "Name":"DeiMuata" }
|
||||
|
@ -102,18 +102,6 @@ static void test_valid_load(void **state)
|
||||
{
|
||||
char const *filename = "Journal.2023-04-18T061507.01.log";
|
||||
|
||||
FILE *F = fopen(filename, "w");
|
||||
|
||||
assert_non_null(F);
|
||||
|
||||
fprintf(F, "{ \"timestamp\":\"2023-04-18T04:14:56Z\", "
|
||||
"\"event\":\"Fileheader\", \"part\":1, "
|
||||
"\"language\":\"English/UK\", \"Odyssey\":true, "
|
||||
"\"gameversion\":\"4.0.0.1477\", \"build\":\"r291050/r0 \" }\n"
|
||||
);
|
||||
|
||||
fclose(F);
|
||||
|
||||
EDJournalFile *file = NULL;
|
||||
EDErrorCode ret = 0;
|
||||
GError *error = NULL;
|
||||
@ -129,6 +117,35 @@ static void test_valid_load(void **state)
|
||||
g_clear_object(&file);
|
||||
}
|
||||
|
||||
static void test_valid_peek(void **state)
|
||||
{
|
||||
char const *filename = "Journal.2023-04-18T061507.01.log";
|
||||
|
||||
EDJournalFile *file = NULL;
|
||||
EDErrorCode ret = 0;
|
||||
GError *error = NULL;
|
||||
|
||||
file = ed_journal_file_new();
|
||||
assert_non_null(file);
|
||||
|
||||
ret = ed_journal_file_open(file, filename, &error);
|
||||
|
||||
assert_null(error);
|
||||
assert_int_equal(ret, ed_error_success);
|
||||
|
||||
char const *sval = NULL;
|
||||
|
||||
sval = ed_journal_file_get_commander(file);
|
||||
assert_non_null(sval);
|
||||
assert_string_equal(sval, "DeiMuata");
|
||||
|
||||
sval = ed_journal_file_get_gameversion(file);
|
||||
assert_non_null(sval);
|
||||
assert_string_equal(sval, "4.0.0.1477");
|
||||
|
||||
g_clear_object(&file);
|
||||
}
|
||||
|
||||
int main(int ac, char **av)
|
||||
{
|
||||
static const struct CMUnitTest tests[] = {
|
||||
@ -137,6 +154,7 @@ int main(int ac, char **av)
|
||||
cmocka_unit_test(test_valid_load),
|
||||
cmocka_unit_test(test_new_datetime),
|
||||
cmocka_unit_test(test_old_datetime),
|
||||
cmocka_unit_test(test_valid_peek),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user