summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLib/testStringAlgorithms.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx
index f73e62a..cb5f886 100644
--- a/Tests/CMakeLib/testStringAlgorithms.cxx
+++ b/Tests/CMakeLib/testStringAlgorithms.cxx
@@ -149,13 +149,23 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ [])
{
std::string val;
std::string expect;
- val.reserve(120 * cmStrLen("cmStrCat move"));
+ val.reserve(50 * cmStrLen("cmStrCat move ") + 1);
auto data = val.data();
+ auto capacity = val.capacity();
+ bool moved = true;
for (int i = 0; i < 100; i++) {
- val = cmStrCat(std::move(val), "cmStrCat move");
- expect += "cmStrCat move";
+ if (i % 2 == 0) {
+ val = cmStrCat(std::move(val), "move ");
+ expect += "move ";
+ } else {
+ val = cmStrCat("cmStrCat ", std::move(val));
+ expect = "cmStrCat " + std::move(expect);
+ }
+ if (val.data() != data || val.capacity() != capacity) {
+ moved = false;
+ }
}
- assert_ok((val.data() == data), "cmStrCat move");
+ assert_ok(moved, "cmStrCat move");
assert_string(val, expect, "cmStrCat move");
}