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

Method Bug2190219

test/testpreprocessor.cpp:416–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414 }
415
416 void Bug2190219() {
417 const char filedata[] = "#ifdef __cplusplus\n"
418 "cpp\n"
419 "#else\n"
420 "c\n"
421 "#endif";
422
423 {
424 // Preprocess => actual result..
425 const std::map<std::string, std::string> actual = getcode(settings0, *this, filedata, "file.cpp");
426
427 // Compare results..
428 ASSERT_EQUALS(1U, actual.size());
429 ASSERT_EQUALS("\ncpp", actual.at(""));
430 }
431
432 {
433 // Ticket #7102 - skip __cplusplus in C code
434 // Preprocess => actual result..
435 const std::map<std::string, std::string> actual = getcode(settings0, *this, filedata, "file.c");
436
437 // Compare results..
438 ASSERT_EQUALS(1U, actual.size());
439 ASSERT_EQUALS("\n\n\nc", actual.at(""));
440 }
441 }
442
443 void error1() {
444 const char filedata[] = "#ifdef A\n"

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected