MCPcopy Create free account
hub / github.com/boost-ext/te / self_assignment

Function self_assignment

test/te.cpp:344–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342
343template<typename Stringy>
344void self_assignment()
345{
346 std::string str{"hello world"};
347 Stringy str1{str};
348
349 expect(std::strcmp(str1.c_str(), str.c_str()) == 0); //this line is not really necessary, but why not, may as well test.
350 Stringy& str2 = str1;
351 str1 = str2; //self copy assignment
352 expect(std::strcmp(str1.c_str(), str.c_str()) == 0); //we're testing that nothing has been deleted or messed up
353 str2 = std::move(str1); //self move assignment
354 expect(std::strcmp(str2.c_str(), str.c_str()) == 0); //we're testing that nothing has been deleted or messed up
355}
356
357test test_self_assignment = [] {
358 self_assignment<te::poly<IStringy, te::non_owning_storage>>();

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected