From: Kevin Day Date: Sat, 5 Oct 2024 02:54:05 +0000 (-0500) Subject: Update: FSS Read tests, clean up syntax, and add additional range check. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=238c94dff31a97adbda8f31e002b4b242ea5d56c;p=fll Update: FSS Read tests, clean up syntax, and add additional range check. Make sure the `at` is within range in the `contents` array. Add missing NULL characters in the "payload" section of the runtime test expect files. --- diff --git a/level_3/fss_read/c/main/print/data.c b/level_3/fss_read/c/main/print/data.c index e529707..c74e924 100644 --- a/level_3/fss_read/c/main/print/data.c +++ b/level_3/fss_read/c/main/print/data.c @@ -317,26 +317,24 @@ extern "C" { } } } - else if (main->setting.flag & fss_read_main_flag_content_d) { + else if ((main->setting.flag & fss_read_main_flag_content_d) && (main->setting.feature & fss_read_feature_flag_object_as_line_d)) { // An empty Object might still have white space. - if (main->setting.contents.array[at].used && main->setting.contents.array[at].array[0].start <= main->setting.contents.array[at].array[0].stop) { + if (at < main->setting.contents.used && main->setting.contents.array[at].used && main->setting.contents.array[at].array[0].start <= main->setting.contents.array[at].array[0].stop) { - // Skip past the new line and the object opener. - if (main->setting.feature & fss_read_feature_flag_object_as_line_d) { - if (main->setting.contents.array[at].array[0].start && main->setting.contents.array[at].array[0].start - 1) { - before.stop = main->setting.contents.array[at].array[0].start - 2; + // Skip past the new line and the Object opener. + if (main->setting.contents.array[at].array[0].start && main->setting.contents.array[at].array[0].start - 1) { + before.stop = main->setting.contents.array[at].array[0].start - 2; - if (main->setting.open_object.used) { - --before.stop; - } + if (main->setting.open_object.used) { + --before.stop; + } - before.start = before.stop; + before.start = before.stop; - while (before.start && main->setting.buffer.string[before.start] != f_string_eol_s.string[0]) --before.start; + while (before.start && main->setting.buffer.string[before.start] != f_string_eol_s.string[0]) --before.start; - if (main->setting.buffer.string[before.start] == f_string_eol_s.string[0]) ++before.start; - } + if (main->setting.buffer.string[before.start] == f_string_eol_s.string[0]) ++before.start; } } } diff --git a/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-original.expect b/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-original.expect index a611209..bd8dd2b 100644 Binary files a/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-original.expect and b/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-original.expect differ diff --git a/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-select-0-original.expect b/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-select-0-original.expect index 1f0fb4c..a611209 100644 Binary files a/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-select-0-original.expect and b/level_3/fss_read/tests/runtime/fss_000e/expect/test-0003-object_space-object_and_content-select-0-original.expect differ