MCPcopy Create free account
hub / github.com/boostorg/json / testPlusEquals

Method testPlusEquals

test/string.cpp:2038–2112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2036 }
2037
2038 void
2039 testPlusEquals()
2040 {
2041 test_vectors const t;
2042
2043 // operator+=(string)
2044 {
2045 fail_loop([&](storage_ptr const& sp)
2046 {
2047 string s(t.v1, sp);
2048 s += string(t.v2);
2049 BOOST_TEST(s == t.s1 + t.s2);
2050 });
2051
2052 fail_loop([&](storage_ptr const& sp)
2053 {
2054 string s(t.v2, sp);
2055 s += string(t.v1);
2056 BOOST_TEST(s == t.s2 + t.s1);
2057 });
2058 }
2059
2060 // operator+=(char)
2061 {
2062 fail_loop([&](storage_ptr const& sp)
2063 {
2064 string s(sp);
2065 for(auto ch : t.v1)
2066 s += ch;
2067 BOOST_TEST(s == t.v1);
2068 });
2069
2070 fail_loop([&](storage_ptr const& sp)
2071 {
2072 string s(sp);
2073 for(auto ch : t.v2)
2074 s += ch;
2075 BOOST_TEST(s == t.v2);
2076 });
2077 }
2078
2079 // operator+=(char const*)
2080 {
2081 fail_loop([&](storage_ptr const& sp)
2082 {
2083 string s(t.v1, sp);
2084 s += t.s2.c_str();
2085 BOOST_TEST(s == t.s1 + t.s2);
2086 });
2087
2088 fail_loop([&](storage_ptr const& sp)
2089 {
2090 string s(t.v2, sp);
2091 s += t.s1.c_str();
2092 BOOST_TEST(s == t.s2 + t.s1);
2093 });
2094 }
2095

Callers

nothing calls this directly

Calls 3

fail_loopFunction · 0.85
c_strMethod · 0.80
stringClass · 0.50

Tested by

no test coverage detected