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

Method define_if6

test/testpreprocessor.cpp:1787–1805  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1785 }
1786
1787 void define_if6() { // #4516 - #define B (A?1:-1)
1788 const char filedata[] = "#ifdef A\n"
1789 "#define B (A?1:-1)\n"
1790 "#endif\n"
1791 "\n"
1792 "#if B < 0\n"
1793 "123\n"
1794 "#endif\n"
1795 "\n"
1796 "#if B >= 0\n"
1797 "456\n"
1798 "#endif\n";
1799 const std::string actualA0 = getcodeforcfg(settings0, *this, filedata, "A=0", "test.c");
1800 ASSERT_EQUALS(true, actualA0.find("123") != std::string::npos);
1801 ASSERT_EQUALS(false, actualA0.find("456") != std::string::npos);
1802 const std::string actualA1 = getcodeforcfg(settings0, *this, filedata, "A=1", "test.c");
1803 ASSERT_EQUALS(false, actualA1.find("123") != std::string::npos);
1804 ASSERT_EQUALS(true, actualA1.find("456") != std::string::npos);
1805 }
1806
1807 void define_ifdef() {
1808 {

Callers

nothing calls this directly

Calls 1

findMethod · 0.45

Tested by

no test coverage detected