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
build_sources_program test-fss-payload_header_map-abstruse_string-join.c
+build_sources_program test-fss-payload_header_map-abstruse_strings-join.c test-fss-payload_header_map-abstruse_strings-split.c
build_sources_program test-fss.c data-fss.c help-fss.c help-fss-payload.c
a
-4
-0
-hello
-"some thing"
-3全#$⸙
+1
+"0 hello some thing 3全#$⸙ """
b
-3
-全
-⸙
-"␀ ␀ ␀ ␀ ␀ ␀"
+1
+"全 ⸙ ␀ ␀ ␀ ␀ ␀ ␀"
c
-2
-�
-""a b \" c"
+1
+"� "a b \" c"
--- /dev/null
+a
+1
+0 hello "some thing" 3全#$⸙ """"
--- /dev/null
+b
+1
+全 ⸙ "␀ ␀ ␀ ␀ ␀ ␀"
--- /dev/null
+c
+1
+� ""a b \" c"
a
-4
+5
0
hello
some thing
3全#$⸙
+""
b
3
全
extern "C" {
#endif
-void help_payload__test(const f_string_t context_variables, const f_string_t context_headers, const uint64_t flag, void (*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 help_payload__test(const f_string_t context_variables, const f_string_t context_headers, const uint64_t flag, void (*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), void * extra) {
// Note: Each line should probably be at max 255 characters.
// The payload begins with a digit on the first line representing the number of Content lines following the Object line.
state.status = f_memory_array_increase(state.step_small, sizeof(f_abstruse_map_t), (void **) &headers.array, &headers.used, &headers.size);
assert_true(F_status_is_error_not(state.status));
- load_contents(object, contents, &headers, &state);
+ load_contents(object, contents, &headers, &state, extra);
if (object.string) free(object.string);
* The payload header state data flag.
* @param load_contents
* A callback to perform the type-specific content loading translation of the number.
+ * @param extra
+ * (optional) Additional argument of any type to pass to load_contents().
+ * This is useful for when needing to free custom memory.
+ * Use a structure to pass multiple variables.
+ * Set to NULL to not use.
*/
-void help_payload__test(const f_string_t context_variables, const f_string_t context_headers, const uint64_t flag, void (*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 help_payload__test(const f_string_t context_variables, const f_string_t context_headers, const uint64_t flag, void (*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), void * extra);
#ifdef __cplusplus
} // extern "C"
void test__fl_fss_payload_header_map__abstruse_int16s__works_join(void **void_state) {
- help_payload__test("abstruse_int16s", "join-abstruse_int16s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int16s__join_load_contents);
+ help_payload__test("abstruse_int16s", "join-abstruse_int16s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int16s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int16s__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 test__fl_fss_payload_header_map__abstruse_int16s__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) {
f_int16s_t * const is_a = &headers->array[0].value.is.a_i16s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int16s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int16s__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_int16s_join_h
void test__fl_fss_payload_header_map__abstruse_int16s__works_split(void **void_state) {
- help_payload__test("abstruse_int16s", "split-abstruse_int16s", 0, test__fl_fss_payload_header_map__abstruse_int16s__split_load_contents);
+ help_payload__test("abstruse_int16s", "split-abstruse_int16s", 0, test__fl_fss_payload_header_map__abstruse_int16s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int16s__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 test__fl_fss_payload_header_map__abstruse_int16s__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) {
f_int16s_t * const is_a = &headers->array[0].value.is.a_i16s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int16s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int16s__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_int16s_split_h
void test__fl_fss_payload_header_map__abstruse_int32s__works_join(void **void_state) {
- help_payload__test("abstruse_int32s", "join-abstruse_int32s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int32s__join_load_contents);
+ help_payload__test("abstruse_int32s", "join-abstruse_int32s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int32s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int32s__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 test__fl_fss_payload_header_map__abstruse_int32s__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) {
f_int32s_t * const is_a = &headers->array[0].value.is.a_i32s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int32s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int32s__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_int32s_join_h
void test__fl_fss_payload_header_map__abstruse_int32s__works_split(void **void_state) {
- help_payload__test("abstruse_int32s", "split-abstruse_int32s", 0, test__fl_fss_payload_header_map__abstruse_int32s__split_load_contents);
+ help_payload__test("abstruse_int32s", "split-abstruse_int32s", 0, test__fl_fss_payload_header_map__abstruse_int32s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int32s__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 test__fl_fss_payload_header_map__abstruse_int32s__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) {
f_int32s_t * const is_a = &headers->array[0].value.is.a_i32s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int32s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int32s__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_int32s_split_h
void test__fl_fss_payload_header_map__abstruse_int64s__works_join(void **void_state) {
- help_payload__test("abstruse_int64s", "join-abstruse_int64s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int64s__join_load_contents);
+ help_payload__test("abstruse_int64s", "join-abstruse_int64s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int64s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int64s__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 test__fl_fss_payload_header_map__abstruse_int64s__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) {
f_int64s_t * const is_a = &headers->array[0].value.is.a_i64s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int64s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int64s__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_int64s_join_h
void test__fl_fss_payload_header_map__abstruse_int64s__works_split(void **void_state) {
- help_payload__test("abstruse_int64s", "split-abstruse_int64s", 0, test__fl_fss_payload_header_map__abstruse_int64s__split_load_contents);
+ help_payload__test("abstruse_int64s", "split-abstruse_int64s", 0, test__fl_fss_payload_header_map__abstruse_int64s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int64s__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 test__fl_fss_payload_header_map__abstruse_int64s__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) {
f_int64s_t * const is_a = &headers->array[0].value.is.a_i64s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int64s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int64s__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_int64s_split_h
void test__fl_fss_payload_header_map__abstruse_int8s__works_join(void **void_state) {
- help_payload__test("abstruse_int8s", "join-abstruse_int8s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int8s__join_load_contents);
+ help_payload__test("abstruse_int8s", "join-abstruse_int8s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_int8s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int8s__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 test__fl_fss_payload_header_map__abstruse_int8s__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) {
f_int8s_t * const is_a = &headers->array[0].value.is.a_i8s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int8s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int8s__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_int8s_join_h
void test__fl_fss_payload_header_map__abstruse_int8s__works_split(void **void_state) {
- help_payload__test("abstruse_int8s", "split-abstruse_int8s", 0, test__fl_fss_payload_header_map__abstruse_int8s__split_load_contents);
+ help_payload__test("abstruse_int8s", "split-abstruse_int8s", 0, test__fl_fss_payload_header_map__abstruse_int8s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_int8s__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 test__fl_fss_payload_header_map__abstruse_int8s__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) {
f_int8s_t * const is_a = &headers->array[0].value.is.a_i8s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_int8s__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);
+extern void test__fl_fss_payload_header_map__abstruse_int8s__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_int8s_split_h
void test__fl_fss_payload_header_map__abstruse_signed__works_join(void **void_state) {
- help_payload__test("abstruse_signed", "join-abstruse_signed", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_signed__join_load_contents);
+ help_payload__test("abstruse_signed", "join-abstruse_signed", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_signed__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_signed__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 test__fl_fss_payload_header_map__abstruse_signed__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) {
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_signed__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);
+extern void test__fl_fss_payload_header_map__abstruse_signed__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_signed_join_h
void test__fl_fss_payload_header_map__abstruse_signeds__works_join(void **void_state) {
- help_payload__test("abstruse_signeds", "join-abstruse_signeds", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_signeds__join_load_contents);
+ help_payload__test("abstruse_signeds", "join-abstruse_signeds", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_signeds__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_signeds__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 test__fl_fss_payload_header_map__abstruse_signeds__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) {
f_number_signeds_t * const is_a = &headers->array[0].value.is.a_signeds;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_signeds__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);
+extern void test__fl_fss_payload_header_map__abstruse_signeds__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_signeds_join_h
void test__fl_fss_payload_header_map__abstruse_signeds__works_split(void **void_state) {
- help_payload__test("abstruse_signeds", "split-abstruse_signeds", 0, test__fl_fss_payload_header_map__abstruse_signeds__split_load_contents);
+ help_payload__test("abstruse_signeds", "split-abstruse_signeds", 0, test__fl_fss_payload_header_map__abstruse_signeds__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_signeds__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 test__fl_fss_payload_header_map__abstruse_signeds__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) {
f_number_signeds_t * const is_a = &headers->array[0].value.is.a_signeds;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_signeds__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);
+extern void test__fl_fss_payload_header_map__abstruse_signeds__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_signeds_split_h
void test__fl_fss_payload_header_map__abstruse_string__works_join(void **void_state) {
- help_payload__test("abstruse_string", "join-abstruse_string", 0, test__fl_fss_payload_header_map__abstruse_string__join_load_contents);
+ help_payload__test("abstruse_string", "join-abstruse_string", 0, test__fl_fss_payload_header_map__abstruse_string__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_string__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 test__fl_fss_payload_header_map__abstruse_string__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) {
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_string__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);
+extern void test__fl_fss_payload_header_map__abstruse_string__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_string_join_h
--- /dev/null
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_strings__works_join(void **void_state) {
+
+ f_string_t *strings = 0;
+
+ help_payload__test("abstruse_strings", "join-abstruse_strings", f_fss_payload_header_map_flag_join_strings_e, test__fl_fss_payload_header_map__abstruse_strings__join_load_contents, (void *) &strings);
+
+ if (strings) free(strings);
+}
+
+void test__fl_fss_payload_header_map__abstruse_strings__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) {
+
+ f_string_t **strings = (f_string_t **) extra;
+
+ 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);
+
+ headers->array[0].value.is.a_strings = *strings;
+ headers->array[0].key.used = 0;
+ headers->array[0].value.type = f_abstruse_strings_e;
+
+ state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+ assert_int_equal(state->status, F_okay);
+
+ for (f_number_unsigned_t i = 0; i < contents.used; ++i) {
+ headers->array[0].value.is.a_strings[i] = contents.array[i].string;
+ } // for
+
+ headers->array[0].value.is.a_strings[contents.used] = 0;
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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_strings_join_h
+#define _TEST__FL_fss_payload_header_map__abstruse_strings_join_h
+
+/**
+ * Test that the function works for abstruse_strings type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_strings__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_strings__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_strings_join_h
--- /dev/null
+#include "test-fss.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__fl_fss_payload_header_map__abstruse_strings__works_split(void **void_state) {
+
+ f_string_t *strings = 0;
+
+ help_payload__test("abstruse_strings", "split-abstruse_strings", 0, test__fl_fss_payload_header_map__abstruse_strings__split_load_contents, (void *) &strings);
+
+ if (strings) free(strings);
+}
+
+void test__fl_fss_payload_header_map__abstruse_strings__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) {
+
+ f_string_t **strings = (f_string_t **) extra;
+
+ 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);
+
+ headers->array[0].value.is.a_strings = *strings;
+ headers->array[0].key.used = 0;
+ headers->array[0].value.type = f_abstruse_strings_e;
+
+ state->status = f_string_dynamic_append(object, &headers->array[headers->used].key);
+ assert_int_equal(state->status, F_okay);
+
+ for (f_number_unsigned_t i = 0; i < contents.used; ++i) {
+ headers->array[0].value.is.a_strings[i] = contents.array[i].string;
+ } // for
+
+ headers->array[0].value.is.a_strings[contents.used] = 0;
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * 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_strings_split_h
+#define _TEST__FL_fss_payload_header_map__abstruse_strings_split_h
+
+/**
+ * Test that the function works for abstruse_strings type.
+ *
+ * @see fl_fss_payload_header_map()
+ */
+extern void test__fl_fss_payload_header_map__abstruse_strings__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_strings__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_strings_split_h
void test__fl_fss_payload_header_map__abstruse_uint16s__works_join(void **void_state) {
- help_payload__test("abstruse_uint16s", "join-abstruse_uint16s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint16s__join_load_contents);
+ help_payload__test("abstruse_uint16s", "join-abstruse_uint16s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint16s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint16s__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 test__fl_fss_payload_header_map__abstruse_uint16s__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) {
f_uint16s_t * const is_a = &headers->array[0].value.is.a_u16s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint16s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint16s__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_uint16s_join_h
void test__fl_fss_payload_header_map__abstruse_uint16s__works_split(void **void_state) {
- help_payload__test("abstruse_uint16s", "split-abstruse_uint16s", 0, test__fl_fss_payload_header_map__abstruse_uint16s__split_load_contents);
+ help_payload__test("abstruse_uint16s", "split-abstruse_uint16s", 0, test__fl_fss_payload_header_map__abstruse_uint16s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint16s__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 test__fl_fss_payload_header_map__abstruse_uint16s__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) {
f_uint16s_t * const is_a = &headers->array[0].value.is.a_u16s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint16s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint16s__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_uint16s_split_h
void test__fl_fss_payload_header_map__abstruse_uint32s__works_join(void **void_state) {
- help_payload__test("abstruse_uint32s", "join-abstruse_uint32s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint32s__join_load_contents);
+ help_payload__test("abstruse_uint32s", "join-abstruse_uint32s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint32s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint32s__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 test__fl_fss_payload_header_map__abstruse_uint32s__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) {
f_uint32s_t * const is_a = &headers->array[0].value.is.a_u32s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint32s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint32s__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_uint32s_join_h
void test__fl_fss_payload_header_map__abstruse_uint32s__works_split(void **void_state) {
- help_payload__test("abstruse_uint32s", "split-abstruse_uint32s", 0, test__fl_fss_payload_header_map__abstruse_uint32s__split_load_contents);
+ help_payload__test("abstruse_uint32s", "split-abstruse_uint32s", 0, test__fl_fss_payload_header_map__abstruse_uint32s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint32s__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 test__fl_fss_payload_header_map__abstruse_uint32s__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) {
f_uint32s_t * const is_a = &headers->array[0].value.is.a_u32s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint32s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint32s__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_uint32s_split_h
void test__fl_fss_payload_header_map__abstruse_uint64s__works_join(void **void_state) {
- help_payload__test("abstruse_uint64s", "join-abstruse_uint64s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint64s__join_load_contents);
+ help_payload__test("abstruse_uint64s", "join-abstruse_uint64s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint64s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint64s__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 test__fl_fss_payload_header_map__abstruse_uint64s__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) {
f_uint64s_t * const is_a = &headers->array[0].value.is.a_u64s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint64s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint64s__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_uint64s_join_h
void test__fl_fss_payload_header_map__abstruse_uint64s__works_split(void **void_state) {
- help_payload__test("abstruse_uint64s", "split-abstruse_uint64s", 0, test__fl_fss_payload_header_map__abstruse_uint64s__split_load_contents);
+ help_payload__test("abstruse_uint64s", "split-abstruse_uint64s", 0, test__fl_fss_payload_header_map__abstruse_uint64s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint64s__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 test__fl_fss_payload_header_map__abstruse_uint64s__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) {
f_uint64s_t * const is_a = &headers->array[0].value.is.a_u64s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint64s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint64s__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_uint64s_split_h
void test__fl_fss_payload_header_map__abstruse_uint8s__works_join(void **void_state) {
- help_payload__test("abstruse_uint8s", "join-abstruse_uint8s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint8s__join_load_contents);
+ help_payload__test("abstruse_uint8s", "join-abstruse_uint8s", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_uint8s__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint8s__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 test__fl_fss_payload_header_map__abstruse_uint8s__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) {
f_uint8s_t * const is_a = &headers->array[0].value.is.a_u8s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint8s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint8s__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_uint8s_join_h
void test__fl_fss_payload_header_map__abstruse_uint8s__works_split(void **void_state) {
- help_payload__test("abstruse_uint8s", "split-abstruse_uint8s", 0, test__fl_fss_payload_header_map__abstruse_uint8s__split_load_contents);
+ help_payload__test("abstruse_uint8s", "split-abstruse_uint8s", 0, test__fl_fss_payload_header_map__abstruse_uint8s__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_uint8s__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 test__fl_fss_payload_header_map__abstruse_uint8s__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) {
f_uint8s_t * const is_a = &headers->array[0].value.is.a_u8s;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_uint8s__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);
+extern void test__fl_fss_payload_header_map__abstruse_uint8s__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_uint8s_split_h
void test__fl_fss_payload_header_map__abstruse_unsigned__works_join(void **void_state) {
- help_payload__test("abstruse_unsigned", "join-abstruse_unsigned", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_unsigned__join_load_contents);
+ help_payload__test("abstruse_unsigned", "join-abstruse_unsigned", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_unsigned__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_unsigned__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 test__fl_fss_payload_header_map__abstruse_unsigned__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) {
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_unsigned__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);
+extern void test__fl_fss_payload_header_map__abstruse_unsigned__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_unsigned_join_h
void test__fl_fss_payload_header_map__abstruse_unsigneds__works_join(void **void_state) {
- help_payload__test("abstruse_unsigneds", "join-abstruse_unsigneds", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_unsigneds__join_load_contents);
+ help_payload__test("abstruse_unsigneds", "join-abstruse_unsigneds", f_fss_payload_header_map_flag_join_digits_e, test__fl_fss_payload_header_map__abstruse_unsigneds__join_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_unsigneds__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 test__fl_fss_payload_header_map__abstruse_unsigneds__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) {
f_number_unsigneds_t * const is_a = &headers->array[0].value.is.a_unsigneds;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_unsigneds__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);
+extern void test__fl_fss_payload_header_map__abstruse_unsigneds__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_unsigneds_join_h
void test__fl_fss_payload_header_map__abstruse_unsigneds__works_split(void **void_state) {
- help_payload__test("abstruse_unsigneds", "split-abstruse_unsigneds", 0, test__fl_fss_payload_header_map__abstruse_unsigneds__split_load_contents);
+ help_payload__test("abstruse_unsigneds", "split-abstruse_unsigneds", 0, test__fl_fss_payload_header_map__abstruse_unsigneds__split_load_contents, 0);
}
-void test__fl_fss_payload_header_map__abstruse_unsigneds__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 test__fl_fss_payload_header_map__abstruse_unsigneds__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) {
f_number_unsigneds_t * const is_a = &headers->array[0].value.is.a_unsigneds;
* The contents parameter.
* @param headers
* The headers parameter.
- * @param state
+* @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_unsigneds__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);
+extern void test__fl_fss_payload_header_map__abstruse_unsigneds__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_unsigneds_split_h
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),
cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_string__works_join),
- //cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_strings__works_join),
+ cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_strings__works_join),
+ cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_strings__works_split),
cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_uint8s__works_join),
cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_uint8s__works_split),
cmocka_unit_test(test__fl_fss_payload_header_map__abstruse_uint16s__works_join),
#include "test-fss-payload_header_map-abstruse_signeds-join.h"
#include "test-fss-payload_header_map-abstruse_signeds-split.h"
#include "test-fss-payload_header_map-abstruse_string-join.h"
+#include "test-fss-payload_header_map-abstruse_strings-join.h"
+#include "test-fss-payload_header_map-abstruse_strings-split.h"
#include "test-fss-payload_header_map-abstruse_uint8s-join.h"
#include "test-fss-payload_header_map-abstruse_uint8s-split.h"
#include "test-fss-payload_header_map-abstruse_uint16s-join.h"