]> Kevux Git Server - fll/commitdiff
Progress: Add dynamic, dynamics, and map unit tests for fl_fss_payload_header_map...
authorKevin Day <kevin@kevux.org>
Wed, 6 Mar 2024 03:57:35 +0000 (21:57 -0600)
committerKevin Day <kevin@kevux.org>
Wed, 6 Mar 2024 04:10:49 +0000 (22:10 -0600)
Switch character width loops with memcpy().

Add cases where trailing string should be removed.

Make sure private_fl_fss_basic_write() is only called when the cache is not empty.
Make sue the internal.range is properly set when calling private_fl_fss_basic_write().

Ensure that when any quote is used that they get quoted where appropriate.

Ensure that when key has used of 0, the start range is greater than the stop range to designate a NULL range.

Add dynamic, dynamics, and map unit tests.

Make the tests test the string first rather than the used so that when there is an error it is easier to debug.

Remove unused/stale commented out code.

Switch fss_write flag from 16-bit into 32-bit.
This is necessary because more bits than 16 are in use.

49 files changed:
level_1/fl_fss/c/fss/basic_list.c
level_1/fl_fss/c/fss/embedded_list.c
level_1/fl_fss/c/fss/extended_list.c
level_1/fl_fss/c/fss/payload.c
level_1/fl_fss/c/fss/private-payload.c
level_1/fl_fss/c/private-fss.c
level_1/fl_fss/data/build/settings-tests
level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-0.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-1.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-2.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-0.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-1.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-2.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-0.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-1.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-2.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-3.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-4.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-5.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-6.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-0.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-1.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-2.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-0.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-1.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-2.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-3.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-4.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-5.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-6.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/variables/payload-abstruse_dynamic.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/variables/payload-abstruse_dynamics.txt [new file with mode: 0644]
level_1/fl_fss/data/tests/variables/payload-abstruse_map.txt [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/help-fss-payload.c
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamic-join.c [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamic-join.h [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-join.c [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-join.h [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-split.c [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-split.h [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-join.c [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-join.h [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-split.c [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-split.h [new file with mode: 0644]
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_strings-join.c
level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_strings-split.c
level_1/fl_fss/tests/unit/c/test-fss.c
level_1/fl_fss/tests/unit/c/test-fss.h
level_3/fss_write/c/main/common/type.h

index b818035f3087fb06e68e046a069affcf0c89644a..24b00fc9e81578924c29245d815bec3c6d98d3e7 100644 (file)
@@ -915,8 +915,6 @@ extern "C" {
     }
 
     const f_number_unsigned_t destination_used = destination->used;
-
-    f_number_unsigned_t i = 0;
     f_number_unsigned_t slash_count = 0;
 
     uint8_t width = 0;
@@ -970,9 +968,9 @@ extern "C" {
           state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
-          for (i = 0; i < width; ++i) {
-            destination->string[destination->used++] = object.string[range->start + i];
-          } // for
+          memcpy(destination->string + destination->used, object.string + range->start, width);
+
+          destination->used += width;
         }
       }
 
@@ -1039,9 +1037,9 @@ extern "C" {
         state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
-        for (i = 0; i < width; ++i) {
-          destination->string[destination->used++] = object.string[range->start + i];
-        } // for
+        memcpy(destination->string + destination->used, object.string + range->start, width);
+
+        destination->used += width;
       }
 
       state->status = f_utf_buffer_increment(object, range, 1);
index 0f21132bace3b2759cabc9c1b24f0cce1558dc49..34b20e8a7a0d213f6d1c8c1c24903c1aad43f1a0 100644 (file)
@@ -1492,8 +1492,6 @@ extern "C" {
     if (F_status_is_error(state->status)) return;
 
     const f_number_unsigned_t destination_used = destination->used;
-
-    f_number_unsigned_t i = 0;
     f_number_unsigned_t slash_count = 0;
 
     bool ends_on_space = F_false;
@@ -1549,9 +1547,9 @@ extern "C" {
           state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
-          for (i = 0; i < width; ++i) {
-            destination->string[destination->used++] = object.string[range->start + i];
-          } // for
+          memcpy(destination->string + destination->used, object.string + range->start, width);
+
+          destination->used += width;
         }
       }
 
@@ -1638,9 +1636,9 @@ extern "C" {
         state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
-        for (i = 0; i < width; ++i) {
-          destination->string[destination->used++] = object.string[range->start + i];
-        } // for
+        memcpy(destination->string + destination->used, object.string + range->start, width);
+
+        destination->used += width;
       }
 
       state->status = f_utf_buffer_increment(object, range, 1);
index 1777a8e886a68feb2b35415dd674f4bd6c18e34b..3c0e393906e3eb176a4dc18161a16eb623a76a6b 100644 (file)
@@ -284,7 +284,6 @@ extern "C" {
     bool has_graph = F_false;
     bool do_prepend = prepend ? F_true : F_false;
 
-    f_number_unsigned_t i = 0;
     f_number_unsigned_t r = 0;
     f_number_unsigned_t slash_count = 0;
     f_number_unsigned_t start = 0;
@@ -490,9 +489,9 @@ extern "C" {
         state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
-        for (i = 0; i < width; ++i) {
-          destination->string[destination->used++] = content.string[range->start + i];
-        } // for
+        memcpy(destination->string + destination->used, content.string + range->start, width);
+
+        destination->used += width;
       }
 
       state->status = f_utf_buffer_increment(content, range, 1);
@@ -947,7 +946,6 @@ extern "C" {
 
     const f_number_unsigned_t destination_used = destination->used;
 
-    f_number_unsigned_t i = 0;
     f_number_unsigned_t slash_count = 0;
 
     bool ends_on_space = F_false;
@@ -1003,9 +1001,9 @@ extern "C" {
           state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
-          for (i = 0; i < width; ++i) {
-            destination->string[destination->used++] = object.string[range->start + i];
-          } // for
+          memcpy(destination->string + destination->used, object.string + range->start, width);
+
+          destination->used += width;
         }
       }
 
@@ -1092,9 +1090,9 @@ extern "C" {
         state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
-        for (i = 0; i < width; ++i) {
-          destination->string[destination->used++] = object.string[range->start + i];
-        } // for
+        memcpy(destination->string + destination->used, object.string + range->start, width);
+
+        destination->used += width;
       }
 
       state->status = f_utf_buffer_increment(object, range, 1);
index 995b0be35348d7fdfc343adfabe4bce504383dc3..011456237ea35979aacc360f5fca184bbab1dae8 100644 (file)
@@ -81,7 +81,7 @@ extern "C" {
         destinations->array[destinations->used].key.used = 0;
         destinations->array[destinations->used].value.used = 0;
 
-        internal.range.start = 0;
+        internal.range.start = headers.array[internal.i].key.used ? 0 : 1;
         internal.range.stop = headers.array[internal.i].key.used ? headers.array[internal.i].key.used - 1 : 0;
 
         private_fl_fss_basic_write(F_true, headers.array[internal.i].key, internal.quote, &internal.range, &destinations->array[destinations->used].key, state, (void * const) &internal);
index d29e84f58bb6a28526bcaec71dcf77fab98be74d..ba71dd8af2106650a1d19d887f3a8701aff4a0cf 100644 (file)
@@ -73,6 +73,11 @@ extern "C" {
           }
         }
       }
+      else if (destinations->array[destinations->used].value.used) {
+
+        // Remove the always added trailing extended next.
+        destinations->array[destinations->used].value.used -= f_fss_extended_next_s.used;
+      }
     }
     else {
       if (data->flag & f_fss_payload_header_map_flag_null_dynamic_e) {
@@ -135,8 +140,13 @@ extern "C" {
         data->cache->used -= f_fss_space_s.used;
       }
 
-      private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
-      if (F_status_is_error(state->status)) return F_true;
+      if (data->cache->used) {
+        internal->range.start = 0;
+        internal->range.stop = data->cache->used - 1;
+
+        private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
+        if (F_status_is_error(state->status)) return F_true;
+      }
     }
     else {
       if (map->key.used || (data->flag & f_fss_payload_header_map_flag_null_map_name_e)) {
@@ -266,8 +276,13 @@ extern "C" {
         data->cache->used -= f_fss_space_s.used;
       }
 
-      private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
-      if (F_status_is_error(state->status)) return F_true;
+      if (data->cache->used) {
+        internal->range.start = 0;
+        internal->range.stop = data->cache->used - 1;
+
+        private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
+        if (F_status_is_error(state->status)) return F_true;
+      }
     }
     else {
       if (map->key.used || (data->flag & f_fss_payload_header_map_flag_null_map_multi_name_e)) {
@@ -434,8 +449,13 @@ extern "C" {
           data->cache->used -= f_fss_space_s.used;
         }
 
-        private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
-        if (F_status_is_error(state->status)) return F_true;
+        if (data->cache->used) {
+          internal->range.start = 0;
+          internal->range.stop = data->cache->used - 1;
+
+          private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
+          if (F_status_is_error(state->status)) return F_true;
+        }
       }
       else if (data->flag & f_fss_payload_header_map_flag_join_map_multi_e) {
         data->cache->used = 0;
@@ -500,11 +520,16 @@ extern "C" {
             data->cache->used -= f_fss_space_s.used;
           }
 
-          private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
-          if (F_status_is_error(state->status)) return F_true;
+          if (data->cache->used) {
+            internal->range.start = 0;
+            internal->range.stop = data->cache->used - 1;
 
-          state->status = f_string_dynamic_append_assure(f_fss_extended_next_s, &destinations->array[destinations->used].value);
-          if (F_status_is_error(state->status)) return F_true;
+            private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
+            if (F_status_is_error(state->status)) return F_true;
+
+            state->status = f_string_dynamic_append_assure(f_fss_extended_next_s, &destinations->array[destinations->used].value);
+            if (F_status_is_error(state->status)) return F_true;
+          }
         } // for
 
         // Remove the always added trailing space.
@@ -703,8 +728,13 @@ extern "C" {
           data->cache->used -= f_fss_space_s.used;
         }
 
-        private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
-        if (F_status_is_error(state->status)) return F_true;
+        if (data->cache->used) {
+          internal->range.start = 0;
+          internal->range.stop = data->cache->used - 1;
+
+          private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
+          if (F_status_is_error(state->status)) return F_true;
+        }
       }
       else if (data->flag & f_fss_payload_header_map_flag_join_map_e) {
         data->cache->used = 0;
@@ -754,11 +784,16 @@ extern "C" {
             data->cache->used -= f_fss_space_s.used;
           }
 
-          private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
-          if (F_status_is_error(state->status)) return F_true;
+          if (data->cache->used) {
+            internal->range.start = 0;
+            internal->range.stop = data->cache->used - 1;
 
-          state->status = f_string_dynamic_append_assure(f_fss_extended_next_s, &destinations->array[destinations->used].value);
-          if (F_status_is_error(state->status)) return F_true;
+            private_fl_fss_basic_write(F_false, *data->cache, 0, &internal->range, &destinations->array[destinations->used].value, state, (void * const) internal);
+            if (F_status_is_error(state->status)) return F_true;
+
+            state->status = f_string_dynamic_append_assure(f_fss_extended_next_s, &destinations->array[destinations->used].value);
+            if (F_status_is_error(state->status)) return F_true;
+          }
         } // for
 
         // Remove the always added trailing space.
index 841bc0aa37a1bb8c2eae14b4431a950162a0ca0f..d7b7b2e7ee68216691ea2fcfd8e9061b367ce3db 100644 (file)
@@ -936,9 +936,9 @@ extern "C" {
 
           destination->string[destination->used++] = quote_char;
 
-          for (i = 0; i < width; ++i) {
-            destination->string[destination->used++] = object.string[range->start + i];
-          } // for
+          memcpy(destination->string + destination->used, object.string + range->start, width);
+
+          destination->used += width;
         }
         else if ((flag & 0x1) && object.string[range->start] == f_fss_comment_s.string[0]) {
 
@@ -984,9 +984,9 @@ extern "C" {
             destination->string[destination->used++] = f_fss_slash_s.string[0];
           } // for
 
-          for (i = 0; i < width; ++i) {
-            destination->string[destination->used++] = object.string[range->start + i];
-          } // for
+          memcpy(destination->string + destination->used, object.string + range->start, width);
+
+          destination->used += width;
         }
       }
       else if (object.string[range->start] == quote_char) {
@@ -996,7 +996,6 @@ extern "C" {
         if (F_status_is_error(state->status)) return;
 
         if (range->start > range->stop || range->start >= object.used) {
-
           state->status = f_memory_array_increase(state->step_large, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
           if (F_status_is_error(state->status)) break;
 
@@ -1041,9 +1040,9 @@ extern "C" {
 
         destination->string[destination->used++] = quote_char;
 
-        for (i = 0; i < width; ++i) {
-          destination->string[destination->used++] = object.string[range->start + i];
-        } // for
+        memcpy(destination->string + destination->used, object.string + range->start, width);
+
+        destination->used += width;
       }
       else if (object.string[range->start] == f_fss_eol_s.string[0]) {
         state->status = F_status_set_error(F_okay_eol);
@@ -1052,6 +1051,28 @@ extern "C" {
       }
       else if (object.string[range->start] != f_fss_placeholder_s.string[0]) {
         if (!quoted_is) {
+          if (object.string[range->start] == f_string_ascii_quote_double_s.string[0] || object.string[range->start] == f_string_ascii_quote_single_s.string[0] || object.string[range->start] == f_string_ascii_grave_s.string[0]) {
+            item_first = range->start++;
+
+            f_fss_skip_past_delimit(object, range, state);
+            if (F_status_is_error(state->status)) return;
+
+            if (range->start > range->stop || range->start >= object.used) {
+              quoted_is = F_true;
+            }
+            else if (object.string[range->start] == object.string[item_first]) {
+              quoted_is = F_true;
+            }
+            else if (f_fss_is_space(object, *range, state) == F_true) {
+              quoted_is = F_true;
+            }
+            else if (F_status_is_error(state->status)) {
+              break;
+            }
+
+            range->start = item_first;
+          }
+
           if (f_fss_is_space(object, *range, state) == F_false) {
             if (F_status_is_error(state->status)) break;
           }
@@ -1065,9 +1086,9 @@ extern "C" {
         state->status = f_memory_array_increase_by(width, sizeof(f_char_t), (void **) &destination->string, &destination->used, &destination->size);
         if (F_status_is_error(state->status)) break;
 
-        for (i = 0; i < width; ++i) {
-          destination->string[destination->used++] = object.string[range->start + i];
-        } // for
+        memcpy(destination->string + destination->used, object.string + range->start, width);
+
+        destination->used += width;
       }
 
       state->status = f_utf_buffer_increment(object, range, 1);
index 096964d281cc93ab2059552ab16162e03aa3227c..af11560198193c51b261d6dfdcb0fd9718c40627 100644 (file)
@@ -31,6 +31,8 @@ build_sources_program test-fss-embedded_list_content_read.c test-fss-embedded_li
 build_sources_program test-fss-extended_content_read.c test-fss-extended_content_write.c test-fss-extended_object_read.c test-fss-extended_object_write.c
 build_sources_program test-fss-extended_list_content_read.c test-fss-extended_list_content_write.c test-fss-extended_list_object_read.c test-fss-extended_list_object_write.c
 build_sources_program test-fss-payload_header_map.c
+build_sources_program test-fss-payload_header_map-abstruse_dynamic-join.c
+build_sources_program test-fss-payload_header_map-abstruse_dynamics-join.c test-fss-payload_header_map-abstruse_dynamics-split.c
 build_sources_program test-fss-payload_header_map-abstruse_int8s-join.c test-fss-payload_header_map-abstruse_uint8s-join.c
 build_sources_program test-fss-payload_header_map-abstruse_int8s-split.c test-fss-payload_header_map-abstruse_uint8s-split.c
 build_sources_program test-fss-payload_header_map-abstruse_int16s-join.c test-fss-payload_header_map-abstruse_uint16s-join.c
@@ -39,6 +41,7 @@ build_sources_program test-fss-payload_header_map-abstruse_int32s-join.c test-fs
 build_sources_program test-fss-payload_header_map-abstruse_int32s-split.c test-fss-payload_header_map-abstruse_uint32s-split.c
 build_sources_program test-fss-payload_header_map-abstruse_int64s-join.c test-fss-payload_header_map-abstruse_uint64s-join.c
 build_sources_program test-fss-payload_header_map-abstruse_int64s-split.c test-fss-payload_header_map-abstruse_uint64s-split.c
+build_sources_program test-fss-payload_header_map-abstruse_map-join.c test-fss-payload_header_map-abstruse_map-split.c
 build_sources_program test-fss-payload_header_map-abstruse_signed-join.c test-fss-payload_header_map-abstruse_unsigned-join.c
 build_sources_program test-fss-payload_header_map-abstruse_signeds-join.c test-fss-payload_header_map-abstruse_unsigneds-join.c
 build_sources_program test-fss-payload_header_map-abstruse_signeds-split.c test-fss-payload_header_map-abstruse_unsigneds-split.c
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-0.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-0.txt
new file mode 100644 (file)
index 0000000..7b06942
--- /dev/null
@@ -0,0 +1,6 @@
+a
+4
+0
+hello
+"some thing"
+3全#$⸙
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-1.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-1.txt
new file mode 100644 (file)
index 0000000..50e859f
--- /dev/null
@@ -0,0 +1,5 @@
+b
+3
+全
+⸙
+"␀ ␀ ␀ ␀ ␀ ␀"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-2.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamic-2.txt
new file mode 100644 (file)
index 0000000..41f6980
--- /dev/null
@@ -0,0 +1,4 @@
+c
+2
+�
+""a b \" c"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-0.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-0.txt
new file mode 100644 (file)
index 0000000..2547b5e
--- /dev/null
@@ -0,0 +1,3 @@
+a
+1
+"0 hello some thing 3全#$⸙ """
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-1.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-1.txt
new file mode 100644 (file)
index 0000000..1cee3a3
--- /dev/null
@@ -0,0 +1,3 @@
+b
+1
+"全 ⸙ ␀ ␀ ␀ ␀ ␀ ␀"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-2.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_dynamics-2.txt
new file mode 100644 (file)
index 0000000..f53932f
--- /dev/null
@@ -0,0 +1,3 @@
+c
+1
+"� "a b \" c"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-0.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-0.txt
new file mode 100644 (file)
index 0000000..003eb20
--- /dev/null
@@ -0,0 +1,3 @@
+a-0
+1
+"0 hello"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-1.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-1.txt
new file mode 100644 (file)
index 0000000..3f9d8f4
--- /dev/null
@@ -0,0 +1,3 @@
+a-1
+1
+"some thing 3全#$⸙"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-2.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-2.txt
new file mode 100644 (file)
index 0000000..26bcdbd
--- /dev/null
@@ -0,0 +1,3 @@
+a-2
+1
+""\" ''"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-3.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-3.txt
new file mode 100644 (file)
index 0000000..cdc6a2d
--- /dev/null
@@ -0,0 +1,3 @@
+b-0
+1
+"全 ⸙"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-4.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-4.txt
new file mode 100644 (file)
index 0000000..babfa63
--- /dev/null
@@ -0,0 +1,3 @@
+b-1
+1
+"␂␂␂ ␀ ␀ ␀ ␀ ␀ ␀"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-5.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-5.txt
new file mode 100644 (file)
index 0000000..576b709
--- /dev/null
@@ -0,0 +1,3 @@
+b-2
+1
+"' '"
diff --git a/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-6.txt b/level_1/fl_fss/data/tests/headers/payload-join-abstruse_map-6.txt
new file mode 100644 (file)
index 0000000..e9d783e
--- /dev/null
@@ -0,0 +1,3 @@
+c-0
+1
+"� "a b \" c"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-0.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-0.txt
new file mode 100644 (file)
index 0000000..3cdfa1f
--- /dev/null
@@ -0,0 +1,3 @@
+a
+1
+0 hello "some thing" 3全#$⸙ """"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-1.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-1.txt
new file mode 100644 (file)
index 0000000..044ed3e
--- /dev/null
@@ -0,0 +1,3 @@
+b
+1
+全 ⸙ "␀ ␀ ␀ ␀ ␀ ␀"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-2.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_dynamics-2.txt
new file mode 100644 (file)
index 0000000..64fa96d
--- /dev/null
@@ -0,0 +1,3 @@
+c
+1
+� ""a b \" c"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-0.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-0.txt
new file mode 100644 (file)
index 0000000..3a0f995
--- /dev/null
@@ -0,0 +1,3 @@
+a-0
+1
+0 hello
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-1.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-1.txt
new file mode 100644 (file)
index 0000000..2490950
--- /dev/null
@@ -0,0 +1,3 @@
+a-1
+1
+"some thing" 3全#$⸙
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-2.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-2.txt
new file mode 100644 (file)
index 0000000..7e91d24
--- /dev/null
@@ -0,0 +1,3 @@
+a-2
+1
+"""" "''"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-3.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-3.txt
new file mode 100644 (file)
index 0000000..6a55e8c
--- /dev/null
@@ -0,0 +1,3 @@
+b-0
+1
+全 ⸙
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-4.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-4.txt
new file mode 100644 (file)
index 0000000..2df9bf9
--- /dev/null
@@ -0,0 +1,3 @@
+b-1
+1
+␂␂␂ "␀ ␀ ␀ ␀ ␀ ␀"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-5.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-5.txt
new file mode 100644 (file)
index 0000000..7f046f2
--- /dev/null
@@ -0,0 +1,3 @@
+b-2
+1
+"'" "'"
diff --git a/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-6.txt b/level_1/fl_fss/data/tests/headers/payload-split-abstruse_map-6.txt
new file mode 100644 (file)
index 0000000..946471d
--- /dev/null
@@ -0,0 +1,3 @@
+c-0
+1
+� ""a b \" c"
diff --git a/level_1/fl_fss/data/tests/variables/payload-abstruse_dynamic.txt b/level_1/fl_fss/data/tests/variables/payload-abstruse_dynamic.txt
new file mode 100644 (file)
index 0000000..d64b7e9
--- /dev/null
@@ -0,0 +1,15 @@
+a
+4
+0
+hello
+some thing
+3全#$⸙
+b
+3
+全
+⸙
+␀ ␀ ␀ ␀ ␀ ␀
+c
+2
+�
+"a b " c
diff --git a/level_1/fl_fss/data/tests/variables/payload-abstruse_dynamics.txt b/level_1/fl_fss/data/tests/variables/payload-abstruse_dynamics.txt
new file mode 100644 (file)
index 0000000..f4cdddb
--- /dev/null
@@ -0,0 +1,16 @@
+a
+5
+0
+hello
+some thing
+3全#$⸙
+""
+b
+3
+全
+⸙
+␀ ␀ ␀ ␀ ␀ ␀
+c
+2
+�
+"a b " c
diff --git a/level_1/fl_fss/data/tests/variables/payload-abstruse_map.txt b/level_1/fl_fss/data/tests/variables/payload-abstruse_map.txt
new file mode 100644 (file)
index 0000000..f3bf3e3
--- /dev/null
@@ -0,0 +1,28 @@
+a-0
+2
+0
+hello
+a-1
+2
+some thing
+3全#$⸙
+a-2
+2
+""
+''
+b-0
+2
+全
+⸙
+b-1
+2
+␂␂␂
+␀ ␀ ␀ ␀ ␀ ␀
+b-2
+2
+'
+'
+c-0
+2
+�
+"a b " c
index d99f6755d9df557a7655337a0151d25cee052809..65f9cb15049c90f2ff2e036d777d8e288887d39e 100644 (file)
@@ -67,11 +67,11 @@ void help_payload__test(const f_string_t context_variables, const f_string_t con
 
       for (f_number_unsigned_t i = 0; i < destinations.used; ++i) {
 
-        assert_int_equal(destinations.array[i].key.used, expects.array[i].key.used);
-        assert_int_equal(destinations.array[i].value.used, expects.array[i].value.used);
-
         assert_string_equal(destinations.array[i].key.string, expects.array[i].key.string);
         assert_string_equal(destinations.array[i].value.string, expects.array[i].value.string);
+
+        assert_int_equal(destinations.array[i].key.used, expects.array[i].key.used);
+        assert_int_equal(destinations.array[i].value.used, expects.array[i].value.used);
       } // for
 
       if (object.string) free(object.string);
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamic-join.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamic-join.c
new file mode 100644 (file)
index 0000000..78763f1
--- /dev/null
@@ -0,0 +1,31 @@
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_dynamic__works_join(void **void_state) {
+
+  help_payload__test("abstruse_dynamic", "join-abstruse_dynamic", 0, test__fl_fss_payload_header_map__abstruse_dynamic__join_load_contents, 0);
+}
+
+void test__fl_fss_payload_header_map__abstruse_dynamic__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) {
+
+  for (f_number_unsigned_t i = 0; i < contents.used; ++i, ++headers->used) {
+
+    headers->array[headers->used].key.used = 0;
+
+    state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+    assert_int_equal(state->status, F_okay);
+
+    headers->array[headers->used].value.type = f_abstruse_dynamic_e;
+    headers->array[headers->used].value.is.a_dynamic.used = 0;
+
+    state->status = f_string_dynamic_append(contents.array[i], &headers->array[headers->used].value.is.a_dynamic);
+    assert_int_equal(state->status, F_okay);
+  } // for
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamic-join.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamic-join.h
new file mode 100644 (file)
index 0000000..f506569
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 2
+ *
+ * Project: FSS
+ * API Version: 0.6
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the fl_fss project.
+ */
+#ifndef _TEST__FL_fss_payload_header_map__abstruse_dynamic_join_h
+#define _TEST__FL_fss_payload_header_map__abstruse_dynamic_join_h
+
+/**
+ * Test that the function works for abstruse_dynamic type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_dynamic__works_join(void **state);
+
+/**
+ * Callback to load the contents for the test.
+ *
+ * @param object
+ *   The object parameter.
+ * @param contents
+ *   The contents parameter.
+ * @param headers
+ *   The headers parameter.
+* @param state
+ *   The state parameter.
+ * @param extra
+ *   (optional) The extra parameter.
+ *   Set to NULL to not use.
+ */
+extern void test__fl_fss_payload_header_map__abstruse_dynamic__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra);
+
+#endif // _TEST__FL_fss_payload_header_map__abstruse_dynamic_join_h
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-join.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-join.c
new file mode 100644 (file)
index 0000000..41e7a22
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_dynamics__works_join(void **void_state) {
+
+  help_payload__test("abstruse_dynamics", "join-abstruse_dynamics", f_fss_payload_header_map_flag_join_dynamics_e, test__fl_fss_payload_header_map__abstruse_dynamics__join_load_contents, 0);
+}
+
+void test__fl_fss_payload_header_map__abstruse_dynamics__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) {
+
+  headers->array[0].value.type = f_abstruse_dynamics_e;
+  headers->array[0].value.is.a_dynamics.used = 0;
+  headers->array[0].key.used = 0;
+
+  f_string_dynamics_t * const dynamics = &headers->array[0].value.is.a_dynamics;
+
+  state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+  assert_int_equal(state->status, F_okay);
+
+  state->status = f_memory_array_increase_by(contents.used, sizeof(f_string_dynamic_t), (void **) &dynamics->array, &dynamics->used, &dynamics->size);
+  assert_int_equal(state->status, F_okay);
+
+  for (f_number_unsigned_t i = 0; i < contents.used; ++i) {
+
+    dynamics->array[i].used = 0;
+
+    state->status = f_string_dynamic_append(contents.array[i], &dynamics->array[i]);
+    assert_int_equal(state->status, F_okay);
+  } // for
+
+  dynamics->used = contents.used;
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-join.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-join.h
new file mode 100644 (file)
index 0000000..6207321
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 2
+ *
+ * Project: FSS
+ * API Version: 0.6
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the fl_fss project.
+ */
+#ifndef _TEST__FL_fss_payload_header_map__abstruse_dynamics_join_h
+#define _TEST__FL_fss_payload_header_map__abstruse_dynamics_join_h
+
+/**
+ * Test that the function works for abstruse_dynamics type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_dynamics__works_join(void **state);
+
+/**
+ * Callback to load the contents for the test.
+ *
+ * @param object
+ *   The object parameter.
+ * @param contents
+ *   The contents parameter.
+ * @param headers
+ *   The headers parameter.
+* @param state
+ *   The state parameter.
+ * @param extra
+ *   (optional) The extra parameter.
+ *   Set to NULL to not use.
+ */
+extern void test__fl_fss_payload_header_map__abstruse_dynamics__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra);
+
+#endif // _TEST__FL_fss_payload_header_map__abstruse_dynamics_join_h
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-split.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-split.c
new file mode 100644 (file)
index 0000000..7007ed1
--- /dev/null
@@ -0,0 +1,39 @@
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_dynamics__works_split(void **void_state) {
+
+  help_payload__test("abstruse_dynamics", "split-abstruse_dynamics", 0, test__fl_fss_payload_header_map__abstruse_dynamics__split_load_contents, 0);
+}
+
+void test__fl_fss_payload_header_map__abstruse_dynamics__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) {
+
+  headers->array[0].value.type = f_abstruse_dynamics_e;
+  headers->array[0].value.is.a_dynamics.used = 0;
+  headers->array[0].key.used = 0;
+
+  f_string_dynamics_t * const dynamics = &headers->array[0].value.is.a_dynamics;
+
+  state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+  assert_int_equal(state->status, F_okay);
+
+  state->status = f_memory_array_increase_by(contents.used, sizeof(f_string_dynamic_t), (void **) &dynamics->array, &dynamics->used, &dynamics->size);
+  assert_int_equal(state->status, F_okay);
+
+  for (f_number_unsigned_t i = 0; i < contents.used; ++i) {
+
+    dynamics->array[i].used = 0;
+
+    state->status = f_string_dynamic_append(contents.array[i], &dynamics->array[i]);
+    assert_int_equal(state->status, F_okay);
+  } // for
+
+  dynamics->used = contents.used;
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-split.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_dynamics-split.h
new file mode 100644 (file)
index 0000000..6f3b913
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 2
+ *
+ * Project: FSS
+ * API Version: 0.6
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the fl_fss project.
+ */
+#ifndef _TEST__FL_fss_payload_header_map__abstruse_dynamics_split_h
+#define _TEST__FL_fss_payload_header_map__abstruse_dynamics_split_h
+
+/**
+ * Test that the function works for abstruse_dynamics type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_dynamics__works_split(void **state);
+
+/**
+ * Callback to load the contents for the test.
+ *
+ * @param object
+ *   The object parameter.
+ * @param contents
+ *   The contents parameter.
+ * @param headers
+ *   The headers parameter.
+* @param state
+ *   The state parameter.
+ * @param extra
+ *   (optional) The extra parameter.
+ *   Set to NULL to not use.
+ */
+extern void test__fl_fss_payload_header_map__abstruse_dynamics__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra);
+
+#endif // _TEST__FL_fss_payload_header_map__abstruse_dynamics_split_h
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-join.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-join.c
new file mode 100644 (file)
index 0000000..cfab941
--- /dev/null
@@ -0,0 +1,37 @@
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_map__works_join(void **void_state) {
+
+  help_payload__test("abstruse_map", "join-abstruse_map", f_fss_payload_header_map_flag_join_map_e, test__fl_fss_payload_header_map__abstruse_map__join_load_contents, 0);
+}
+
+void test__fl_fss_payload_header_map__abstruse_map__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) {
+
+  headers->array[0].value.type = f_abstruse_map_e;
+  headers->array[0].value.is.a_map.key.used = 0;
+  headers->array[0].value.is.a_map.value.used = 0;
+  headers->array[0].key.used = 0;
+
+  f_string_map_t * const map = &headers->array[0].value.is.a_map;
+
+  state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+  assert_int_equal(state->status, F_okay);
+
+  if (contents.used) {
+    state->status = f_string_dynamic_append(contents.array[0], &map->key);
+    assert_int_equal(state->status, F_okay);
+
+    if (contents.used > 1) {
+      state->status = f_string_dynamic_append(contents.array[1], &map->value);
+      assert_int_equal(state->status, F_okay);
+    }
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-join.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-join.h
new file mode 100644 (file)
index 0000000..3638088
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 2
+ *
+ * Project: FSS
+ * API Version: 0.6
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the fl_fss project.
+ */
+#ifndef _TEST__FL_fss_payload_header_map__abstruse_map_join_h
+#define _TEST__FL_fss_payload_header_map__abstruse_map_join_h
+
+/**
+ * Test that the function works for abstruse_map type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_map__works_join(void **state);
+
+/**
+ * Callback to load the contents for the test.
+ *
+ * @param object
+ *   The object parameter.
+ * @param contents
+ *   The contents parameter.
+ * @param headers
+ *   The headers parameter.
+* @param state
+ *   The state parameter.
+ * @param extra
+ *   (optional) The extra parameter.
+ *   Set to NULL to not use.
+ */
+extern void test__fl_fss_payload_header_map__abstruse_map__join_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra);
+
+#endif // _TEST__FL_fss_payload_header_map__abstruse_map_join_h
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-split.c b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-split.c
new file mode 100644 (file)
index 0000000..a03bfb9
--- /dev/null
@@ -0,0 +1,37 @@
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_map__works_split(void **void_state) {
+
+  help_payload__test("abstruse_map", "split-abstruse_map", 0, test__fl_fss_payload_header_map__abstruse_map__split_load_contents, 0);
+}
+
+void test__fl_fss_payload_header_map__abstruse_map__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra) {
+
+  headers->array[0].value.type = f_abstruse_map_e;
+  headers->array[0].value.is.a_map.key.used = 0;
+  headers->array[0].value.is.a_map.value.used = 0;
+  headers->array[0].key.used = 0;
+
+  f_string_map_t * const map = &headers->array[0].value.is.a_map;
+
+  state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+  assert_int_equal(state->status, F_okay);
+
+  if (contents.used) {
+    state->status = f_string_dynamic_append(contents.array[0], &map->key);
+    assert_int_equal(state->status, F_okay);
+
+    if (contents.used > 1) {
+      state->status = f_string_dynamic_append(contents.array[1], &map->value);
+      assert_int_equal(state->status, F_okay);
+    }
+  }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-split.h b/level_1/fl_fss/tests/unit/c/test-fss-payload_header_map-abstruse_map-split.h
new file mode 100644 (file)
index 0000000..9288e06
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * FLL - Level 2
+ *
+ * Project: FSS
+ * API Version: 0.6
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the fl_fss project.
+ */
+#ifndef _TEST__FL_fss_payload_header_map__abstruse_map_split_h
+#define _TEST__FL_fss_payload_header_map__abstruse_map_split_h
+
+/**
+ * Test that the function works for abstruse_map type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_map__works_split(void **state);
+
+/**
+ * Callback to load the contents for the test.
+ *
+ * @param object
+ *   The object parameter.
+ * @param contents
+ *   The contents parameter.
+ * @param headers
+ *   The headers parameter.
+* @param state
+ *   The state parameter.
+ * @param extra
+ *   (optional) The extra parameter.
+ *   Set to NULL to not use.
+ */
+extern void test__fl_fss_payload_header_map__abstruse_map__split_load_contents(const f_string_static_t object, const f_string_dynamics_t contents, f_abstruse_maps_t * const headers, f_state_t * const state, void * extra);
+
+#endif // _TEST__FL_fss_payload_header_map__abstruse_map_split_h
index 07c3ed3d8493e35f5ddcd6a821a1036ae8fdc7be..df1c3e5407547515fc9e3404a4daa79aac1b433c 100644 (file)
@@ -19,8 +19,6 @@ void test__fl_fss_payload_header_map__abstruse_strings__join_load_contents(const
 
   if (*strings) free(*strings);
 
-  //headers->array[0].value.is.a_strings = calloc(contents.used + 1, sizeof(f_string_t *));
-  //assert_int_not_equal(headers->array[0].value.is.a_strings, 0);
   *strings = calloc(contents.used + 1, sizeof(f_string_t *));
   assert_int_not_equal(*strings, 0);
 
index 1c6d91ce6e592de28cb11f8c4a85e4c1450f807f..7d017475e0dea968c39e4147e21089a01750cced 100644 (file)
@@ -19,8 +19,6 @@ void test__fl_fss_payload_header_map__abstruse_strings__split_load_contents(cons
 
   if (*strings) free(*strings);
 
-  //headers->array[0].value.is.a_strings = calloc(contents.used + 1, sizeof(f_string_t *));
-  //assert_int_not_equal(headers->array[0].value.is.a_strings, 0);
   *strings = calloc(contents.used + 1, sizeof(f_string_t *));
   assert_int_not_equal(*strings, 0);
 
index 703e2546b8619249caf8dd45ae1cb2740a5683dc..5e3934f8ae3b05d2c98203392c204894e0f07cae 100644 (file)
@@ -60,6 +60,9 @@ int main(void) {
     cmocka_unit_test(test__fl_fss_extended_list_object_read__works),
 
     cmocka_unit_test(test__fl_fss_payload_header_map__returns_data_not),
+    cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_dynamic__works_join),
+    cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_dynamics__works_join),
+    cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_dynamics__works_split),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int8s__works_join),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int8s__works_split),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int16s__works_join),
@@ -68,6 +71,8 @@ int main(void) {
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int32s__works_split),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int64s__works_join),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_int64s__works_split),
+    cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map__works_join),
+    cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_map__works_split),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_signed__works_join),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_signeds__works_join),
     cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_signeds__works_split),
index cac7fad5b68a0ae5f129f510e9230761dcd2e5f0..b6b051690a4ed30fca063d3da080ad9cb48aff05 100644 (file)
@@ -62,6 +62,9 @@
 #include "test-fss-extended_list_object_read.h"
 #include "test-fss-extended_list_object_write.h"
 #include "test-fss-payload_header_map.h"
+#include "test-fss-payload_header_map-abstruse_dynamic-join.h"
+#include "test-fss-payload_header_map-abstruse_dynamics-join.h"
+#include "test-fss-payload_header_map-abstruse_dynamics-split.h"
 #include "test-fss-payload_header_map-abstruse_int8s-join.h"
 #include "test-fss-payload_header_map-abstruse_int8s-split.h"
 #include "test-fss-payload_header_map-abstruse_int16s-join.h"
@@ -70,6 +73,8 @@
 #include "test-fss-payload_header_map-abstruse_int32s-split.h"
 #include "test-fss-payload_header_map-abstruse_int64s-join.h"
 #include "test-fss-payload_header_map-abstruse_int64s-split.h"
+#include "test-fss-payload_header_map-abstruse_map-join.h"
+#include "test-fss-payload_header_map-abstruse_map-split.h"
 #include "test-fss-payload_header_map-abstruse_signed-join.h"
 #include "test-fss-payload_header_map-abstruse_signeds-join.h"
 #include "test-fss-payload_header_map-abstruse_signeds-split.h"
index 57535848f79463c83c85914eda3e73e8b508307b..4622ecdca77a46d76509a1d8ee423a9c06734a6e 100644 (file)
@@ -81,7 +81,7 @@ extern "C" {
  */
 #ifndef _di_fss_write_setting_t_
   typedef struct {
-    uint16_t flag;
+    uint32_t flag;
 
     f_status_t status_signal;
     f_state_t state;