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

Method ifdefwithfile

test/testpreprocessor.cpp:610–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608
609
610 void ifdefwithfile() {
611 // Handling include guards..
612 const char filedata[] = "#ifdef ABC\n"
613 "#file \"abc.h\"\n"
614 "class A{};/*\n\n\n\n\n\n\n*/\n"
615 "#endfile\n"
616 "#endif\n"
617 "int main() {}\n";
618
619 // Preprocess => actual result..
620 const std::map<std::string, std::string> actual = getcode(settings0, *this, filedata);
621
622 // Expected configurations: "" and "ABC"
623 ASSERT_EQUALS(2, actual.size());
624 ASSERT_EQUALS("\n\n\nint main ( ) { }", actual.at(""));
625 ASSERT_EQUALS("\n#line 1 \"abc.h\"\nclass A { } ;\n#line 4 \"file.c\"\n int main ( ) { }", actual.at("ABC=ABC"));
626 }
627
628 void if0() {
629 const char filedata[] = " # if /* comment */ 0 // comment\n"

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected