In the meantime, a single test with a NUL character in the
input and the search string was passed.
I should add that the search string's length must be
greater than 0. (This is a part of the interface
specification.)
And here is a collection of test cases, including the
length of each string, in the order: input, replace_from,
replace_to, and expected_output:
test( "aaa", 3, "a", 1, "b", 1, "bbb", 3 );
test( "abcabcabc", 9, "abcabc", 6, "x", 1, "xabc", 4 );
test( "alpha", 5, "alpha", 5, "epsilon", 7, "epsilon", 7 );
test( "ababac", 6, "abac", 4, "ABAC", 4, "abABAC", 6 );
test( "alphabebetagamma", 16, "bebe", 4, "epsilon", 7, "alphaepsilontagamma", 19 );
test( "alphabebetagamma", 16, "beta", 4, "epsilon", 7, "alphabeepsilongamma", 19 );
test( "alphabebebetagamma", 18, "beta", 4, "epsilon", 7, "alphabebeepsilongamma", 20 );
test( "abcdefghi", 9, "def", 3, "DEF", 3, "abcDEFghi", 9 );
test( "__01234__", 9, "01234", 5, "!", 1, "__!__", 5 );
test( "__012301234__", 13, "01234", 5, "!", 1, "__0123!__", 9 );
test( "__0123012301234__", 17, "01234", 5, "!", 1, "__01230123!__", 13 );
test( "__0123401234__", 14, "01234", 5, "!", 1, "__!!__", 6 );
test( "0123401234__", 12, "01234", 5, "!", 1, "!!__", 4 );
test( "__0123401234", 12, "01234", 5, "!", 1, "__!!", 4 );
test( "alpha", 5, "alpha", 5, "", 0, "", 0 );
test( "aalpha", 6, "alpha", 5, "", 0, "a", 1 );
test( "aaalpha", 7, "alpha", 5, "", 0, "aa", 2 );
test( "alphaX", 6, "alpha", 5, "", 0, "X", 1 );
test( "aalphaX", 7, "alpha", 5, "", 0, "aX", 2 );
test( "aaalphaX", 8, "alpha", 5, "", 0, "aaX", 3 );
test( "", 0, "alpha", 5, "", 0, "", 0 );
test( "alpha", 5, "a", 1, "x", 1, "xlphx", 5 );
test( "abcd\0fghi", 9, "d\0f", 3, "DEF", 3, "abcDEFghi", 9 );
The last test case includes a NUL character.