1 #define BOOST_TEST_MODULE (replace_all_test) 2 #include "boost/test/unit_test.hpp" 19 BOOST_TEST(start == ref);
23 BOOST_AUTO_TEST_SUITE(replace_all_test)
27 testit(
"Once upon a time",
"a",
"some",
"Once upon some time");
28 testit(
"Once upon a time",
" ",
"_",
"Once_upon_a_time");
29 testit(
"Once upon a time",
"time",
"song",
"Once upon a song");
34 testit(
"Once upon a time",
"z",
"y",
"Once upon a time");
39 testit(
"Once upon a time",
"O",
"o",
"once upon a time");
40 testit(
"Once upon a timE",
"E",
"e",
"Once upon a time");
41 testit(
"Once upuponon a time",
"upon",
"",
"Once upon a time");
46 testit(
"Once uponuponupon a time",
"upon",
"-",
"Once --- a time");
47 testit(
"Once --- a time",
"-",
"z",
"Once zzz a time");
48 testit(
"Once --- a time",
"-",
"upon",
"Once uponuponupon a time");
49 testit(
"Once -------- a time",
"---",
"upon",
"Once uponupon-- a time");
54 testit(
"Once upon a time",
"upon",
"uponst",
"Once uponst a time");
55 testit(
"Once upon a time",
"upon",
"stupon",
"Once stupon a time");
58 BOOST_AUTO_TEST_SUITE_END()
static void replace_all(std::string &str, const std::string &old, const std::string &repl)
bool replace_all(std::string &in, std::string const &from, std::string const &to)
Replace all occurrences of from in string with to.
BOOST_AUTO_TEST_CASE(replace_simple)