macro_f_string_static_t_initialize("$", 0, 1),
macro_f_string_static_t_initialize(".", 0, 1),
macro_f_string_static_t_initialize(" ́", 0, 3), // Space followed by a combining character (U+0020 U+0301).
+ macro_f_string_static_t_initialize(" ॐ", 0, 5), // Space followed by a printing character (U+0020 U+0061).
macro_f_string_static_t_initialize("", 0, 3), // Zero-width space (U+200B).
+ macro_f_string_static_t_initialize("a b", 0, 3),
};
f_status_t expects[] = {
F_false,
F_false,
F_false,
+ F_true,
F_false,
F_true,
+ F_false,
};
- // Apply an offset so that the combining character is combining into something inside the quotes rather than the quotes for convenience and code safety.
- f_array_length_t offset[] = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 1,
- 0,
+ // Use range to designate which part of a string is to be tested.
+ f_string_range_t ranges[] = {
+ { .start = 0, .stop = tests[0].used },
+ { .start = 0, .stop = tests[1].used },
+ { .start = 0, .stop = tests[2].used },
+ { .start = 0, .stop = tests[3].used },
+ { .start = 0, .stop = tests[4].used },
+ { .start = 0, .stop = tests[5].used },
+ { .start = 0, .stop = tests[6].used },
+ { .start = 0, .stop = tests[7].used },
+ { .start = 0, .stop = tests[8].used },
+ { .start = 0, .stop = tests[9].used },
+ { .start = 1, .stop = tests[10].used },
+ { .start = 1, .stop = tests[11].used },
+ { .start = 0, .stop = tests[12].used },
+ { .start = 1, .stop = 1 },
};
- for (f_array_length_t i = 0; i < 12; ++i) {
-
- const f_string_range_t range = macro_f_string_range_t_initialize(offset[i], tests[i].used - 1);
+ for (f_array_length_t i = 0; i < 14; ++i) {
- const f_status_t status = f_fss_is_zero_width(state_data, tests[i], range);
+ const f_status_t status = f_fss_is_zero_width(state_data, tests[i], ranges[i]);
assert_int_equal(status, expects[i]);
} // for