Make some consistency tweaks and clean ups in basic read as well.
This has only been tested to confirm/deny that existing tests work.
There still needs to be additional tests added for the combining and joiner characters.
* @see f_utf_buffer_increment()
* @see fl_fss_basic_object_read()
* @see fl_fss_extended_object_read()
- * @see fl_fss_extended_content_read()
*/
#ifndef _di_fl_fss_extended_content_read_
extern void fl_fss_extended_content_read(const f_string_static_t buffer, f_range_t * const range, f_ranges_t * const found, f_uint8s_t * const quotes, f_number_unsigneds_t * const delimits, f_state_t * const state);
* @see f_utf_buffer_increment()
* @see fl_fss_basic_object_write()
* @see fl_fss_extended_object_write()
- * @see fl_fss_extended_content_write()
*/
#ifndef _di_fl_fss_extended_content_write_
extern void fl_fss_extended_content_write(const f_string_static_t content, const uint8_t quote, const uint8_t complete, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state);
* @see f_memory_array_increase()
* @see f_utf_buffer_increment()
* @see fl_fss_basic_object_read()
- * @see fl_fss_extended_object_read()
* @see fl_fss_extended_content_read()
*/
#ifndef _di_fl_fss_extended_object_read_
return;
}
+ const f_number_unsigned_t begin = range->start;
+
// Ignore all comment lines.
- if (buffer.string[range->start] == f_fss_comment_s.string[0]) {
- f_fss_seek_to_eol(buffer, range, state);
+ if (buffer.string[begin] == f_fss_comment_s.string[0]) {
+ state->status = f_utf_buffer_increment(buffer, range, 1);
+ if (F_status_is_error(state->status)) return;
+
+ f_fss_skip_past_delimit(buffer, range, state);
if (F_status_is_error(state->status)) return;
- if (state->status == F_okay_eos || state->status == F_okay_stop) {
- state->status = state->status == F_okay_eos ? F_data_not_eos : F_data_not_stop;
+ if (range->start >= buffer.used || range->start > range->stop) {
+ state->status = range->start >= buffer.used ? F_data_not_eos : F_data_not_stop;
return;
}
- // Move the start position to after the EOL.
- ++range->start;
- state->status = F_fss_found_object_not;
+ if (f_fss_is_combining_joiner(buffer, *range, state) == F_false) {
+ if (F_status_is_error_not(state->status)) {
+ f_fss_seek_to_eol(buffer, range, state);
+ }
- return;
+ if (F_status_is_error(state->status)) return;
+
+ if (range->start >= buffer.used || range->start > range->stop) {
+ state->status = range->start >= buffer.used ? F_data_not_eos : F_data_not_stop;
+
+ return;
+ }
+
+ // Move the start position to after the EOL.
+ ++range->start;
+ state->status = F_fss_found_object_not;
+
+ return;
+ }
+
+ range->start = begin;
}
+ #define ___fl_flag_do_escape___ 0x1
+ #define ___fl_flag_has_graph_first___ 0x2
+
const f_number_unsigned_t delimits_used = delimits->used;
+ f_number_unsigned_t location = 0;
f_number_unsigned_t slash_first = 0;
f_number_unsigned_t slash_count = 0;
f_number_unsigned_t start = 1;
f_number_unsigned_t stop = 0;
- uint8_t graph_first = F_true;
+ uint8_t flag_fl = ___fl_flag_has_graph_first___;
found->start = range->start;
// Identify where the object ends.
- while (range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
+ while (F_status_is_error_not(state->status) && range->start <= range->stop && range->start < buffer.used && buffer.string[range->start] != f_fss_eol_s.string[0]) {
if (state->interrupt) {
state->interrupt((void *) state, 0);
-
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
-
- return;
- }
+ if (F_status_is_error(state->status)) break;
}
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
slash_first = range->start++;
slash_count = 1;
+ flag_fl |= ___fl_flag_do_escape___;
- for (; range->start <= range->stop && range->start < buffer.used && (buffer.string[range->start] == f_fss_placeholder_s.string[0] || buffer.string[range->start] == f_fss_slash_s.string[0]); ++range->start) {
+ f_fss_skip_past_delimit(buffer, range, state);
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
+ // If first slash has a combining/joiner following it, then there is no escaping at all but this is not a valid escaping slash.
+ if (F_status_is_error_not(state->status)) {
+ if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+ flag_fl &= ~___fl_flag_do_escape___;
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
+ f_fss_skip_past_combining_joiner(buffer, range, state);
+ }
+ }
- return;
+ if (flag_fl & ___fl_flag_do_escape___) {
+ while (F_status_is_error_not(state->status) && range->start <= range->stop && range->start < buffer.used) {
+
+ if (state->interrupt) {
+ state->interrupt((void *) state, 0);
+ if (F_status_is_error(state->status)) break;
}
- }
- if (buffer.string[range->start] == f_fss_slash_s.string[0]) ++slash_count;
- } // for
+ if (buffer.string[range->start] == f_fss_placeholder_s.string[0]) {
+ // Do nothing.
+ }
+ else if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
+ ++slash_count;
+ }
+ else if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+ flag_fl &= ~___fl_flag_do_escape___;
+
+ f_fss_skip_past_combining_joiner(buffer, range, state);
+
+ break;
+ }
+ else {
+ break;
+ }
+
+ if (F_status_is_error_not(state->status)) {
+ state->status = f_utf_buffer_increment(buffer, range, 1);
+ }
+ } // while
+ }
+
+ if (F_status_is_error(state->status)) break;
+
+ if (!(flag_fl & ___fl_flag_do_escape___)) {
+ slash_count = 0;
+
+ continue;
+ }
if (range->start >= buffer.used || range->start > range->stop) {
delimits->used = delimits_used;
}
if (buffer.string[range->start] == list_open.string[0]) {
- graph_first = F_false;
+ flag_fl &= ~___fl_flag_has_graph_first___;
stop = range->start++;
- while (range->start <= range->stop && range->start < buffer.used) {
+ f_fss_skip_past_delimit(buffer, range, state);
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
+ if (F_status_is_error_not(state->status)) {
+ if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+ slash_count = 0;
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
+ f_fss_skip_past_combining_joiner(buffer, range, state);
- return;
- }
+ continue;
}
+ }
- if (buffer.string[range->start] == f_fss_eol_s.string[0] || f_fss_is_space(buffer, *range, state) == F_false) break;
-
- state->status = f_utf_buffer_increment(buffer, range, 1);
-
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
+ if (F_status_is_error_not(state->status)) {
+ f_fss_skip_past_space(buffer, range, state);
+ }
- return;
- }
- } // while
+ if (F_status_is_error(state->status)) break;
if (range->start >= buffer.used || range->start > range->stop) {
delimits->used = delimits_used;
return;
}
}
- else if (graph_first && buffer.string[range->start] == f_fss_comment_s.string[0]) {
- graph_first = F_false;
+ else if ((flag_fl & ___fl_flag_has_graph_first___) && buffer.string[range->start] == f_fss_comment_s.string[0]) {
+ flag_fl &= ~___fl_flag_has_graph_first___;
start = slash_first;
+ location = range->start++;
+
+ f_fss_skip_past_delimit(buffer, range, state);
+
+ if (F_status_is_error_not(state->status)) {
+ if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+ slash_count = 0;
+
+ f_fss_skip_past_combining_joiner(buffer, range, state);
+
+ continue;
+ }
+ }
+
+ if (F_status_is_error(state->status)) break;
+
+ range->start = location;
// Comments may only have white space before the '#', therefore only the first slash needs to be delimited.
state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
stop = range->start++;
}
else {
- graph_first = F_false;
+ flag_fl &= ~___fl_flag_has_graph_first___;
stop = range->start;
}
if (buffer.string[range->start] == list_open.string[0]) {
++range->start;
- while (range->start <= range->stop && range->start < buffer.used) {
+ f_fss_skip_past_delimit(buffer, range, state);
- if (state->interrupt) {
- state->interrupt((void *) state, 0);
+ if (F_status_is_error_not(state->status)) {
+ location = range->start;
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
+ if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+ f_fss_skip_past_combining_joiner(buffer, range, state);
- return;
- }
+ continue;
}
+ }
- if (buffer.string[range->start] == f_fss_eol_s.string[0] || f_fss_is_space(buffer, *range, state) == F_false) break;
-
- state->status = f_utf_buffer_increment(buffer, range, 1);
+ if (F_status_is_error_not(state->status)) {
+ range->start = location;
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
+ f_fss_skip_past_space(buffer, range, state);
+ }
- return;
- }
- } // while
+ if (F_status_is_error(state->status)) break;
if (range->start >= buffer.used) {
found->stop = buffer.used - 1;
return;
}
- if (graph_first) {
- graph_first = F_false;
+ if (flag_fl & ___fl_flag_has_graph_first___) {
+ flag_fl &= ~___fl_flag_has_graph_first___;
start = 1;
stop = 0;
}
}
if (f_fss_is_space(buffer, *range, state) == F_false) {
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
-
- return;
+ if (F_status_is_error_not(state->status)) {
+ if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
+ f_fss_skip_past_combining_joiner(buffer, range, state);
+ }
}
- if (graph_first) {
- graph_first = F_false;
- start = range->start;
+ if (F_status_is_error_not(state->status)) {
+ if (flag_fl & ___fl_flag_has_graph_first___) {
+ flag_fl &= ~___fl_flag_has_graph_first___;
+ start = range->start;
+ }
+
+ stop = range->start;
}
+ }
- stop = range->start;
+ if (F_status_is_error_not(state->status)) {
+ state->status = f_utf_buffer_increment(buffer, range, 1);
}
- state->status = f_utf_buffer_increment(buffer, range, 1);
+ if (F_status_is_error(state->status)) break;
+ } // while
- if (F_status_is_error(state->status)) {
- delimits->used = delimits_used;
+ if (F_status_is_error(state->status)) {
+ delimits->used = delimits_used;
- return;
- }
- } // while
+ return;
+ }
if (range->start >= buffer.used) {
found->stop = buffer.used - 1;
// Move the start position to after the EOL.
++range->start;
}
+
+ #undef ___fl_flag_do_escape___
+ #undef ___fl_flag_has_graph_first___
}
#endif // !defined(_di_fl_fss_basic_list_object_read_) || !defined(_di_fl_fss_embedded_list_object_read_) || !defined(_di_fl_fss_extended_list_object_read_)
}
#define ___fl_flag_do_escape___ 0x1
- #define ___fl_flag_has_graph___ 0x2
- #define ___fl_flag_has_joiner_combining___ 0x4
+ #define ___fl_flag_has_joiner_combining___ 0x2
const f_number_unsigned_t delimits_used = delimits->used;
- f_number_unsigned_t first_slash = 0;
f_number_unsigned_t location = 0;
f_number_unsigned_t previous = 0;
f_number_unsigned_t slash_count = 0;
+ f_number_unsigned_t slash_first = 0;
uint8_t flag_fl = 0x0;
f_char_t quote_found = 0;
// Identify where the object begins.
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
- first_slash = found->start = range->start;
+ slash_first = found->start = range->start;
flag_fl |= ___fl_flag_do_escape___;
state->status = f_utf_buffer_increment(buffer, range, 1);
- if (state->status == F_okay) {
+ if (F_status_is_error_not(state->status)) {
f_fss_skip_past_delimit(buffer, range, state);
}
- // If first slash has a combining/joiner following it, then there is no escaping at all so first_slash is the start of an object and is not considered an escaping character.
+ // If first slash has a combining/joiner following it, then there is no escaping at all so slash_first is the start of an object and is not considered an escaping character.
if (F_status_is_error_not(state->status)) {
if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
- range->start = first_slash;
flag_fl &= ~___fl_flag_do_escape___;
f_fss_skip_past_combining_joiner(buffer, range, state);
state->status = f_memory_array_increase(state->step_small, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
if (F_status_is_error(state->status)) return;
- delimits->array[delimits->used++] = first_slash;
+ delimits->array[delimits->used++] = slash_first;
++range->start;
}
}
// Identify where the object ends.
if (quote_found) {
- first_slash = 0;
+ slash_first = 0;
slash_count = 0;
location = 0;
}
if (buffer.string[range->start] == f_fss_slash_s.string[0]) {
- first_slash = range->start;
+ slash_first = range->start;
slash_count = 1;
state->status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(state->status)) return;
+ f_fss_skip_past_delimit(buffer, range, state);
+ if (F_status_is_error(state->status)) return;
+
if (range->start <= range->stop && range->start < buffer.used) {
if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
f_fss_skip_past_combining_joiner(buffer, range, state);
continue;
}
-
- if (F_status_is_error(state->status)) return;
}
flag_fl &= ~___fl_flag_has_joiner_combining___;
else {
if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
f_fss_skip_past_combining_joiner(buffer, range, state);
- if (F_status_is_error(state->status)) return;
flag_fl |= ___fl_flag_has_joiner_combining___;
}
- else {
- if (F_status_is_error(state->status)) return;
- }
+
+ if (F_status_is_error(state->status)) return;
break;
}
}
}
- range->start = first_slash;
+ range->start = slash_first;
if (slash_count % 2 == 0) {
state->status = f_memory_array_increase_by(slash_count / 2, sizeof(f_number_unsigned_t), (void **) &delimits->array, &delimits->used, &delimits->size);
else {
if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
f_fss_skip_past_combining_joiner(buffer, range, state);
- if (F_status_is_error(state->status)) return;
-
- continue;
- }
- else {
- if (F_status_is_error(state->status)) return;
+ if (F_status_is_error_not(state->status)) continue;
}
+
+ if (F_status_is_error(state->status)) return;
}
state->status = f_utf_buffer_increment(buffer, range, 1);
}
f_fss_skip_past_delimit(buffer, range, state);
- if (F_status_is_error(state->status)) break;
- if (range->start > range->stop || range->start >= buffer.used) break;
+ if (F_status_is_error(state->status)) return;
if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
f_fss_skip_past_combining_joiner(buffer, range, state);
- if (F_status_is_error(state->status)) return;
-
- continue;
+ if (F_status_is_error_not(state->status)) continue;
}
if (F_status_is_error(state->status)) return;
+ if (range->start > range->stop || range->start >= buffer.used) break;
// Break if a space that is not part of a joiner is found (as in if the space is not followed by a combining or joiner).
if (f_fss_is_space(buffer, *range, state) == F_true) {
}
f_fss_skip_past_delimit(buffer, range, state);
- if (F_status_is_error(state->status)) break;
+ if (F_status_is_error(state->status)) return;
if (f_fss_is_combining_joiner(buffer, *range, state) == F_true) {
f_fss_skip_past_combining_joiner(buffer, range, state);
- if (F_status_is_error(state->status)) return;
-
- continue;
+ if (F_status_is_error_not(state->status)) continue;
}
- if (F_status_is_error(state->status)) break;
+ if (F_status_is_error(state->status)) return;
range->start = previous;
break;
}
- if (F_status_is_error(state->status)) return;
+ if (F_status_is_error_not(state->status)) {
+ state->status = f_utf_buffer_increment(buffer, range, 1);
+ }
- state->status = f_utf_buffer_increment(buffer, range, 1);
if (F_status_is_error(state->status)) return;
} // while
state->status = F_fss_found_object_not;
#undef ___fl_flag_do_escape___
- #undef ___fl_flag_has_graph___
#undef ___fl_flag_has_joiner_combining___
}
#endif // !defined(_di_fl_fss_basic_object_read_) || !defined(_di_fl_fss_extended_object_read_)
#if !defined(_di_fl_fss_basic_content_read_) || !defined(_di_fl_fss_basic_object_write_) || !defined(_di_fl_fss_extended_object_write_) || !defined(_di_fl_fss_extended_content_read_) || !defined(_di_fl_fss_extended_content_write_) || !defined(_di_fl_fss_payload_header_map_)
void private_fl_fss_basic_write(const uint8_t flag, const f_string_static_t object, const uint8_t quote, f_range_t * const range, f_string_dynamic_t * const destination, f_state_t * const state, void * const internal) {
+ // TODO: update this (and all FSS write functions) to handle combining and joiners.
+
f_fss_skip_past_space(object, range, state);
if (F_status_is_error(state->status) || state->status == F_data_not) return;
fl_fss_basic_list_object_read(buffer_string, &range, &found, &delimits, &state);
+ if (!(state.status == F_fss_found_object || state.status == F_fss_found_object_not)) {
+ printf("[ -------> ] --- [00] Failure with line (%u) '%s', status=%u, expected %u or %u.\n", line, line_string, state.status, F_fss_found_object, F_fss_found_object_not);
+ }
+
assert_true(state.status == F_fss_found_object || state.status == F_fss_found_object_not);
if (state.status == F_fss_found_object) {
max = 255;
result = getline(&line_object, &max, file_objects);
+
+ if (!result) {
+ printf("[ -------> ] --- [01] Failure with line (%u) '%s', line_object = '%s', result=%zu.\n", line, line_string, line_object, result);
+ }
+
assert_return_code(result, 0);
// The newline is copied by getline(), and so remove that newline before comparing.
if (found.start <= found.stop) {
{
const f_status_t status = f_string_dynamic_append(buffer_string, &delimit_string);
+
+ if (status != F_okay) {
+ printf("[ -------> ] --- [02] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, status, F_okay);
+ }
+
assert_int_equal(status, F_okay);
}
state.status = F_none;
f_fss_apply_delimit(delimits, &delimit_string, &state);
+
+ if (state.status != F_okay) {
+ printf("[ -------> ] --- [03] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, state.status, F_okay);
+ }
+
assert_int_equal(state.status, F_okay);
{
const f_status_t status = f_string_dynamic_partial_append_nulless(delimit_string, found, &result_string);
+
+ if (!(status == F_okay || status == F_data_not_eos)) {
+ printf("[ -------> ] --- [04] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u or %u.\n", line, line_string, line_object, status, F_okay, F_data_not_eos);
+ }
+
assert_true(status == F_okay || status == F_data_not_eos);
}
{
const f_status_t status = f_string_dynamic_terminate_after(&result_string);
+
+ if (status != F_okay) {
+ printf("[ -------> ] --- [05] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, status, F_okay);
+ }
+
assert_int_equal(status, F_okay);
}
+ if (strncmp(result_string.string, line_object, result_string.used)) {
+ printf("[ -------> ] --- [06] Failure with line (%u) '%s', line_object = '%s', result '%s'.\n", line, line_string, line_object, result_string.string);
+ }
+
assert_string_equal(result_string.string, line_object);
}
else {
+ if (line_object[0]) {
+ printf("[ -------> ] --- [07] Failure with line (%u) '%s', line_object[0]=%c.\n", line, line_string, line_object[0]);
+ }
+
assert_int_equal(line_object[0], 0);
}
}
fl_fss_embedded_list_object_read(buffer_string, &range, &found, &delimits, &state);
+ if (!(state.status == F_fss_found_object || state.status == F_fss_found_object_not)) {
+ printf("[ -------> ] --- [00] Failure with line (%u) '%s', status=%u, expected %u or %u.\n", line, line_string, state.status, F_fss_found_object, F_fss_found_object_not);
+ }
+
assert_true(state.status == F_fss_found_object || state.status == F_fss_found_object_not);
if (state.status == F_fss_found_object) {
max = 255;
result = getline(&line_object, &max, file_objects);
+
+ if (!result) {
+ printf("[ -------> ] --- [01] Failure with line (%u) '%s', line_object = '%s', result=%zu.\n", line, line_string, line_object, result);
+ }
+
assert_return_code(result, 0);
// The newline is copied by getline(), and so remove that newline before comparing.
if (found.start <= found.stop) {
{
const f_status_t status = f_string_dynamic_append(buffer_string, &delimit_string);
+
+ if (status != F_okay) {
+ printf("[ -------> ] --- [02] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, status, F_okay);
+ }
+
assert_int_equal(status, F_okay);
}
state.status = F_none;
f_fss_apply_delimit(delimits, &delimit_string, &state);
+
+ if (state.status != F_okay) {
+ printf("[ -------> ] --- [03] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, state.status, F_okay);
+ }
+
assert_int_equal(state.status, F_okay);
{
const f_status_t status = f_string_dynamic_partial_append_nulless(delimit_string, found, &result_string);
+
+ if (!(status == F_okay || status == F_data_not_eos)) {
+ printf("[ -------> ] --- [04] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u or %u.\n", line, line_string, line_object, status, F_okay, F_data_not_eos);
+ }
+
assert_true(status == F_okay || status == F_data_not_eos);
}
{
const f_status_t status = f_string_dynamic_terminate_after(&result_string);
+
+ if (status != F_okay) {
+ printf("[ -------> ] --- [05] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, status, F_okay);
+ }
+
assert_int_equal(status, F_okay);
}
+ if (strncmp(result_string.string, line_object, result_string.used)) {
+ printf("[ -------> ] --- [06] Failure with line (%u) '%s', line_object = '%s', result '%s'.\n", line, line_string, line_object, result_string.string);
+ }
+
assert_string_equal(result_string.string, line_object);
}
else {
+ if (line_object[0]) {
+ printf("[ -------> ] --- [07] Failure with line (%u) '%s', line_object[0]=%c.\n", line, line_string, line_object[0]);
+ }
+
assert_int_equal(line_object[0], 0);
}
}
fl_fss_extended_list_object_read(buffer_string, &range, &found, &delimits, &state);
+ if (!(state.status == F_fss_found_object || state.status == F_fss_found_object_not)) {
+ printf("[ -------> ] --- [00] Failure with line (%u) '%s', status=%u, expected %u or %u.\n", line, line_string, state.status, F_fss_found_object, F_fss_found_object_not);
+ }
+
assert_true(state.status == F_fss_found_object || state.status == F_fss_found_object_not);
if (state.status == F_fss_found_object) {
max = 255;
result = getline(&line_object, &max, file_objects);
+
+ if (!result) {
+ printf("[ -------> ] --- [01] Failure with line (%u) '%s', line_object = '%s', result=%zu.\n", line, line_string, line_object, result);
+ }
+
assert_return_code(result, 0);
// The newline is copied by getline(), and so remove that newline before comparing.
if (found.start <= found.stop) {
{
const f_status_t status = f_string_dynamic_append(buffer_string, &delimit_string);
+
+ if (status != F_okay) {
+ printf("[ -------> ] --- [02] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, status, F_okay);
+ }
+
assert_int_equal(status, F_okay);
}
state.status = F_none;
f_fss_apply_delimit(delimits, &delimit_string, &state);
+
+ if (state.status != F_okay) {
+ printf("[ -------> ] --- [03] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, state.status, F_okay);
+ }
+
assert_int_equal(state.status, F_okay);
{
const f_status_t status = f_string_dynamic_partial_append_nulless(delimit_string, found, &result_string);
+
+ if (!(status == F_okay || status == F_data_not_eos)) {
+ printf("[ -------> ] --- [04] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u or %u.\n", line, line_string, line_object, status, F_okay, F_data_not_eos);
+ }
+
assert_true(status == F_okay || status == F_data_not_eos);
}
{
const f_status_t status = f_string_dynamic_terminate_after(&result_string);
+
+ if (status != F_okay) {
+ printf("[ -------> ] --- [05] Failure with line (%u) '%s', line_object = '%s', status=%u, expected %u.\n", line, line_string, line_object, status, F_okay);
+ }
+
assert_int_equal(status, F_okay);
}
+ if (strncmp(result_string.string, line_object, result_string.used)) {
+ printf("[ -------> ] --- [06] Failure with line (%u) '%s', line_object = '%s', result '%s'.\n", line, line_string, line_object, result_string.string);
+ }
+
assert_string_equal(result_string.string, line_object);
}
else {
+ if (line_object[0]) {
+ printf("[ -------> ] --- [07] Failure with line (%u) '%s', line_object[0]=%c.\n", line, line_string, line_object[0]);
+ }
+
assert_int_equal(line_object[0], 0);
}
}