]> Kevux Git Server - fll/commitdiff
Progress: Begin working on extended list, embedded list, and anything else.
authorKevin Day <Kevin@kevux.org>
Fri, 2 Oct 2026 01:33:00 +0000 (20:33 -0500)
committerKevin Day <Kevin@kevux.org>
Fri, 2 Oct 2026 01:33:00 +0000 (20:33 -0500)
27 files changed:
level_1/fl_fss/c/fss/basic_list.c
level_1/fl_fss/c/fss/extended_list.c
level_1/fl_fss/data/tests/contents/embedded_list-combining_read-1.txt
level_1/fl_fss/data/tests/contents/embedded_list-combining_read-2.txt
level_1/fl_fss/data/tests/contents/embedded_list-combining_read-3.txt
level_1/fl_fss/data/tests/contents/embedded_list-combining_read-4.txt
level_1/fl_fss/data/tests/contents/extended_list-combining_read-1.txt
level_1/fl_fss/data/tests/contents/extended_list-combining_read-2.txt
level_1/fl_fss/data/tests/contents/extended_list-combining_read-3.txt
level_1/fl_fss/data/tests/contents/extended_list-combining_read-4.txt
level_1/fl_fss/data/tests/contents/extended_list-combining_read-5.txt [deleted file]
level_1/fl_fss/data/tests/counts/extended_list-combining_read.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/objects/embedded_list-combining_read.txt
level_1/fl_fss/data/tests/objects/extended_list-combining_read.txt
level_1/fl_fss/data/tests/strings/embedded_list-combining_read.txt
level_1/fl_fss/data/tests/strings/extended_list-combining_read.txt
level_1/fl_fss/tests/unit/c/test-fss-basic_content_read.c
level_1/fl_fss/tests/unit/c/test-fss-basic_list_content_read.c
level_1/fl_fss/tests/unit/c/test-fss-basic_list_object_read.c
level_1/fl_fss/tests/unit/c/test-fss-basic_object_read.c
level_1/fl_fss/tests/unit/c/test-fss-embedded_list_content_read.c
level_1/fl_fss/tests/unit/c/test-fss-embedded_list_object_read.c
level_1/fl_fss/tests/unit/c/test-fss-extended_content_read.c
level_1/fl_fss/tests/unit/c/test-fss-extended_list_content_read.c
level_1/fl_fss/tests/unit/c/test-fss-extended_list_object_read.c
level_1/fl_fss/tests/unit/c/test-fss-extended_object_read.c
level_1/fl_fss/tests/unit/c/test-fss.c

