These "_back" functions work based on the stop position of the range.
#define _di_f_string_dynamic_prepend_assure_nulless_
#define _di_f_string_dynamic_prepend_nulless_
#define _di_f_string_dynamic_seek_line_
+#define _di_f_string_dynamic_seek_line_back_
#define _di_f_string_dynamic_seek_line_to_
+#define _di_f_string_dynamic_seek_line_to_back_
#define _di_f_string_dynamic_seek_to_
+#define _di_f_string_dynamic_seek_to_back_
#define _di_f_string_dynamic_strip_null_
#define _di_f_string_dynamic_strip_null_range_
//#define _di_f_string_dynamic_t_
#define _di_f_string_prepend_assure_nulless_
#define _di_f_string_prepend_nulless_
#define _di_f_string_seek_line_
+#define _di_f_string_seek_line_back_
#define _di_f_string_seek_line_to_
+#define _di_f_string_seek_line_to_back_
#define _di_f_string_seek_to_
+#define _di_f_string_seek_to_back_
//#define _di_f_string_space_s_
//#define _di_f_string_static_t_
//#define _di_f_string_statics_t_
#define _di_f_utf_string_dynamic_prepend_assure_nulless_
#define _di_f_utf_string_dynamic_prepend_nulless_
#define _di_f_utf_string_dynamic_seek_line_
+#define _di_f_utf_string_dynamic_seek_line_back_
#define _di_f_utf_string_dynamic_seek_line_to_
+#define _di_f_utf_string_dynamic_seek_line_to_back_
#define _di_f_utf_string_dynamic_seek_to_
+#define _di_f_utf_string_dynamic_seek_to_back_
//#define _di_f_utf_string_dynamic_t_
#define _di_f_utf_string_dynamic_terminate_
#define _di_f_utf_string_dynamic_terminate_after_
#define _di_f_utf_string_prepend_assure_nulless_
#define _di_f_utf_string_prepend_nulless_
#define _di_f_utf_string_seek_line_
+#define _di_f_utf_string_seek_line_back_
#define _di_f_utf_string_seek_line_to_
+#define _di_f_utf_string_seek_line_to_back_
#define _di_f_utf_string_seek_to_
+#define _di_f_utf_string_seek_to_back_
//#define _di_f_utf_string_static_t_
#define _di_f_utf_string_statics_t_
#define _di_f_utf_string_staticss_t_
#define _di_f_string_dynamic_prepend_assure_nulless_
#define _di_f_string_dynamic_prepend_nulless_
#define _di_f_string_dynamic_seek_line_
+#define _di_f_string_dynamic_seek_line_back_
#define _di_f_string_dynamic_seek_line_to_
+#define _di_f_string_dynamic_seek_line_to_back_
#define _di_f_string_dynamic_seek_to_
+#define _di_f_string_dynamic_seek_to_back_
#define _di_f_string_dynamic_strip_null_
#define _di_f_string_dynamic_strip_null_range_
//#define _di_f_string_dynamic_t_
#define _di_f_string_prepend_assure_nulless_
#define _di_f_string_prepend_nulless_
#define _di_f_string_seek_line_
+#define _di_f_string_seek_line_back_
#define _di_f_string_seek_line_to_
+#define _di_f_string_seek_line_to_back_
#define _di_f_string_seek_to_
+#define _di_f_string_seek_to_back_
#define _di_f_string_space_s_
//#define _di_f_string_static_t_
//#define _di_f_string_statics_t_
#define _di_f_utf_string_dynamic_prepend_assure_nulless_
#define _di_f_utf_string_dynamic_prepend_nulless_
#define _di_f_utf_string_dynamic_seek_line_
+#define _di_f_utf_string_dynamic_seek_line_back_
#define _di_f_utf_string_dynamic_seek_line_to_
+#define _di_f_utf_string_dynamic_seek_line_to_back_
#define _di_f_utf_string_dynamic_seek_to_
+#define _di_f_utf_string_dynamic_seek_to_back_
#define _di_f_utf_string_dynamic_t_
#define _di_f_utf_string_dynamic_terminate_
#define _di_f_utf_string_dynamic_terminate_after_
#define _di_f_utf_string_prepend_assure_nulless_
#define _di_f_utf_string_prepend_nulless_
#define _di_f_utf_string_seek_line_
+#define _di_f_utf_string_seek_line_back_
#define _di_f_utf_string_seek_line_to_
+#define _di_f_utf_string_seek_line_to_back_
#define _di_f_utf_string_seek_to_
+#define _di_f_utf_string_seek_to_back_
#define _di_f_utf_string_static_t_
#define _di_f_utf_string_statics_t_
#define _di_f_utf_string_staticss_t_
#define _di_f_string_dynamic_prepend_assure_nulless_
#define _di_f_string_dynamic_prepend_nulless_
#define _di_f_string_dynamic_seek_line_
+#define _di_f_string_dynamic_seek_line_back_
#define _di_f_string_dynamic_seek_line_to_
+#define _di_f_string_dynamic_seek_line_to_back_
#define _di_f_string_dynamic_seek_to_
+#define _di_f_string_dynamic_seek_to_back_
#define _di_f_string_dynamic_strip_null_
#define _di_f_string_dynamic_strip_null_range_
//#define _di_f_string_dynamic_t_
#define _di_f_string_prepend_assure_nulless_
#define _di_f_string_prepend_nulless_
#define _di_f_string_seek_line_
+#define _di_f_string_seek_line_back_
#define _di_f_string_seek_line_to_
+#define _di_f_string_seek_line_to_back_
#define _di_f_string_seek_to_
+#define _di_f_string_seek_to_back_
//#define _di_f_string_space_s_
//#define _di_f_string_static_t_
//#define _di_f_string_statics_t_
#define _di_f_utf_string_dynamic_prepend_assure_nulless_
#define _di_f_utf_string_dynamic_prepend_nulless_
#define _di_f_utf_string_dynamic_seek_line_
+#define _di_f_utf_string_dynamic_seek_line_back_
#define _di_f_utf_string_dynamic_seek_line_to_
+#define _di_f_utf_string_dynamic_seek_line_to_back_
#define _di_f_utf_string_dynamic_seek_to_
+#define _di_f_utf_string_dynamic_seek_to_back_
//#define _di_f_utf_string_dynamic_t_
#define _di_f_utf_string_dynamic_terminate_
//#define _di_f_utf_string_dynamic_terminate_after_
#define _di_f_utf_string_prepend_assure_nulless_
#define _di_f_utf_string_prepend_nulless_
#define _di_f_utf_string_seek_line_
+#define _di_f_utf_string_seek_line_back_
#define _di_f_utf_string_seek_line_to_
+#define _di_f_utf_string_seek_line_to_back_
#define _di_f_utf_string_seek_to_
+#define _di_f_utf_string_seek_to_back_
//#define _di_f_utf_string_static_t_
//#define _di_f_utf_string_statics_t_
#define _di_f_utf_string_staticss_t_
#define _di_f_string_dynamic_prepend_assure_nulless_
#define _di_f_string_dynamic_prepend_nulless_
#define _di_f_string_dynamic_seek_line_
+#define _di_f_string_dynamic_seek_line_back_
#define _di_f_string_dynamic_seek_line_to_
+#define _di_f_string_dynamic_seek_line_to_back_
#define _di_f_string_dynamic_seek_to_
+#define _di_f_string_dynamic_seek_to_back_
#define _di_f_string_dynamic_strip_null_
#define _di_f_string_dynamic_strip_null_range_
//#define _di_f_string_dynamic_t_
#define _di_f_string_prepend_assure_nulless_
#define _di_f_string_prepend_nulless_
#define _di_f_string_seek_line_
+#define _di_f_string_seek_line_back_
#define _di_f_string_seek_line_to_
+#define _di_f_string_seek_line_to_back_
#define _di_f_string_seek_to_
+#define _di_f_string_seek_to_back_
#define _di_f_string_space_s_
//#define _di_f_string_static_t_
//#define _di_f_string_statics_t_
#define _di_f_utf_string_dynamic_prepend_assure_nulless_
#define _di_f_utf_string_dynamic_prepend_nulless_
#define _di_f_utf_string_dynamic_seek_line_
+#define _di_f_utf_string_dynamic_seek_line_back_
#define _di_f_utf_string_dynamic_seek_line_to_
+#define _di_f_utf_string_dynamic_seek_line_to_back_
#define _di_f_utf_string_dynamic_seek_to_
+#define _di_f_utf_string_dynamic_seek_to_back_
#define _di_f_utf_string_dynamic_t_
#define _di_f_utf_string_dynamic_terminate_
#define _di_f_utf_string_dynamic_terminate_after_
#define _di_f_utf_string_prepend_assure_nulless_
#define _di_f_utf_string_prepend_nulless_
#define _di_f_utf_string_seek_line_
+#define _di_f_utf_string_seek_line_back_
#define _di_f_utf_string_seek_line_to_
+#define _di_f_utf_string_seek_line_to_back_
#define _di_f_utf_string_seek_to_
+#define _di_f_utf_string_seek_to_back_
#define _di_f_utf_string_static_t_
#define _di_f_utf_string_statics_t_
#define _di_f_utf_string_staticss_t_
#define _di_f_string_dynamic_prepend_assure_nulless_
#define _di_f_string_dynamic_prepend_nulless_
#define _di_f_string_dynamic_seek_line_
+#define _di_f_string_dynamic_seek_line_back_
#define _di_f_string_dynamic_seek_line_to_
+#define _di_f_string_dynamic_seek_line_to_back_
#define _di_f_string_dynamic_seek_to_
+#define _di_f_string_dynamic_seek_to_back_
#define _di_f_string_dynamic_strip_null_
#define _di_f_string_dynamic_strip_null_range_
//#define _di_f_string_dynamic_t_
#define _di_f_string_prepend_assure_nulless_
#define _di_f_string_prepend_nulless_
#define _di_f_string_seek_line_
+#define _di_f_string_seek_line_back_
#define _di_f_string_seek_line_to_
+#define _di_f_string_seek_line_to_back_
#define _di_f_string_seek_to_
+#define _di_f_string_seek_to_back_
//#define _di_f_string_space_s_
//#define _di_f_string_static_t_
//#define _di_f_string_statics_t_
#define _di_f_utf_string_dynamic_prepend_assure_nulless_
#define _di_f_utf_string_dynamic_prepend_nulless_
#define _di_f_utf_string_dynamic_seek_line_
+#define _di_f_utf_string_dynamic_seek_line_back_
#define _di_f_utf_string_dynamic_seek_line_to_
+#define _di_f_utf_string_dynamic_seek_line_to_back_
#define _di_f_utf_string_dynamic_seek_to_
+#define _di_f_utf_string_dynamic_seek_to_back_
//#define _di_f_utf_string_dynamic_t_
#define _di_f_utf_string_dynamic_terminate_
#define _di_f_utf_string_dynamic_terminate_after_
#define _di_f_utf_string_prepend_assure_nulless_
#define _di_f_utf_string_prepend_nulless_
#define _di_f_utf_string_seek_line_
+#define _di_f_utf_string_seek_line_back_
#define _di_f_utf_string_seek_line_to_
+#define _di_f_utf_string_seek_line_to_back_
#define _di_f_utf_string_seek_to_
+#define _di_f_utf_string_seek_to_back_
//#define _di_f_utf_string_static_t_
#define _di_f_utf_string_statics_t_
#define _di_f_utf_string_staticss_t_
}
#endif // _di_f_string_seek_line_
+#ifndef _di_f_string_seek_line_back_
+ f_status_t f_string_seek_line_back(const f_string_t string, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != f_string_eol_s.string[0]) {
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_string_seek_line_back_
+
#ifndef _di_f_string_seek_line_to_
f_status_t f_string_seek_line_to(const f_string_t string, const f_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_string_seek_line_to_
+#ifndef _di_f_string_seek_line_to_back_
+ f_status_t f_string_seek_line_to_back(const f_string_t string, const f_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ if (string[range->stop] == f_string_eol_s.string[0]) return F_okay_eol;
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_string_seek_line_to_back_
+
#ifndef _di_f_string_seek_to_
f_status_t f_string_seek_to(const f_string_t string, const f_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_string_seek_to_
+#ifndef _di_f_string_seek_to_back_
+ f_status_t f_string_seek_to_back(const f_string_t string, const f_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_string_seek_line_
/**
+ * Seek the string location backward until EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ */
+#ifndef _di_f_string_seek_line_back_
+ extern f_status_t f_string_seek_line_back(const f_string_t string, f_range_t * const range);
+#endif // _di_f_string_seek_line_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) or EOL is reached.
*
* @param string
#endif // _di_f_string_seek_line_to_
/**
+ * Seek the string location backward until the character (1-byte wide) or EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A single-width character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decrementd by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eol on success, but stopped at EOL.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_string_seek_line_to_back_
+ extern f_status_t f_string_seek_line_to_back(const f_string_t string, const f_char_t seek_to, f_range_t * const range);
+#endif // _di_f_string_seek_line_to_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) is reached.
*
* @param string
extern f_status_t f_string_seek_to(const f_string_t string, const f_char_t seek_to, f_range_t * const range);
#endif // _di_f_string_seek_to_
+/**
+ * Seek the string location backward until the character (1-byte wide) is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A single-width character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_complete_not_utf (with error bit) if character is an incomplete UTF-8 fragment.
+ * F_complete_not_utf_stop (with error bit) if the stop location is reached before the complete UTF-8 character can be processed.
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_string_seek_to_back_
+ extern f_status_t f_string_seek_to_back(const f_string_t string, const f_char_t seek_to, f_range_t * const range);
+#endif // _di_f_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // _di_f_string_dynamic_seek_line_
+#ifndef _di_f_string_dynamic_seek_line_back_
+ f_status_t f_string_dynamic_seek_line_back(const f_string_static_t buffer, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (buffer.string[range->stop] != f_string_eol_s.string[0]) {
+
+ --range->stop;
+
+ if (!range->stop) return (buffer.string[range->stop] == f_string_eol_s.string[0]) ? F_okay : F_okay_eos;
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_string_dynamic_seek_line_back_
+
#ifndef _di_f_string_dynamic_seek_line_to_
f_status_t f_string_dynamic_seek_line_to(const f_string_static_t buffer, const f_char_t seek_to_this, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_string_dynamic_seek_line_to_
+#ifndef _di_f_string_dynamic_seek_line_to_back_
+ f_status_t f_string_dynamic_seek_line_to_back(const f_string_static_t buffer, const f_char_t seek_to_this, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (buffer.string[range->stop] != seek_to_this) {
+
+ if (buffer.string[range->stop] == f_string_eol_s.string[0]) return F_okay_eol;
+
+ --range->stop;
+
+ if (!range->stop) return (buffer.string[0] == seek_to_this) ? F_okay : F_okay_eos;
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_string_dynamic_seek_line_to_back_
+
#ifndef _di_f_string_dynamic_seek_to_
f_status_t f_string_dynamic_seek_to(const f_string_static_t buffer, const f_char_t seek_to_this, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_string_dynamic_seek_to_
+#ifndef _di_f_string_dynamic_seek_to_back_
+ f_status_t f_string_dynamic_seek_to_back(const f_string_static_t buffer, const f_char_t seek_to_this, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (buffer.string[range->stop] != seek_to_this) {
+
+ --range->stop;
+
+ if (!range->stop) return (buffer.string[0] == seek_to_this) ? F_okay : F_okay_eos;
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_string_dynamic_seek_to_back_
+
#ifndef _di_f_string_dynamic_strip_null_
f_status_t f_string_dynamic_strip_null(f_string_dynamic_t * const buffer) {
#ifndef _di_level_0_parameter_checking_
#endif // _di_f_string_dynamic_seek_line_
/**
+ * Seek the buffer location backward until EOL is reached.
+ *
+ * @param buffer
+ * The buffer to traverse.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eos on success, but stopped at end of string.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not on success, but there was no string data to seek.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamic_seek_line_back_
+ extern f_status_t f_string_dynamic_seek_line_back(const f_string_static_t buffer, f_range_t * const range);
+#endif // _di_f_string_dynamic_seek_line_back_
+
+/**
* Seek the buffer location forward until the character (1-byte wide) or EOL is reached.
*
* @param buffer
#endif // _di_f_string_dynamic_seek_line_to_
/**
+ * Seek the buffer location backward until the character (1-byte wide) or EOL is reached.
+ *
+ * @param buffer
+ * The buffer to traverse.
+ * @param seek_to_this
+ * A single-width character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eos on success, but stopped at end of string.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not on success, but there was no string data to seek.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamic_seek_line_to_back_
+ extern f_status_t f_string_dynamic_seek_line_to_back(const f_string_static_t buffer, const f_char_t seek_to_this, f_range_t * const range);
+#endif // _di_f_string_dynamic_seek_line_to_back_
+
+/**
* Seek the buffer location forward until the character (1-byte wide) is reached.
*
* @param buffer
#endif // _di_f_string_dynamic_seek_to_
/**
+ * Seek the buffer location backward until the character (1-byte wide) is reached.
+ *
+ * @param buffer
+ * The buffer to traverse.
+ * @param seek_to_this
+ * A single-width character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eos on success, but stopped at end of string.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not on success, but there was no string data to seek.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_dynamic_seek_to_back_
+ extern f_status_t f_string_dynamic_seek_to_back(const f_string_static_t buffer, const f_char_t seek_to_this, f_range_t * const range);
+#endif // _di_f_string_dynamic_seek_to_back_
+
+/**
* String all NULLs from the given string.
*
* This does not resize the string.
build_sources_program test-string-dynamic_partial_mish.c test-string-dynamic_partial_mish_nulless.c
build_sources_program test-string-dynamic_partial_prepend.c test-string-dynamic_partial_prepend_assure.c test-string-dynamic_partial_prepend_assure_nulless.c test-string-dynamic_partial_prepend_nulless.c
build_sources_program test-string-dynamic_prepend.c test-string-dynamic_prepend_assure.c test-string-dynamic_prepend_assure_nulless.c test-string-dynamic_prepend_nulless.c
-build_sources_program test-string-dynamic_seek_line.c test-string-dynamic_seek_line_to.c test-string-dynamic_seek_to.c
+build_sources_program test-string-dynamic_seek_line.c test-string-dynamic_seek_line_back.c test-string-dynamic_seek_line_to.c test-string-dynamic_seek_line_to_back.c test-string-dynamic_seek_to.c test-string-dynamic_seek_to_back.c
build_sources_program test-string-dynamic_strip_null.c test-string-dynamic_strip_null_range.c
build_sources_program test-string-dynamic_terminate.c test-string-dynamic_terminate_after.c
build_sources_program test-string-dynamics_append.c test-string-dynamics_append_all.c test-string-dynamicss_append.c test-string-dynamicss_append_all.c
build_sources_program test-string-mash.c test-string-mash_nulless.c
build_sources_program test-string-mish.c test-string-mish_nulless.c
build_sources_program test-string-prepend.c test-string-prepend_assure.c test-string-prepend_assure_nulless.c test-string-prepend_nulless.c
-build_sources_program test-string-seek_line.c test-string-seek_line_to.c test-string-seek_to.c
+build_sources_program test-string-seek_line.c test-string-seek_line_back.c test-string-seek_line_to.c test-string-seek_line_to_back.c test-string-seek_to.c test-string-seek_to_back.c
build_sources_program test-string-triples_append.c test-string-triples_append_all.c test-string-tripless_append.c test-string-tripless_append_all.c
build_sources_program test-string-triples_delete_callback.c test-string-triples_destroy_callback.c
build_sources_program test-string-tripless_delete_callback.c test-string-tripless_destroy_callback.c
--- /dev/null
+#include "test-string.h"
+#include "test-string-dynamic_seek_line_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_string_dynamic_seek_line_back__parameter_checking(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ const f_status_t status = f_string_dynamic_seek_line_back(source, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_string_dynamic_seek_line_back__returns_data_not_stop(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_string_dynamic_seek_line_back__returns_none_eos(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_okay_eos);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 0);
+ }
+}
+
+void test__f_string_dynamic_seek_line_back__returns_none_stop(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_string_dynamic_seek_line_back__works(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 4);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: String
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the string project.
+ */
+#ifndef _TEST__F_string_dynamic_seek_line_back_h
+#define _TEST__F_string_dynamic_seek_line_back_h
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_string_dynamic_seek_line_back()
+ */
+extern void test__f_string_dynamic_seek_line_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_string_dynamic_seek_line_back()
+ */
+extern void test__f_string_dynamic_seek_line_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_eos stopped after end of string because no newline is found.
+ *
+ * @see f_string_dynamic_seek_line_back()
+ */
+extern void test__f_string_dynamic_seek_line_back__returns_none_eos(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_string_dynamic_seek_line_back()
+ */
+extern void test__f_string_dynamic_seek_line_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_string_dynamic_seek_line_back()
+ */
+extern void test__f_string_dynamic_seek_line_back__works(void **state);
+
+#endif // _TEST__F_string_dynamic_seek_line_back_h
--- /dev/null
+#include "test-string.h"
+#include "test-string-dynamic_seek_line_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_string_dynamic_seek_line_to_back__at_newline(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("te\nXst", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_string_dynamic_seek_line_to_back__parameter_checking(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ const f_status_t status = f_string_dynamic_seek_line_to_back(source, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_string_dynamic_seek_line_to_back__returns_data_not_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_string_dynamic_seek_line_to_back__returns_none_eos(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eos);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 0);
+ }
+}
+
+void test__f_string_dynamic_seek_line_to_back__returns_none_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_string_dynamic_seek_line_to_back__works(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eol);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: String
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the string project.
+ */
+#ifndef _TEST__F_string_dynamic_seek_line_to_back_h
+#define _TEST__F_string_dynamic_seek_line_to_back_h
+
+/**
+ * Test that the function works but stops at newline rather than search string.
+ *
+ * @see f_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_string_dynamic_seek_line_to_back__at_newline(void **state);
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_string_dynamic_seek_line_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_string_dynamic_seek_line_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_eos stopped after end of string because no newline is found.
+ *
+ * @see f_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_string_dynamic_seek_line_to_back__returns_none_eos(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_string_dynamic_seek_line_to_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_string_dynamic_seek_line_to_back__works(void **state);
+
+#endif // _TEST__F_string_dynamic_seek_line_to_back_h
--- /dev/null
+#include "test-string.h"
+#include "test-string-dynamic_seek_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_string_dynamic_seek_to_back__parameter_checking(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ const f_status_t status = f_string_dynamic_seek_to_back(source, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_string_dynamic_seek_to_back__returns_data_not_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_string_dynamic_seek_to_back__returns_none_eos(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eos);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 0);
+ }
+}
+
+void test__f_string_dynamic_seek_to_back__returns_none_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_string_dynamic_seek_to_back__works(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("te\nXst", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: String
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the string project.
+ */
+#ifndef _TEST__F_string_dynamic_seek_to_back_h
+#define _TEST__F_string_dynamic_seek_to_back_h
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_string_dynamic_seek_to_back()
+ */
+extern void test__f_string_dynamic_seek_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_string_dynamic_seek_to_back()
+ */
+extern void test__f_string_dynamic_seek_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_eos stopped after end of string because no newline is found.
+ *
+ * @see f_string_dynamic_seek_to_back()
+ */
+extern void test__f_string_dynamic_seek_to_back__returns_none_eos(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_string_dynamic_seek_to_back()
+ */
+extern void test__f_string_dynamic_seek_to_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_string_dynamic_seek_to_back()
+ */
+extern void test__f_string_dynamic_seek_to_back__works(void **state);
+
+#endif // _TEST__F_string_dynamic_seek_to_back_h
--- /dev/null
+#include "test-string.h"
+#include "test-string-seek_line_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_string_seek_line_back__parameter_checking(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ const f_status_t status = f_string_seek_line_back(source.string, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_string_seek_line_back__returns_data_not_stop(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_string_seek_line_back(source.string, &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_string_seek_line_back__returns_none_stop(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_string_seek_line_back(source.string, &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_string_seek_line_back__works(void **state) {
+
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_seek_line_back(source.string, &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 4);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: String
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the string project.
+ */
+#ifndef _TEST__F_string_seek_line_back_h
+#define _TEST__F_string_seek_line_back_h
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_string_seek_line_back()
+ */
+extern void test__f_string_seek_line_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_string_seek_line_back()
+ */
+extern void test__f_string_seek_line_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_string_seek_line_back()
+ */
+extern void test__f_string_seek_line_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_string_seek_line_back()
+ */
+extern void test__f_string_seek_line_back__works(void **state);
+
+#endif // _TEST__F_string_seek_line_back_h
--- /dev/null
+#include "test-string.h"
+#include "test-string-seek_line_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_string_seek_line_to_back__at_newline(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("te\nXst", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_string_seek_line_to_back__parameter_checking(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ const f_status_t status = f_string_seek_line_to_back(source.string, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_string_seek_line_to_back__returns_data_not_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_string_seek_line_to_back__returns_none_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_string_seek_line_to_back__works(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eol);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: String
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the string project.
+ */
+#ifndef _TEST__F_string_seek_line_to_back_h
+#define _TEST__F_string_seek_line_to_back_h
+
+/**
+ * Test that the function works but stops at newline rather than search string.
+ *
+ * @see f_string_seek_line_to_back()
+ */
+extern void test__f_string_seek_line_to_back__at_newline(void **state);
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_string_seek_line_to_back()
+ */
+extern void test__f_string_seek_line_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_string_seek_line_to_back()
+ */
+extern void test__f_string_seek_line_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_string_seek_line_to_back()
+ */
+extern void test__f_string_seek_line_to_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_string_seek_line_to_back()
+ */
+extern void test__f_string_seek_line_to_back__works(void **state);
+
+#endif // _TEST__F_string_seek_line_to_back_h
--- /dev/null
+#include "test-string.h"
+#include "test-string-seek_to.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_string_seek_to_back__parameter_checking(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("teX\nst", 0, 6);
+
+ {
+ const f_status_t status = f_string_seek_to_back(source.string, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_string_seek_to_back__returns_data_not_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_string_seek_to_back__returns_none_stop(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("test\nafter", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_string_seek_to_back__works(void **state) {
+
+ const f_string_static_t to = macro_f_string_static_t_initialize_1("X", 0, 1);
+ const f_string_static_t source = macro_f_string_static_t_initialize_1("te\nXst", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: String
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the string project.
+ */
+#ifndef _TEST__F_string_seek_to_back_h
+#define _TEST__F_string_seek_to_back_h
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_string_seek_to_back()
+ */
+extern void test__f_string_seek_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_string_seek_to_back()
+ */
+extern void test__f_string_seek_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_string_seek_to_back()
+ */
+extern void test__f_string_seek_to_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_string_seek_to_back()
+ */
+extern void test__f_string_seek_to_back__works(void **state);
+
+#endif // _TEST__F_string_seek_to_back_h
cmocka_unit_test(test__f_string_dynamic_seek_line__returns_none_stop),
cmocka_unit_test(test__f_string_dynamic_seek_line__works),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_back__returns_none_eos),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_back__returns_none_stop),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_back__works),
+
cmocka_unit_test(test__f_string_dynamic_seek_line_to__at_newline),
cmocka_unit_test(test__f_string_dynamic_seek_line_to__returns_data_not_stop),
cmocka_unit_test(test__f_string_dynamic_seek_line_to__returns_none_eos),
cmocka_unit_test(test__f_string_dynamic_seek_line_to__returns_none_stop),
cmocka_unit_test(test__f_string_dynamic_seek_line_to__works),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_to_back__at_newline),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_to_back__returns_none_eos),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_to_back__returns_none_stop),
+ cmocka_unit_test(test__f_string_dynamic_seek_line_to_back__works),
+
cmocka_unit_test(test__f_string_dynamic_seek_to__returns_data_not_stop),
cmocka_unit_test(test__f_string_dynamic_seek_to__returns_none_eos),
cmocka_unit_test(test__f_string_dynamic_seek_to__returns_none_stop),
cmocka_unit_test(test__f_string_dynamic_seek_to__works),
+ cmocka_unit_test(test__f_string_dynamic_seek_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_string_dynamic_seek_to_back__returns_none_eos),
+ cmocka_unit_test(test__f_string_dynamic_seek_to_back__returns_none_stop),
+ cmocka_unit_test(test__f_string_dynamic_seek_to_back__works),
+
cmocka_unit_test(test__f_string_dynamic_strip_null__returns_data_not),
cmocka_unit_test(test__f_string_dynamic_strip_null__works),
cmocka_unit_test(test__f_string_seek_line__returns_none_stop),
cmocka_unit_test(test__f_string_seek_line__works),
+ cmocka_unit_test(test__f_string_seek_line_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_string_seek_line_back__returns_none_stop),
+ cmocka_unit_test(test__f_string_seek_line_back__works),
+
cmocka_unit_test(test__f_string_seek_line_to__at_newline),
cmocka_unit_test(test__f_string_seek_line_to__returns_data_not_stop),
cmocka_unit_test(test__f_string_seek_line_to__returns_none_stop),
cmocka_unit_test(test__f_string_seek_line_to__works),
+ cmocka_unit_test(test__f_string_seek_line_to_back__at_newline),
+ cmocka_unit_test(test__f_string_seek_line_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_string_seek_line_to_back__returns_none_stop),
+ cmocka_unit_test(test__f_string_seek_line_to_back__works),
+
cmocka_unit_test(test__f_string_seek_to__returns_data_not_stop),
cmocka_unit_test(test__f_string_seek_to__returns_none_stop),
cmocka_unit_test(test__f_string_seek_to__works),
+ cmocka_unit_test(test__f_string_seek_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_string_seek_to_back__returns_none_stop),
+ cmocka_unit_test(test__f_string_seek_to_back__works),
+
cmocka_unit_test(test__f_string_dynamics_delete_callback__fails),
cmocka_unit_test(test__f_string_dynamics_destroy_callback__fails),
cmocka_unit_test(test__f_string_dynamics_delete_callback__works),
#include "test-string-dynamic_prepend_assure_nulless.h"
#include "test-string-dynamic_prepend_nulless.h"
#include "test-string-dynamic_seek_line.h"
+#include "test-string-dynamic_seek_line_back.h"
#include "test-string-dynamic_seek_line_to.h"
+#include "test-string-dynamic_seek_line_to_back.h"
#include "test-string-dynamic_seek_to.h"
+#include "test-string-dynamic_seek_to_back.h"
#include "test-string-dynamic_strip_null.h"
#include "test-string-dynamic_strip_null_range.h"
#include "test-string-dynamic_terminate.h"
#include "test-string-prepend_assure_nulless.h"
#include "test-string-prepend_nulless.h"
#include "test-string-seek_line.h"
+#include "test-string-seek_line_back.h"
#include "test-string-seek_line_to.h"
+#include "test-string-seek_line_to_back.h"
#include "test-string-seek_to.h"
+#include "test-string-seek_to_back.h"
#include "test-string-triples_append.h"
#include "test-string-triples_append_all.h"
#include "test-string-triples_delete_callback.h"
}
#endif // _di_f_utf_string_dynamic_seek_line_
+#ifndef _di_f_utf_string_dynamic_seek_line_back_
+ f_status_t f_utf_string_dynamic_seek_line_back(const f_utf_string_static_t buffer, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (buffer.string[range->stop] != f_utf_char_eol_s) {
+
+ if (macro_f_utf_char_t_width_is(buffer.string[range->stop]) == 1) return F_status_set_error(F_utf_fragment);
+
+ --range->stop;
+
+ if (!range->stop) return (buffer.string[range->stop] == f_utf_char_eol_s) ? F_okay : F_okay_eos;
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_dynamic_seek_line_back_
+
#ifndef _di_f_utf_string_dynamic_seek_line_to_
f_status_t f_utf_string_dynamic_seek_line_to(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_dynamic_seek_line_to_
+#ifndef _di_f_utf_string_dynamic_seek_line_to_back_
+ f_status_t f_utf_string_dynamic_seek_line_to_back(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (buffer.string[range->stop] != seek_to_this) {
+
+ if (macro_f_utf_char_t_width_is(buffer.string[range->stop]) == 1) return F_status_set_error(F_utf_fragment);
+ if (buffer.string[range->stop] == f_utf_char_eol_s) return F_okay_eol;
+
+ --range->stop;
+
+ if (!range->stop) return (buffer.string[range->stop] == f_utf_char_eol_s) ? F_okay : F_okay_eos;
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_dynamic_seek_line_to_back_
+
#ifndef _di_f_utf_string_dynamic_seek_to_
f_status_t f_utf_string_dynamic_seek_to(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_dynamic_seek_to_
+#ifndef _di_f_utf_string_dynamic_seek_to_back_
+ f_status_t f_utf_string_dynamic_seek_to_back(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!buffer.used) return F_data_not;
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (buffer.string[range->stop] != seek_to_this) {
+
+ if (macro_f_utf_char_t_width_is(buffer.string[range->stop]) == 1) return F_status_set_error(F_utf_fragment);
+
+ --range->stop;
+
+ if (!range->stop) return (buffer.string[range->stop] == f_utf_char_eol_s) ? F_okay : F_okay_eos;
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_dynamic_seek_to_back_
+
#ifndef _di_f_utf_string_dynamic_terminate_
f_status_t f_utf_string_dynamic_terminate(f_utf_string_dynamic_t * const destination) {
#ifndef _di_level_0_parameter_checking_
#endif // _di_f_utf_string_dynamic_seek_line_
/**
+ * Seek the buffer location backward until EOL is reached.
+ *
+ * @param buffer
+ * The buffer to traverse.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eos on success, but stopped at end of string.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not on success, but there was no string data to seek.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_utf_string_dynamic_seek_line_back_
+ extern f_status_t f_utf_string_dynamic_seek_line_back(const f_utf_string_static_t buffer, f_range_t * const range);
+#endif // _di_f_utf_string_dynamic_seek_line_back_
+
+/**
* Seek the buffer location forward until the character (1-byte wide) or EOL is reached.
*
* @param buffer
#endif // _di_f_utf_string_dynamic_seek_line_to_
/**
+ * Seek the buffer location backward until the character (1-byte wide) or EOL is reached.
+ *
+ * @param buffer
+ * The buffer to traverse.
+ * @param seek_to_this
+ * A single-width character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eos on success, but stopped at end of string.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not on success, but there was no string data to seek.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_utf_string_dynamic_seek_line_to_back_
+ extern f_status_t f_utf_string_dynamic_seek_line_to_back(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_range_t * const range);
+#endif // _di_f_utf_string_dynamic_seek_line_to_back_
+
+/**
* Seek the buffer location forward until the character (1-byte wide) is reached.
*
* @param buffer
#endif // _di_f_utf_string_dynamic_seek_to_
/**
+ * Seek the buffer location backward until the character (1-byte wide) is reached.
+ *
+ * @param buffer
+ * The buffer to traverse.
+ * @param seek_to_this
+ * A single-width character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eos on success, but stopped at end of string.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not on success, but there was no string data to seek.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_utf_string_dynamic_seek_to_back_
+ extern f_status_t f_utf_string_dynamic_seek_to_back(const f_utf_string_static_t buffer, const f_utf_char_t seek_to_this, f_range_t * const range);
+#endif // _di_f_utf_string_dynamic_seek_to_back_
+
+/**
* Guarantee that an end of string (NULL) exists at the end of the string.
*
* This is intended to be used for anything requiring NULL terminated strings.
}
#endif // _di_f_utf_string_seek_line_
+#ifndef _di_f_utf_string_seek_line_back_
+ f_status_t f_utf_string_seek_line_back(const f_utf_string_t string, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != f_utf_char_eol_s) {
+
+ if (macro_f_utf_char_t_width_is(string[range->stop]) == 1) return F_status_set_error(F_utf_fragment);
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_line_back_
+
#ifndef _di_f_utf_string_seek_line_to_
f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_seek_line_to_
+#ifndef _di_f_utf_string_seek_line_to_back_
+ f_status_t f_utf_string_seek_line_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ if (string[range->stop] == f_utf_char_eol_s) return F_okay_eol;
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_line_to_back_
+
#ifndef _di_f_utf_string_seek_to_
f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_seek_to_
+#ifndef _di_f_utf_string_seek_to_back_
+ f_status_t f_utf_string_seek_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_utf_string_seek_line_
/**
+ * Seek the string location backward until EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ * F_utf_not (with error bit) if unicode is an invalid Unicode character.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_utf_string_seek_line_back_
+ extern f_status_t f_utf_string_seek_line_back(const f_utf_string_t string, f_range_t * const range);
+#endif // _di_f_utf_string_seek_line_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) or EOL is reached.
*
* @param string
#endif // _di_f_utf_string_seek_line_to_
/**
+ * Seek the string location backward until the character (1-byte wide) or EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eol on success, but stopped at EOL.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_utf_string_seek_line_to_back_
+ extern f_status_t f_utf_string_seek_line_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
+#endif // _di_f_utf_string_seek_line_to_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) is reached.
*
* @param string
extern f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
#endif // _di_f_utf_string_seek_to_
+/**
+ * Seek the string location backward until the character (1-byte wide) is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ * F_utf_not (with error bit) if unicode is an invalid Unicode character.
+ */
+#ifndef _di_f_utf_string_seek_to_back_
+ extern f_status_t f_utf_string_seek_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
+#endif // _di_f_utf_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // _di_f_utf_string_seek_line_
+#ifndef _di_f_utf_string_seek_line_back
+ f_status_t f_utf_string_seek_line_back(const f_utf_string_t string, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != f_utf_char_t_eol_s) {
+
+ if (macro_f_utf_char_t_width_is(string[range->stop]) == 1) return F_status_set_error(F_utf_fragment);
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_line_back_
+
#ifndef _di_f_utf_string_seek_line_to_
f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_seek_line_to_
+#ifndef _di_f_utf_string_seek_line_to_back_
+ f_status_t f_utf_string_seek_line_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ if (string[range->stop] == f_utf_char_t_eol_s) return F_okay_eol;
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_line_to_back_
+
#ifndef _di_f_utf_string_seek_to_
f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_seek_to_
+#ifndef _di_f_utf_string_seek_to_back_
+ f_status_t f_utf_string_seek_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_utf_string_seek_line_
/**
+ * Seek the string location backward until EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ * F_utf_not (with error bit) if unicode is an invalid Unicode character.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_utf_string_seek_line_back_
+ extern f_status_t f_utf_string_seek_line_back(const f_utf_string_t string, f_range_t * const range);
+#endif // _di_f_utf_string_seek_line_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) or EOL is reached.
*
* @param string
#endif // _di_f_utf_string_seek_line_to_
/**
+ * Seek the string location backward until the character (1-byte wide) or EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eol on success, but stopped at EOL.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_utf_string_seek_line_to_back_
+ extern f_status_t f_utf_string_seek_line_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
+#endif // _di_f_utf_string_seek_line_to_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) is reached.
*
* @param string
extern f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
#endif // _di_f_utf_string_seek_to_
+/**
+ * Seek the string location backward until the character (1-byte wide) is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ * F_utf_not (with error bit) if unicode is an invalid Unicode character.
+ */
+#ifndef _di_f_utf_string_seek_to_back_
+ extern f_status_t f_utf_string_seek_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
+#endif // _di_f_utf_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
}
#endif // _di_f_utf_string_seek_line_
+#ifndef _di_f_utf_string_seek_line_back_
+ f_status_t f_utf_string_seek_line_back(const f_utf_string_t string, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != f_utf_char_t_eol_s) {
+
+ if (macro_f_utf_char_t_width_is(string[range->stop]) == 1) return F_status_set_error(F_utf_fragment);
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_line_back_
+
#ifndef _di_f_utf_string_seek_line_to_
f_status_t f_utf_string_seek_line_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_seek_line_to_
+#ifndef _di_f_utf_string_seek_line_to_back_
+ f_status_t f_utf_string_seek_line_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ if (string[range->stop] == f_utf_char_t_eol_s) return F_okay_eol;
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_line_to_back_
+
#ifndef _di_f_utf_string_seek_to_
f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
#ifndef _di_level_0_parameter_checking_
}
#endif // _di_f_utf_string_seek_to_
+#ifndef _di_f_utf_string_seek_to_back_
+ f_status_t f_utf_string_seek_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!range) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (range->start > range->stop) return F_data_not_stop;
+
+ while (string[range->stop] != seek_to) {
+
+ --range->stop;
+
+ if (range->start > range->stop) return F_okay_stop;
+ } // while
+
+ return F_okay;
+ }
+#endif // _di_f_utf_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _di_f_utf_string_seek_line_
/**
+ * Seek the string location backward until EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at end of range.
+ * F_data_not_stop on success, but the range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ * F_utf_not (with error bit) if unicode is an invalid Unicode character.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_utf_string_seek_line_back_
+ extern f_status_t f_utf_string_seek_line_back(const f_utf_string_t string, f_range_t * const range);
+#endif // _di_f_utf_string_seek_line_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) or EOL is reached.
*
* @param string
#endif // _di_f_utf_string_seek_line_to_
/**
+ * Seek the string location backward until the character (1-byte wide) or EOL is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_eol on success, but stopped at EOL.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ */
+#ifndef _di_f_utf_string_seek_line_to_back_
+ extern f_status_t f_utf_string_seek_line_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
+#endif // _di_f_utf_string_seek_line_to_back_
+
+/**
* Seek the string location forward until the character (1-byte wide) is reached.
*
* @param string
extern f_status_t f_utf_string_seek_to(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
#endif // _di_f_utf_string_seek_to_
+/**
+ * Seek the string location backward until the character (1-byte wide) is reached.
+ *
+ * @param string
+ * The string to traverse.
+ * @param seek_to
+ * A character representing a character to seek to.
+ * @param range
+ * A range within the buffer representing the start and stop locations.
+ * The stop location will be decremented by the seek.
+ *
+ * @return
+ * F_okay on success.
+ * F_okay_stop on success, but stopped at the stop location.
+ * F_data_not_stop if range.start > range.stop.
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_utf_fragment (with error bit) if character is a UTF-8 fragment.
+ * F_utf_not (with error bit) if unicode is an invalid Unicode character.
+ */
+#ifndef _di_f_utf_string_seek_to_back_
+ extern f_status_t f_utf_string_seek_to_back(const f_utf_string_t string, const f_utf_char_t seek_to, f_range_t * const range);
+#endif // _di_f_utf_string_seek_to_back_
+
#ifdef __cplusplus
} // extern "C"
#endif
build_sources_program test-utf-dynamic_partial_mish.c test-utf-dynamic_partial_mish_nulless.c
build_sources_program test-utf-dynamic_partial_prepend.c test-utf-dynamic_partial_prepend_assure.c test-utf-dynamic_partial_prepend_assure_nulless.c test-utf-dynamic_partial_prepend_nulless.c
build_sources_program test-utf-dynamic_prepend.c test-utf-dynamic_prepend_assure.c test-utf-dynamic_prepend_assure_nulless.c test-utf-dynamic_prepend_nulless.c
-build_sources_program test-utf-dynamic_seek_line.c test-utf-dynamic_seek_line_to.c test-utf-dynamic_seek_to.c
+build_sources_program test-utf-dynamic_seek_line.c test-utf-dynamic_seek_line_back.c test-utf-dynamic_seek_line_to.c test-utf-dynamic_seek_line_to_back.c test-utf-dynamic_seek_to.c test-utf-dynamic_seek_to_back.c
build_sources_program test-utf-dynamic_terminate.c test-utf-dynamic_terminate_after.c
build_sources_program test-utf-dynamics_append.c test-utf-dynamics_append_all.c test-utf-dynamicss_append.c test-utf-dynamicss_append_all.c
build_sources_program test-utf-dynamicss_delete_callback.c test-utf-dynamicss_destroy_callback.c
build_sources_program test-utf-mash.c test-utf-mash_nulless.c
build_sources_program test-utf-mish.c test-utf-mish_nulless.c
build_sources_program test-utf-prepend.c test-utf-prepend_assure.c test-utf-prepend_assure_nulless.c test-utf-prepend_nulless.c
-build_sources_program test-utf-seek_line.c test-utf-seek_line_to.c test-utf-seek_to.c
+build_sources_program test-utf-seek_line.c test-utf-seek_line_back.c test-utf-seek_line_to.c test-utf-seek_line_to_back.c test-utf-seek_to.c test-utf-seek_to_back.c
build_sources_program test-utf-triples_append.c test-utf-triples_append_all.c test-utf-tripless_append.c test-utf-tripless_append_all.c
build_sources_program test-utf-triples_delete_callback.c test-utf-triples_destroy_callback.c
build_sources_program test-utf-tripless_delete_callback.c test-utf-tripless_destroy_callback.c
--- /dev/null
+#include "test-utf.h"
+#include "test-utf-dynamic_seek_line_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_string_dynamic_seek_line_back__parameter_checking(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ const f_status_t status = f_utf_string_dynamic_seek_line_back(source, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_back__returns_data_not_stop(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_back__returns_none_eos(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_okay_eos);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 0);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_back__returns_none_stop(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_back__works(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_back(source, &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 4);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the utf project.
+ */
+#ifndef _TEST__F_utf_dynamic_seek_line_back_h
+#define _TEST__F_utf_dynamic_seek_line_back_h
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_utf_string_dynamic_seek_line_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_utf_string_dynamic_seek_line_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_eos stopped after end of string because no newline is found.
+ *
+ * @see f_utf_string_dynamic_seek_line_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_back__returns_none_eos(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_utf_string_dynamic_seek_line_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_string_dynamic_seek_line_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_back__works(void **state);
+
+#endif // _TEST__F_utf_dynamic_seek_line_back_h
--- /dev/null
+#include "test-utf.h"
+#include "test-utf-dynamic_seek_line_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_string_dynamic_seek_line_to_back__after_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eol);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_to_back__before_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_to_back__parameter_checking(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ const f_status_t status = f_utf_string_dynamic_seek_line_to_back(source, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_to_back__returns_data_not_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_to_back__returns_none_eos(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eos);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 0);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_line_to_back__returns_none_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_line_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the utf project.
+ */
+#ifndef _TEST__F_utf_dynamic_seek_line_to_back_h
+#define _TEST__F_utf_dynamic_seek_line_to_back_h
+
+/**
+ * Test that the function works where seek target is after a newline.
+ *
+ * @see f_utf_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_to_back__after_newline(void **state);
+
+/**
+ * Test that the function works where seek target is before a newline.
+ *
+ * @see f_utf_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_to_back__before_newline(void **state);
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_utf_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_utf_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_eos stopped after end of string because no newline is found.
+ *
+ * @see f_utf_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_to_back__returns_none_eos(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_utf_string_dynamic_seek_line_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_line_to_back__returns_none_stop(void **state);
+
+#endif // _TEST__F_utf_dynamic_seek_line_to_back_h
--- /dev/null
+#include "test-utf.h"
+#include "test-utf-dynamic_seek_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_string_dynamic_seek_to_back__after_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 2);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_to_back__before_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_to_back__parameter_checking(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_utf_string_dynamic_seek_to_back__returns_data_not_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_to_back__returns_none_eos(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eos);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 0);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_to_back__returns_none_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_utf_string_dynamic_seek_to_back__works(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+
+ // Test where newline is before "X".
+ {
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6);
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+
+ // Test where newline is after "X".
+ {
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_dynamic_seek_to_back(source, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 2);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the utf project.
+ */
+#ifndef _TEST__F_utf_dynamic_seek_to_back_h
+#define _TEST__F_utf_dynamic_seek_to_back_h
+
+/**
+ * Test that the function works where seek target is after a newline.
+ *
+ * @see f_utf_string_dynamic_seek_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_to_back__after_newline(void **state);
+
+/**
+ * Test that the function works where seek target is before a newline.
+ *
+ * @see f_utf_string_dynamic_seek_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_to_back__before_newline(void **state);
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_utf_string_dynamic_seek_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_utf_string_dynamic_seek_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_eos stopped after end of string because no newline is found.
+ *
+ * @see f_utf_string_dynamic_seek_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_to_back__returns_none_eos(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_utf_string_dynamic_seek_to_back()
+ */
+extern void test__f_utf_string_dynamic_seek_to_back__returns_none_stop(void **state);
+
+#endif // _TEST__F_utf_dynamic_seek_to_back_h
--- /dev/null
+#include "test-utf.h"
+#include "test-utf-seek_line_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_seek_line_back__parameter_checking(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ const f_status_t status = f_utf_string_seek_line_back(source.string, 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_utf_seek_line_back__returns_data_not_stop(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_utf_string_seek_line_back(source.string, &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_utf_seek_line_back__returns_none_stop(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_line_back(source.string, &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+void test__f_utf_seek_line_back__works(void **state) {
+
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_line_back(source.string, &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 4);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the utf project.
+ */
+#ifndef _TEST__F_utf_seek_line_back_h
+#define _TEST__F_utf_seek_line_back_h
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_utf_string_seek_line_back()
+ */
+extern void test__f_utf_seek_line_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_utf_string_seek_line_back()
+ */
+extern void test__f_utf_seek_line_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_utf_string_seek_line_back()
+ */
+extern void test__f_utf_seek_line_back__returns_none_stop(void **state);
+
+/**
+ * Test that the function works.
+ *
+ * @see f_utf_string_seek_line_back()
+ */
+extern void test__f_utf_seek_line_back__works(void **state);
+
+#endif // _TEST__F_utf_seek_line_back_h
--- /dev/null
+#include "test-utf.h"
+#include "test-utf-seek_line_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_seek_line_to_back__after_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_eol);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_utf_seek_line_to_back__before_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_utf_seek_line_to_back__parameter_checking(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ const f_status_t status = f_utf_string_seek_line_to_back(source.string, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_utf_seek_line_to_back__returns_data_not_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_utf_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_utf_seek_line_to_back__returns_none_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t", 0, 4);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_line_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the utf project.
+ */
+#ifndef _TEST__F_utf_seek_line_to_back_h
+#define _TEST__F_utf_seek_line_to_back_h
+
+/**
+ * Test that the function works where seek target is after a newline.
+ *
+ * @see f_utf_string_seek_line_to_back()
+ */
+extern void test__f_utf_seek_line_to_back__after_newline(void **state);
+
+/**
+ * Test that the function works where seek target is before a newline.
+ *
+ * @see f_utf_string_seek_line_to_back()
+ */
+extern void test__f_utf_seek_line_to_back__before_newline(void **state);
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_utf_string_seek_line_to_back()
+ */
+extern void test__f_utf_seek_line_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_utf_string_seek_line_to_back()
+ */
+extern void test__f_utf_seek_line_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_utf_string_seek_line_to_back()
+ */
+extern void test__f_utf_seek_line_to_back__returns_none_stop(void **state);
+
+#endif // _TEST__F_utf_seek_line_to_back_h
--- /dev/null
+#include "test-utf.h"
+#include "test-utf-seek_to_back.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void test__f_utf_seek_to_back__after_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 2);
+ }
+}
+
+void test__f_utf_seek_to_back__before_newline(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0\n\0\0\0X\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(0, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay);
+
+ assert_int_equal(range.start, 0);
+ assert_int_equal(range.stop, 3);
+ }
+}
+
+void test__f_utf_seek_to_back__parameter_checking(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0X\0\0\0\n\0\0\0s\0\0\0t", 0, 6);
+
+ {
+ const f_status_t status = f_utf_string_seek_to_back(source.string, to.string[0], 0);
+
+ assert_int_equal(status, F_status_set_error(F_parameter));
+ }
+}
+
+void test__f_utf_seek_to_back__returns_data_not_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = f_range_t_initialize;
+
+ const f_status_t status = f_utf_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_data_not_stop);
+ }
+}
+
+void test__f_utf_seek_to_back__returns_none_stop(void **state) {
+
+ const f_utf_string_static_t to = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0X", 0, 1);
+ const f_utf_string_static_t source = macro_f_utf_string_static_t_initialize_1((f_utf_string_t) "\0\0\0t\0\0\0e\0\0\0s\0\0\0t\0\0\0\n\0\0\0a\0\0\0f\0\0\0t\0\0\0e\0\0\0r", 0, 10);
+
+ {
+ f_range_t range = macro_f_range_t_initialize_1(2, source.used - 1);
+
+ const f_status_t status = f_utf_string_seek_to_back(source.string, to.string[0], &range);
+
+ assert_int_equal(status, F_okay_stop);
+
+ assert_int_equal(range.start, 2);
+ assert_int_equal(range.stop, 1);
+ }
+}
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 0
+ *
+ * Project: UTF
+ * API Version: 0.7
+ * Licenses: lgpl-2.1-or-later
+ *
+ * Test the functions in the utf project.
+ */
+#ifndef _TEST__F_utf_seek_to_back_h
+#define _TEST__F_utf_seek_to_back_h
+
+/**
+ * Test that the function works where seek target is after a newline.
+ *
+ * @see f_utf_string_seek_to_back()
+ */
+extern void test__f_utf_seek_to_back__after_newline(void **state);
+
+/**
+ * Test that the function works where seek target is before a newline.
+ *
+ * @see f_utf_string_seek_to_back()
+ */
+extern void test__f_utf_seek_to_back__before_newline(void **state);
+
+/**
+ * Test that the function correctly fails on invalid parameter.
+ *
+ * @see f_utf_string_seek_to_back()
+ */
+extern void test__f_utf_seek_to_back__parameter_checking(void **state);
+
+/**
+ * Test that the function returns F_data_not_stop because range is an empty range (range.start > range.stop).
+ *
+ * @see f_utf_string_seek_to_back()
+ */
+extern void test__f_utf_seek_to_back__returns_data_not_stop(void **state);
+
+/**
+ * Test that the function returns F_okay_stop stopped after end of range because no newline is found.
+ *
+ * @see f_utf_string_seek_to_back()
+ */
+extern void test__f_utf_seek_to_back__returns_none_stop(void **state);
+
+#endif // _TEST__F_utf_seek_to_back_h
cmocka_unit_test(test__f_utf_string_dynamic_seek_line__returns_none_stop),
cmocka_unit_test(test__f_utf_string_dynamic_seek_line__works),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_back__returns_none_eos),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_back__returns_none_stop),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_back__works),
+
cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to__after_newline),
cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to__before_newline),
cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to__returns_data_not_stop),
cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to__returns_none_eos),
cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to__returns_none_stop),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to_back__after_newline),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to_back__before_newline),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to_back__returns_none_eos),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_line_to_back__returns_none_stop),
+
cmocka_unit_test(test__f_utf_string_dynamic_seek_to__after_newline),
cmocka_unit_test(test__f_utf_string_dynamic_seek_to__before_newline),
cmocka_unit_test(test__f_utf_string_dynamic_seek_to__returns_data_not_stop),
cmocka_unit_test(test__f_utf_string_dynamic_seek_to__returns_none_eos),
cmocka_unit_test(test__f_utf_string_dynamic_seek_to__returns_none_stop),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_to_back__after_newline),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_to_back__before_newline),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_to_back__returns_none_eos),
+ cmocka_unit_test(test__f_utf_string_dynamic_seek_to_back__returns_none_stop),
+
cmocka_unit_test(test__f_utf_string_dynamic_terminate__appends_null),
cmocka_unit_test(test__f_utf_string_dynamic_terminate__doesnt_append_null),
cmocka_unit_test(test__f_utf_seek_line__returns_none_stop),
cmocka_unit_test(test__f_utf_seek_line__works),
+ cmocka_unit_test(test__f_utf_seek_line_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_utf_seek_line_back__returns_none_stop),
+ cmocka_unit_test(test__f_utf_seek_line_back__works),
+
cmocka_unit_test(test__f_utf_seek_line_to__after_newline),
cmocka_unit_test(test__f_utf_seek_line_to__before_newline),
cmocka_unit_test(test__f_utf_seek_line_to__returns_data_not_stop),
cmocka_unit_test(test__f_utf_seek_line_to__returns_none_stop),
+ cmocka_unit_test(test__f_utf_seek_line_to_back__after_newline),
+ cmocka_unit_test(test__f_utf_seek_line_to_back__before_newline),
+ cmocka_unit_test(test__f_utf_seek_line_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_utf_seek_line_to_back__returns_none_stop),
+
cmocka_unit_test(test__f_utf_seek_to__after_newline),
cmocka_unit_test(test__f_utf_seek_to__before_newline),
cmocka_unit_test(test__f_utf_seek_to__returns_data_not_stop),
cmocka_unit_test(test__f_utf_seek_to__returns_none_stop),
+ cmocka_unit_test(test__f_utf_seek_to_back__after_newline),
+ cmocka_unit_test(test__f_utf_seek_to_back__before_newline),
+ cmocka_unit_test(test__f_utf_seek_to_back__returns_data_not_stop),
+ cmocka_unit_test(test__f_utf_seek_to_back__returns_none_stop),
+
cmocka_unit_test(test__f_utf_string_dynamicss_delete_callback__fails),
cmocka_unit_test(test__f_utf_string_dynamicss_destroy_callback__fails),
#include "test-utf-dynamic_prepend_assure_nulless.h"
#include "test-utf-dynamic_prepend_nulless.h"
#include "test-utf-dynamic_seek_line.h"
+#include "test-utf-dynamic_seek_line_back.h"
#include "test-utf-dynamic_seek_line_to.h"
+#include "test-utf-dynamic_seek_line_to_back.h"
#include "test-utf-dynamic_seek_to.h"
+#include "test-utf-dynamic_seek_to_back.h"
#include "test-utf-dynamic_terminate.h"
#include "test-utf-dynamic_terminate_after.h"
#include "test-utf-dynamics_append.h"
#include "test-utf-prepend_assure_nulless.h"
#include "test-utf-prepend_nulless.h"
#include "test-utf-seek_line.h"
+#include "test-utf-seek_line_back.h"
#include "test-utf-seek_line_to.h"
+#include "test-utf-seek_line_to_back.h"
#include "test-utf-seek_to.h"
+#include "test-utf-seek_to_back.h"
#include "test-utf-triples_append.h"
#include "test-utf-triples_append_all.h"
#include "test-utf-triples_delete_callback.h"