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

Class TestCondition

test/testcondition.cpp:29–6754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <string>
28
29class TestCondition : public TestFixture {
30public:
31 TestCondition() : TestFixture("TestCondition") {}
32
33private:
34 const Settings settings0 = settingsBuilder().library("qt.cfg").library("std.cfg").severity(Severity::style).severity(Severity::warning).build();
35 /*const*/ Settings settings1 = settingsBuilder().severity(Severity::style).severity(Severity::warning).build();
36 const Settings settings2 = settingsBuilder(settings0).severity(Severity::performance).certainty(Certainty::inconclusive).build();
37
38 void run() override {
39 const char cfg[] = "<?xml version=\"1.0\"?>\n"
40 "<def>\n"
41 " <function name=\"bar\"> <pure/> </function>\n"
42 "</def>";
43 settings1 = settingsBuilder(settings1).libraryxml(cfg).build();
44
45 mNewTemplate = true;
46 TEST_CASE(assignAndCompare); // assignment and comparison don't match
47 TEST_CASE(mismatchingBitAnd); // overlapping bitmasks
48 TEST_CASE(comparison); // CheckCondition::comparison test cases
49 TEST_CASE(multicompare); // mismatching comparisons
50 TEST_CASE(overlappingElseIfCondition); // overlapping conditions in if and else-if
51 TEST_CASE(oppositeElseIfCondition); // opposite conditions in if and else-if
52
53 TEST_CASE(checkBadBitmaskCheck);
54
55 TEST_CASE(incorrectLogicOperator1);
56 TEST_CASE(incorrectLogicOperator2);
57 TEST_CASE(incorrectLogicOperator3);
58 TEST_CASE(incorrectLogicOperator4);
59 TEST_CASE(incorrectLogicOperator5); // complex expressions
60 TEST_CASE(incorrectLogicOperator6); // char literals
61 TEST_CASE(incorrectLogicOperator7); // opposite expressions: (expr || !expr)
62 TEST_CASE(incorrectLogicOperator8); // !
63 TEST_CASE(incorrectLogicOperator9);
64 TEST_CASE(incorrectLogicOperator10); // enum
65 TEST_CASE(incorrectLogicOperator11);
66 TEST_CASE(incorrectLogicOperator12);
67 TEST_CASE(incorrectLogicOperator13);
68 TEST_CASE(incorrectLogicOperator14);
69 TEST_CASE(incorrectLogicOperator15);
70 TEST_CASE(incorrectLogicOperator16); // #10070
71 TEST_CASE(incorrectLogicOperator17);
72 TEST_CASE(secondAlwaysTrueFalseWhenFirstTrueError);
73 TEST_CASE(incorrectLogicOp_condSwapping);
74 TEST_CASE(testBug5895);
75 TEST_CASE(testBug5309);
76
77 TEST_CASE(modulo);
78
79 TEST_CASE(oppositeInnerCondition);
80 TEST_CASE(oppositeInnerConditionPointers);
81 TEST_CASE(oppositeInnerConditionClass);
82 TEST_CASE(oppositeInnerConditionUndeclaredVariable);
83 TEST_CASE(oppositeInnerConditionAlias);
84 TEST_CASE(oppositeInnerCondition2);
85 TEST_CASE(oppositeInnerCondition3);
86 TEST_CASE(oppositeInnerConditionAnd);

Callers

nothing calls this directly

Calls 2

buildMethod · 0.80
libraryMethod · 0.80

Tested by

no test coverage detected