MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / findAndReplace

Method findAndReplace

test/testutils.cpp:470–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468 }
469
470 void findAndReplace() const {
471 {
472 std::string s{"test"};
473 ::findAndReplace(s, "test", "tset");
474 ASSERT_EQUALS("tset", s);
475 }
476 {
477 std::string s{"testtest"};
478 ::findAndReplace(s, "test", "tset");
479 ASSERT_EQUALS("tsettset", s);
480 }
481 {
482 std::string s{"1test1test1"};
483 ::findAndReplace(s, "test", "tset");
484 ASSERT_EQUALS("1tset1tset1", s);
485 }
486 {
487 std::string s{"1test1test1"};
488 ::findAndReplace(s, "test", "");
489 ASSERT_EQUALS("111", s);
490 }
491 {
492 std::string s{"111"};
493 ::findAndReplace(s, "test", "tset");
494 ASSERT_EQUALS("111", s);
495 }
496 {
497 std::string s;
498 ::findAndReplace(s, "test", "tset");
499 ASSERT_EQUALS("", s);
500 }
501 }
502
503 void replaceEscapeSequences() const {
504 ASSERT_EQUALS("\x30", ::replaceEscapeSequences("\\x30"));

Callers

nothing calls this directly

Calls 1

findAndReplaceFunction · 0.85

Tested by

no test coverage detected