index a6477ca81973fcb567f92ac4d74a4d4ffd47e226..57f3fd1d371db583ede8133ce8ccbb7e7d5bb084 100644 (file)
@@ -49,12 +49,12 @@ extern "C" {
     const f_number_unsigned_t begin = range->start;
     found->array[found->used].start = range->start;
 
+    f_number_unsigned_t comment_delimit = 0;
     f_number_unsigned_t newline_last = begin;
     f_number_unsigned_t previous = 0;
     f_number_unsigned_t slash_first = 0;
     f_number_unsigned_t slash_count = 0;
     f_number_unsigned_t start = begin;
-    f_number_unsigned_t comment_delimit = 0;
 
     uint8_t flag_fl = ___fl_flag_has_graph_first___;
 
index 7b7ea9ee9217f8bc948226a2c156cb0699641267..ca367a9fdb56845feaf47d4dd6d2a72943bd1d93 100644 (file)
@@ -37,14 +37,23 @@ extern "C" {
     state->status = f_memory_array_increase(state->step_small, sizeof(f_range_t), (void **) &found->array, &found->used, &found->size);
     if (F_status_is_error(state->status)) return;
 
+    #define ___fl_flag_do_escape___                       0x1
+    #define ___fl_flag_has_graph_first___                 0x2
+    #define ___fl_flag_has_graph_first_do_escape___       0x3
+    #define ___fl_flag_has_delimit_comment___             0x4
+    #define ___fl_flag_has_delimit_comment_graph_first___ 0x6
+
     const f_number_unsigned_t delimits_used = delimits->used;
     const f_number_unsigned_t comments_used = comments->used;
 
     f_number_unsigned_t line_start = range->start;
     f_number_unsigned_t newline_last = range->start;
+    f_number_unsigned_t previous = 0;
     f_number_unsigned_t slash_first = 0;
     f_number_unsigned_t comment_start = 0;
 
+    uint8_t flag_fl = ___fl_flag_has_graph_first___;
+
     found->array[found->used].start = range->start;
 
     // Identify where the content ends.
@@ -59,6 +68,7 @@ extern "C" {
       if (F_status_is_error(state->status)) break;
 
       if (state->status == F_okay_eol) {
+        flag_fl |= ___fl_flag_has_graph_first___;
         newline_last = range->start++;
         line_start = range->start;
 
@@ -225,6 +235,11 @@ extern "C" {
     }
 
     state->status = F_fss_found_content_not;
+
+    #undef ___fl_flag_do_escape___
+    #undef ___fl_flag_has_graph_first___
+    #undef ___fl_flag_has_delimit_comment___
+    #undef ___fl_flag_has_delimit_comment_graph_first___
   }
 #endif // _di_fl_fss_extended_list_content_read_
 
index 311e0a56196063f0b20337190b3a1897e3031b32..dc1e830211ffe79370e62523b3d6a6607df42f22 100644 (file)
@@ -1 +1,3 @@
   is_second and content 2.
+ ́{
+  has ́ content 3.
index 652a208a4da41cccc5e295552841a07b11af04f4..96487d57a8e415215d50943411f9daa3ab207b61 100644 (file)
@@ -1 +1 @@
-  has ́ content 3.
+  has ͜no_space content 4.
index 96487d57a8e415215d50943411f9daa3ab207b61..78c611949a9d7df34f6f810bbd37eeb6c09f8875 100644 (file)
@@ -1 +1 @@
-  has ͜no_space content 4.
+  content 5.
index 78c611949a9d7df34f6f810bbd37eeb6c09f8875..a5e0c698b8c7e74c10ee013666695091d73f6eb0 100644 (file)
@@ -1 +1,2 @@
-  content 5.
+  sixtẖ̚ is content 6.
+  not a valid list {́
index 311e0a56196063f0b20337190b3a1897e3031b32..518af0b8f0202700b709d0115dbe5f7d85a42f07 100644 (file)
@@ -1 +1,3 @@
+ ́
   is_second and content 2.
+  does have ́ content 3. 
index 652a208a4da41cccc5e295552841a07b11af04f4..96487d57a8e415215d50943411f9daa3ab207b61 100644 (file)
@@ -1 +1 @@
-  has ́ content 3.
+  has ͜no_space content 4.
index 96487d57a8e415215d50943411f9daa3ab207b61..78c611949a9d7df34f6f810bbd37eeb6c09f8875 100644 (file)
@@ -1 +1 @@
-  has ͜no_space content 4.
+  content 5.
index 78c611949a9d7df34f6f810bbd37eeb6c09f8875..51eaa89ac10d93d041f06bf88c0035c74e8a8991 100644 (file)
@@ -1 +1,2 @@
-  content 5.
+  sixtẖ̚ is content 6.
+  not a valid list{:́
diff --git a/level_1/fl_fss/data/tests/contents/extended_list-combining_read-5.txt b/level_1/fl_fss/data/tests/contents/extended_list-combining_read-5.txt
deleted file mode 100644 (file)
index d765694..0000000
+++ /dev/null
@@ -1 +0,0 @@
-  sixtẖ̚ is content 6.
diff --git a/level_1/fl_fss/data/tests/counts/extended_list-combining_read.txt b/level_1/fl_fss/data/tests/counts/extended_list-combining_read.txt
new file mode 100644 (file)
index 0000000..627e109
--- /dev/null
@@ -0,0 +1,5 @@
+1
+1
+1
+1
+1
index d2132bf517b75ecd3a1e26de6bd8092901efb2a8..b540243f905fd0bbd29c55b5dc7821354b71035e 100644 (file)
@@ -1,6 +1,5 @@
 first valid.
 is_second and does not have embedded new line.
- ́
 fourth ͜no_space
 fifth is valid.
 sixtẖ̚ is valid with two combiners.
index d2132bf517b75ecd3a1e26de6bd8092901efb2a8..b540243f905fd0bbd29c55b5dc7821354b71035e 100644 (file)
@@ -1,6 +1,5 @@
 first valid.
 is_second and does not have embedded new line.
- ́
 fourth ͜no_space
 fifth is valid.
 sixtẖ̚ is valid with two combiners.
index 433b56920fc42c3d904a1ac8909880de5de1a22c..a20d70e1a88d4f20e1563f910602b2512f51ea1e 100644 (file)
@@ -3,10 +3,10 @@ first valid.{
 }
 is_second and does not have embedded new line.{
   is_second and content 2.
-}
  ́{
   has ́ content 3.
 }
+}
 fourth ͜no_space{
   has ͜no_space content 4.
 }
@@ -15,6 +15,6 @@ fifth is valid.{
 }
 sixtẖ̚ is valid with two combiners.{
   sixtẖ̚ is content 6.
-}
-  not a valid list{́
+  not a valid list {́
+  }
 }
index 433b56920fc42c3d904a1ac8909880de5de1a22c..9b8083371bbb652466e8ef5dfcdb1eaecb1618b3 100644 (file)
@@ -2,10 +2,9 @@ first valid.{
   content 1.
 }
 is_second and does not have embedded new line.{
+́
   is_second and content 2.
-}
- ́{
-  has ́ content 3.
+  does have ́ content 3.
 }
 fourth ͜no_space{
   has ͜no_space content 4.
@@ -15,6 +14,5 @@ fifth is valid.{
 }
 sixtẖ̚ is valid with two combiners.{
   sixtẖ̚ is content 6.
-}
-  not a valid list{́
+  not a valid list{:́
 }
index 511fec3ef19fb4216adc931b837d79c9a3e6df87..89bbf6a2f62e7e9418a7e7e2d3af3294ced28683 100644 (file)
@@ -133,7 +133,7 @@ void test__fl_fss_basic_content_read__works(void **void_state) {
       assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      line_content[result - 1] = 0;
+      line_content[result ? result - 1 : 0] = 0;
 
       state.status = F_none;
       range.start = 0;
@@ -325,7 +325,7 @@ void test__fl_fss_basic_content_read__works_using_combining(void **void_state) {
       assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      line_content[result - 1] = 0;
+      line_content[result ? result - 1 : 0] = 0;
 
       state.status = F_none;
       range.start = 0;
index 76cbf1f03c974d58461cc4cdcc59967c4702bac4..f9dc447add4672737bf2ebad9a2a7db6d2707cbd 100644 (file)
@@ -203,12 +203,7 @@ void test__fl_fss_basic_list_content_read__works(void **void_state) {
         result = getline(&line_content[i], &max, file_contents[i]);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        if (result > 0) {
-          line_content[i][result - 1] = 0;
-        }
-        else {
-          line_content[i][0] = 0;
-        }
+        line_content[i][result > 0 ? result - 1 : 0] = 0;
       } // or
 
       state.status = F_none;
@@ -434,15 +429,10 @@ void test__fl_fss_basic_list_content_read__works_using_combining(void **void_sta
         printf("[ -------> ] --- [03] Failure with getline() for objects, with set %lu, result is negative.\n", set);
       }
 
-      assert_true(result >= 0);
+      assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      if (result) {
-        line_object[result - 1] = 0;
-      }
-      else {
-        line_object[0] = 0;
-      }
+      line_object[result ? result - 1 : 0] = 0;
 
       max = 255;
 
index 8a195db3cd70aec20c185be476034d066cf0b965..d23a14dca0e2b0478073c5ff02ba1e8fe9fd7060 100644 (file)
@@ -144,7 +144,7 @@ void test__fl_fss_basic_list_object_read__works(void **void_state) {
         assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_object[result - 1] = 0;
+        line_object[result ? result - 1 : 0] = 0;
 
         if (found.start <= found.stop) {
           {
index 24ec27b60a43b836d0bea322daa74dd15c228e92..e97030e37962e79afcd777240bf09c3705a2e955 100644 (file)
@@ -173,10 +173,11 @@ void test__fl_fss_basic_object_read__works(void **void_state) {
       max = 255;
 
       result = getline(&line_object, &max, file_objects);
+
       assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      line_object[result - 1] = 0;
+      line_object[result ? result - 1 : 0] = 0;
 
       state.status = F_none;
       range.start = 0;
@@ -299,7 +300,7 @@ void test__fl_fss_basic_object_read__works_using_combining(void **void_state) {
       assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      line_object[result - 1] = 0;
+      line_object[result ? result - 1 : 0] = 0;
 
       state.status = F_none;
       range.start = 0;
index 906783f84906f6c64e354b0110cf227c064b02be..de6241d7d74c0fe70f9bbc6845214f05cecbc11a 100644 (file)
@@ -248,12 +248,7 @@ void test__fl_fss_embedded_list_content_read__works(void **void_state) {
         result = getline(&line_content[i], &max, file_contents[i]);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        if (result > 0) {
-          line_content[i][result - 1] = 0;
-        }
-        else {
-          line_content[i][0] = 0;
-        }
+        line_content[i][result > 0 ? result - 1 : 0] = 0;
       } // or
 
       state.status = F_none;
@@ -417,13 +412,10 @@ void test__fl_fss_embedded_list_content_read__works_using_combining(void **void_
 
         result = getline(&line_content[i], &max, file_contents[i]);
 
+        assert_return_code(result, 0);
+
         // The newline is copied by getline(), and so remove that newline before comparing.
-        if (result > 0) {
-          line_content[i][result - 1] = 0;
-        }
-        else {
-          line_content[i][0] = 0;
-        }
+        line_content[i][result ? result - 1 : 0] = 0;
       } // or
 
       state.status = F_none;
index 0ed8f75070022c3297960323209d3ed519c37ff9..10cef3d75f769a1a15f403382d95f3e9ad8376d7 100644 (file)
@@ -144,7 +144,7 @@ void test__fl_fss_embedded_list_object_read__works(void **void_state) {
         assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_object[result - 1] = 0;
+        line_object[result ? result - 1 : 0] = 0;
 
         if (found.start <= found.stop) {
           {
@@ -292,7 +292,7 @@ void test__fl_fss_embedded_list_object_read__works_using_combining(void **void_s
         assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_object[result - 1] = 0;
+        line_object[result ? result - 1 : 0] = 0;
 
         if (found.start <= found.stop) {
           {
index 521858b0731caf0b30586a46684e0ca7dda7f32d..693a3dcc6f2aa8a17bfb38524a7c735c70d2856a 100644 (file)
@@ -205,10 +205,9 @@ void test__fl_fss_extended_content_read__works(void **void_state) {
         max = 255;
 
         result = getline(&line_content[i], &max, file_contents[i]);
-        assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_content[i][result - 1] = 0;
+        line_content[i][result > 0 ? result - 1 : 0] = 0;
       } // or
 
       state.status = F_none;
@@ -415,7 +414,7 @@ void test__fl_fss_extended_content_read__works_using_combining(void **void_state
         assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_content[i][result - 1] = 0;
+        line_content[i][result ? result - 1 : 0] = 0;
       } // for
 
       state.status = F_none;
index 85118934b063c488d0e96127eb5544dca7a23889..8b26865d2849480ee4de592f6f48e4b546d8d5e3 100644 (file)
@@ -334,12 +334,7 @@ void test__fl_fss_extended_list_content_read__works(void **void_state) {
         result = getline(&line_content[i], &max, file_contents[i]);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        if (result > 0) {
-          line_content[i][result - 1] = 0;
-        }
-        else {
-          line_content[i][0] = 0;
-        }
+        line_content[i][result > 0 ? result - 1 : 0] = 0;
       } // or
 
       state.status = F_none;
@@ -465,6 +460,9 @@ void test__fl_fss_extended_list_content_read__works_using_combining(void **void_
 
   {
     // Note: These files are required to have the same number of lines and each line should probably be at max 255 characters.
+    FILE *file_counts = data__file_open__named("counts", "extended_list", "combining_read");
+    FILE *file_matches = data__file_open__named("matches", "extended_list", "combining_read");
+    FILE *file_objects = data__file_open__named("objects", "extended_list", "combining_read");
     FILE *file_strings = data__file_open__named("strings", "extended_list", "combining_read");
 
     FILE *file_contents[] = {
@@ -473,183 +471,289 @@ void test__fl_fss_extended_list_content_read__works_using_combining(void **void_
       data__file_open__named_at("contents", "extended_list", "combining_read", 2),
       data__file_open__named_at("contents", "extended_list", "combining_read", 3),
       data__file_open__named_at("contents", "extended_list", "combining_read", 4),
-      data__file_open__named_at("contents", "extended_list", "combining_read", 5),
     };
 
+    assert_non_null(file_counts);
+    assert_non_null(file_matches);
+    assert_non_null(file_objects);
     assert_non_null(file_strings);
     assert_non_null(file_contents[0]);
     assert_non_null(file_contents[1]);
     assert_non_null(file_contents[2]);
     assert_non_null(file_contents[3]);
     assert_non_null(file_contents[4]);
-    assert_non_null(file_contents[5]);
 
+    const uint8_t sets_total = 5;
+
+    int counts = 0;
+    int matches = 0;
     size_t max = 0;
-    char *line_string = 0;
-    char *line_content[] = {
-      0,
-      0,
-      0,
-      0,
-      0,
-      0,
-    };
     ssize_t result = 0;
-    const uint8_t total_content = 6;
 
-    f_string_static_t buffer_string = f_string_static_t_initialize;
+    char *line_counts = 0;
+    char *line_matches = 0;
+    char *line_object = 0;
 
-    f_state_t state = f_state_t_initialize;
     f_range_t close = f_range_t_initialize;
     f_range_t range = f_range_t_initialize;
     f_range_t found_object = f_range_t_initialize;
-    f_ranges_t found = f_ranges_t_initialize;
+    f_ranges_t found_content = f_ranges_t_initialize;
     f_ranges_t comments = f_ranges_t_initialize;
+
+    f_state_t state = f_state_t_initialize;
+    f_status_t status_object = F_okay;
     f_uint8s_t quotes = f_uint8s_t_initialize;
     f_number_unsigneds_t delimits = f_number_unsigneds_t_initialize;
-    f_string_dynamic_t result_string = f_string_dynamic_t_initialize;
-    f_string_dynamic_t delimit_string = f_string_dynamic_t_initialize;
-    f_status_t status_object = F_okay;
 
-    for (;;) {
+    f_string_dynamic_t set_delimit = f_string_dynamic_t_initialize;
+    f_string_dynamic_t set_result = f_string_dynamic_t_initialize;
+    f_string_dynamic_t set_strings = f_string_dynamic_t_initialize;
+
+    f_string_dynamic_t set_contents[] = {
+      macro_f_string_dynamic_t_initialize_2(0, 0),
+      macro_f_string_dynamic_t_initialize_2(0, 0),
+      macro_f_string_dynamic_t_initialize_2(0, 0),
+      macro_f_string_dynamic_t_initialize_2(0, 0),
+      macro_f_string_dynamic_t_initialize_2(0, 0),
+    };
+
+    {
+      const f_status_t status = data__file_load_buffer(file_strings, &set_strings);
+
+      if (F_status_is_error(status)) {
+        printf("[ -------> ] --- [00] Failure with data__file_load_buffer() for loading file strings, status=%u has error bit set.\n", status);
+      }
+
+      assert_true(F_status_is_error_not(status));
+    }
+
+    for (uint8_t i = 0; i < sets_total; ++i) {
+
+      const f_status_t status = data__file_load_buffer(file_contents[i], &set_contents[i]);
+
+      if (F_status_is_error(status)) {
+        printf("[ -------> ] --- [01] Failure with data__file_load_buffer() for loading file contents at %u, status=%u has error bit set.\n", i, status);
+      }
+
+      assert_true(F_status_is_error_not(state.status));
+    } // for
+
+    {
+      const f_status_t status = f_string_dynamic_append(set_strings, &set_delimit);
+
+      if (status != F_okay) {
+        printf("[ -------> ] --- [02] Failure with f_string_dynamic_append() for preparing delimit string, status=%u, expected=%u.\n", status, F_okay);
+      }
+
+      assert_int_equal(status, F_okay);
+    }
+
+    range.start = 0;
+    range.stop = set_strings.used - 1;
+
+    for (f_number_unsigned_t set = 0; set < sets_total; ++set) {
 
       max = 255;
 
-      result = getline(&line_string, &max, file_strings);
-      if (result == -1) break;
+      result = getline(&line_object, &max, file_objects);
 
-      buffer_string.string = line_string;
-      buffer_string.used = (f_number_unsigned_t) result;
-      buffer_string.size = buffer_string.used;
+      if (result < 0) {
+        printf("[ -------> ] --- [03] Failure with getline() for objects, with set %lu, result is negative.\n", set);
+      }
 
-      for (uint8_t i = 0; i < total_content; ++i) {
+      assert_return_code(result, 0);
 
-        max = 255;
+      // The newline is copied by getline(), and so remove that newline before comparing.
+      line_object[result ? result - 1 : 0] = 0;
 
-        result = getline(&line_content[i], &max, file_contents[i]);
+      max = 255;
 
-        // The newline is copied by getline(), and so remove that newline before comparing.
-        if (result > 0) {
-          line_content[i][result - 1] = 0;
-        }
-      } // or
+      result = getline(&line_matches, &max, file_matches);
+
+      if (result < 0) {
+        printf("[ -------> ] --- [04] Failure with getline() for matches, with set %lu, result is negative.\n", set);
+      }
+
+      assert_true(result >= 0);
+
+      matches = atoi(line_matches);
 
-      state.status = F_none;
-      range.start = 0;
-      range.stop = buffer_string.used - 1;
       found_object.start = 1;
       found_object.stop = 0;
+      state.status = F_none;
 
-      fl_fss_extended_list_object_read(buffer_string, &range, &found_object, &delimits, &state);
+      fl_fss_extended_list_object_read(set_strings, &range, &found_object, &delimits, &state);
 
-      assert_true(state.status == F_fss_found_object || state.status == F_fss_found_object_not);
+      if (matches) {
+
+        // When matches is 2, then this matches both object and content.
+        if (matches == 2) {
+          if (!(state.status == F_fss_found_object)) {
+            printf("[ -------> ] --- [05] Failure with fl_fss_extended_list_object_read(), with set %lu, matches=%d, status=%u, expected %u.\n", set, matches, state.status, F_fss_found_object);
+          }
+
+          assert_true(state.status == F_fss_found_object);
+        }
+
+        // When matches is 1, then this matches only object.
+        else {
+          if (!(state.status == F_fss_found_object_content_not)) {
+            printf("[ -------> ] --- [06] Failure with fl_fss_extended_list_object_read(), with set %lu, matches=%d, status=%u, expected %u.\n", set, matches, state.status, F_fss_found_object_content_not);
+          }
+
+          assert_true(state.status == F_fss_found_object_content_not);
+        }
+      }
+      else {
+        if (!(state.status == F_fss_found_object_not)) {
+          printf("[ -------> ] --- [07] Failure with with fl_fss_extended_list_object_read(), set %lu, matches=%d, status=%u, expected %u.\n", set, matches, state.status, F_fss_found_object_not);
+        }
+
+        assert_true(state.status == F_fss_found_object_not);
+      }
 
       status_object = state.status;
       state.status = F_none;
 
       if (status_object == F_fss_found_object) {
-        fl_fss_extended_list_content_read(buffer_string, &range, &found, &close, &delimits, &comments, &state);
+
+        // The Object had to be read before getting to the Content, so test it as well.
+        {
+          const f_status_t status = data__extract_from_source(set_strings, found_object, &set_result);
+
+          if (F_status_is_error(status)) {
+            printf("[ -------> ] --- [14] Failure with data__extract_from_source() for extract object, with set %lu, status=%u has error bit set.\n", set, status);
+          }
+
+          assert_true(F_status_is_error_not(status));
+        }
+
+        if (strcmp(set_result.string, line_object)) {
+          printf("[ -------> ] --- [09] Failure with set %lu, object strings do not match.\n", set);
+        }
+
+        assert_string_equal(set_result.string, line_object);
+
+        max = 255;
+
+        result = getline(&line_counts, &max, file_counts);
+
+        if (result < 0) {
+          printf("[ -------> ] --- [10] Failure with getline() for counts, with set %lu, result is negative.\n", set);
+        }
+
+        assert_true(result >= 0);
+
+        counts = atoi(line_counts);
+
+        fl_fss_extended_list_content_read(set_strings, &range, &found_content, &close, &delimits, &comments, &state);
+
+        if (!(state.status == F_fss_found_content || state.status == F_data_not)) {
+          printf("[ -------> ] --- [11] Failure with fl_fss_extended_list_content_read(), with set %lu, status=%u, expected %u, or %u.\n", set, state.status, F_fss_found_content, F_data_not);
+        }
 
         assert_true(state.status == F_fss_found_content || state.status == F_data_not);
 
         if (state.status == F_fss_found_content) {
-          assert_true(found.used);
-          assert_true(found.used <= (f_number_unsigned_t) total_content);
-
-          {
-            const f_status_t status = f_string_dynamic_append(buffer_string, &delimit_string);
-            assert_int_equal(status, F_okay);
+          if (!found_content.used) {
+            printf("[ -------> ] --- [12] Failure with fl_fss_extended_list_content_read(), with set %lu, expected found_content.used (%lu) <> 0.\n", set, found_content.used);
           }
 
-          state.status = F_none;
+          assert_true(found_content.used);
 
-          f_fss_apply_delimit(delimits, &delimit_string, &state);
-          assert_int_equal(state.status, F_okay);
+          if (found_content.used != (f_number_unsigned_t) counts) {
+            printf("[ -------> ] --- [13] Failure with fl_fss_extended_list_content_read(), with set %lu, expected found_content.used (%lu) == %lu, found = '%s', expected = '%s'.\n", set, found_content.used, (f_number_unsigned_t) counts, set_result.string ? set_result.string : "", set_contents[set].string ? set_contents[set].string : "");
+          }
 
-          {
-            uint8_t i = 0;
+          assert_true(found_content.used == (f_number_unsigned_t) counts);
 
-            for (; i < found.used; ++i) {
+          state.status = F_none;
 
-              result_string.used = 0;
+          f_fss_apply_delimit(delimits, &set_delimit, &state);
 
-              {
-                const f_status_t status = f_string_dynamic_partial_append_nulless(delimit_string, found.array[i], &result_string);
-                assert_true(status == F_okay || status == F_data_not_eos);
-              }
+          if (state.status != F_okay) {
+            printf("[ -------> ] --- [14] Failure with f_fss_apply_delimit(), with set %lu, status=%u, expected=%u.\n", set, state.status, F_okay);
+          }
 
-              {
-                const f_status_t status = f_string_dynamic_terminate_after(&result_string);
-                assert_int_equal(status, F_okay);
-              }
+          assert_int_equal(state.status, F_okay);
 
-              assert_string_equal(result_string.string, line_content[i]);
-            } // for
+          {
+            const f_status_t status = data__extract_from_source(set_delimit, found_content.array[0], &set_result);
 
-            // All remaining positions in the file need to be a zero length string.
-            for (; i < total_content; ++i) {
-              assert_int_equal(line_content[i][0], 0);
+            if (F_status_is_error(status)) {
+              printf("[ -------> ] --- [15] Failure with data__extract_from_source() for extract set contents, with set %lu, status=%u has error bit set.\n", set, status);
             }
+
+            assert_true(F_status_is_error_not(status));
+          }
+
+          if (strcmp(set_result.string, set_contents[set].string)) {
+            printf("[ -------> ] --- [16] Failure with set %lu, content strings do not match.\n", set);
           }
+
+          assert_string_equal(set_result.string, set_contents[set].string);
         }
         else {
-          assert_true(!found.used);
+          if (found_content.used) {
+            printf("[ -------> ] --- [17] Failure with set %lu, should not have any content, but match %lu.\n", set, found_content.used);
+          }
+
+          assert_true(!found_content.used);
         }
       }
 
-      if (line_string) free(line_string);
-      if (result_string.string) free(result_string.string);
-      if (delimit_string.string) free(delimit_string.string);
-      if (delimits.array) free(delimits.array);
-      if (found.array) free(found.array);
       if (comments.array) free(comments.array);
+      if (delimits.array) free(delimits.array);
+      if (found_content.array) free(found_content.array);
       if (quotes.array) free(quotes.array);
 
-      for (uint8_t i = 0; i < total_content; ++i) {
-
-        if (line_content[i]) free(line_content[i]);
-
-        line_content[i] = 0;
-      } // for
+      if (line_counts) free(line_counts);
+      if (line_matches) free(line_matches);
+      if (line_object) free(line_object);
+      if (set_result.string) free(set_result.string);
 
-      line_string = 0;
-      result_string.string = 0;
-      result_string.used = 0;
-      result_string.size = 0;
-      delimit_string.string = 0;
-      delimit_string.used = 0;
-      delimit_string.size = 0;
-      delimits.array = 0;
-      delimits.used = 0;
-      delimits.size = 0;
-      found.array = 0;
-      found.used = 0;
-      found.size = 0;
       comments.array = 0;
       comments.used = 0;
       comments.size = 0;
+      delimits.array = 0;
+      delimits.used = 0;
+      delimits.size = 0;
+      found_content.array = 0;
+      found_content.used = 0;
+      found_content.size = 0;
+      line_counts = 0;
+      line_matches = 0;
+      line_object = 0;
       quotes.array = 0;
       quotes.used = 0;
       quotes.size = 0;
+      set_result.string = 0;
+      set_result.used = 0;
+      set_result.size = 0;
     } // for
 
-    for (uint8_t i = 0; i < total_content; ++i) {
+    for (uint8_t i = 0; i < sets_total; ++i) {
 
       if (file_contents[i]) fclose(file_contents[i]);
-      if (line_content[i]) free(line_content[i]);
-
-      line_content[i] = 0;
+      if (set_contents[i].string) free(set_contents[i].string);
     } // for
 
+    if (line_counts) free(line_counts);
+    if (line_matches) free(line_matches);
+    if (line_object) free(line_object);
+    if (set_delimit.string) free(set_delimit.string);
+    if (set_result.string) free(set_result.string);
+    if (set_strings.string) free(set_strings.string);
+
+    if (file_counts) fclose(file_counts);
+    if (file_matches) fclose(file_matches);
+    if (file_objects) fclose(file_objects);
     if (file_strings) fclose(file_strings);
 
-    if (delimits.array) free(delimits.array);
-    if (found.array) free(found.array);
     if (comments.array) free(comments.array);
+    if (delimits.array) free(delimits.array);
+    if (found_content.array) free(found_content.array);
     if (quotes.array) free(quotes.array);
-    if (line_string) free(line_string);
-    if (result_string.string) free(result_string.string);
-    if (delimit_string.string) free(delimit_string.string);
   }
 }
 
index 90ae13ecf7b5954fec8f87b765b8fe0fa40d8182..c18531f7579c7bd6f8401d4986617e4bf026f31c 100644 (file)
@@ -144,7 +144,7 @@ void test__fl_fss_extended_list_object_read__works(void **void_state) {
         assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_object[result - 1] = 0;
+        line_object[result ? result - 1 : 0] = 0;
 
         if (found.start <= found.stop) {
           {
@@ -292,7 +292,7 @@ void test__fl_fss_extended_list_object_read__works_using_combining(void **void_s
         assert_return_code(result, 0);
 
         // The newline is copied by getline(), and so remove that newline before comparing.
-        line_object[result - 1] = 0;
+        line_object[result ? result - 1 : 0] = 0;
 
         if (found.start <= found.stop) {
           {
index c5f79d174f748d0865d4c6ee38625f5bf02ea6f7..028382ae77c1db6c2f35ca99b72ec3d64fce801e 100644 (file)
@@ -189,10 +189,11 @@ void test__fl_fss_extended_object_read__works(void **void_state) {
       max = 255;
 
       result = getline(&line_object, &max, file_objects);
+
       assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      line_object[result - 1] = 0;
+      line_object[result ? result - 1 : 0] = 0;
 
       state.status = F_none;
       range.start = 0;
@@ -315,7 +316,7 @@ void test__fl_fss_extended_object_read__works_using_combining(void **void_state)
       assert_return_code(result, 0);
 
       // The newline is copied by getline(), and so remove that newline before comparing.
-      line_object[result - 1] = 0;
+      line_object[result ? result - 1 : 0] = 0;
 
       state.status = F_none;
       range.start = 0;
index c2d31f4828bb93077739778c24f9260c681c787e..f7429c7a814655893c710cd95760232ec21d15e7 100644 (file)
@@ -65,7 +65,7 @@ int main(void) {
     cmocka_unit_test(test__fl_fss_extended_list_object_write__returns_data_not),
 
     cmocka_unit_test(test__fl_fss_extended_list_content_read__works),
-    //cmocka_unit_test(test__fl_fss_extended_list_content_read__works_using_combining),
+    cmocka_unit_test(test__fl_fss_extended_list_content_read__works_using_combining),
     cmocka_unit_test(test__fl_fss_extended_list_object_read__works),
     // fl_fss_extended_list_object_read() combining check is handled by test__fl_fss_extended_list_content_read__works_using_combining().