Menu

knownConditionTrueFalse is being flagged in tests where we want the test to confirm the values

2024-05-13
2024-05-22
  • Steve Albright

    Steve Albright - 2024-05-13

    We have a bunch of tests like this using the REQUIRE or google test keywords and I have to add suppresssion (no, I don't want to take the code out, I want the test run)

                        REQUIRE(MessageTwo == TestMessage); // cppcheck-suppress knownConditionTrueFalse - let the test confirm
                        REQUIRE(TestMessage == MessageTwo); // cppcheck-suppress knownConditionTrueFalse - let the test confirm
    

    EXPECT_TRUE(mes == mesNull);

     

    Last edit: Steve Albright 2024-05-13
  • Daniel Marjamäki

    Thanks! I created ticket https://trac.cppcheck.net/ticket/12756

    could you please create a minimal example code that cause the false positive? So we can add that as a regression test.

     
    • Steve Albright

      Steve Albright - 2024-05-22

      Part of the problem may have been that we didn't have googletest listed as a library so I'll have to check and see if that fixed it.

      Update: the config change fixed it in the case I found.

       

      Last edit: Steve Albright 2024-05-22

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.