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

Method conditionalDefine

test/testpreprocessor.cpp:1649–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1647 }
1648
1649 void conditionalDefine() {
1650 const char filedata[] = "#ifdef A\n"
1651 "#define N 10\n"
1652 "#else\n"
1653 "#define N 20\n"
1654 "#endif\n"
1655 "N";
1656
1657 // Preprocess => actual result..
1658 const std::map<std::string, std::string> actual = getcode(settings0, *this, filedata);
1659
1660 // Compare results..
1661 ASSERT_EQUALS(2, actual.size());
1662 ASSERT_EQUALS("\n\n\n\n\n$20", actual.at(""));
1663 ASSERT_EQUALS("\n\n\n\n\n$10", actual.at("A=A"));
1664 ASSERT_EQUALS("", errout_str());
1665 }
1666
1667 void macro_parameters() {
1668 const char filedata[] = "#define BC(a, b, c, arg...) \\\n"

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected