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

Method copy

test/testregex.cpp:94–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 void copy() const {
95 const auto r = assertRegex("begin.*end");
96
97 int called = 0;
98 int s = -1;
99 int e = -1;
100 auto f = [&](int start, int end) {
101 ++called;
102 s = start;
103 e = end;
104 };
105
106 {
107 // NOLINTNEXTLINE(performance-unnecessary-copy-initialization)
108 auto r2 = r;
109 ASSERT_EQUALS("", r2->match("begin-123-end", f));
110 ASSERT_EQUALS(1, called);
111 ASSERT_EQUALS(0, s);
112 ASSERT_EQUALS(13, e);
113 }
114
115 called = 0;
116 s = -1;
117 e = -1;
118 ASSERT_EQUALS("", r->match("begin-123-end", f));
119 ASSERT_EQUALS(1, called);
120 ASSERT_EQUALS(0, s);
121 ASSERT_EQUALS(13, e);
122 }
123
124 void multimatch() const {
125 const auto r = assertRegex("info:.*");

Callers 7

get_librariesMethod · 0.45
creduce.pyFile · 0.45
build_cppcheckFunction · 0.45
test_slow_expridFunction · 0.45
test_stack_overflow_ASTFunction · 0.45
test_lookup_pathFunction · 0.45

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected