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

Method isConstOp

test/testtoken.cpp:925–950  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

923 }
924
925 void isConstOp() const {
926 std::vector<std::string> test_ops;
927 append_vector(test_ops, arithmeticalOps);
928 append_vector(test_ops, bitOps);
929 append_vector(test_ops, comparisonOps);
930 append_vector(test_ops, logicalOps);
931
932 for (auto test_op = test_ops.cbegin(); test_op != test_ops.cend(); ++test_op) {
933 auto tokensFrontBack = std::make_shared<TokensFrontBack>();
934 Token tok(list, std::move(tokensFrontBack));
935 tok.str(*test_op);
936 ASSERT_EQUALS(true, tok.isConstOp());
937 }
938
939 // Negative test against other operators
940 std::vector<std::string> other_ops;
941 append_vector(other_ops, extendedOps);
942 append_vector(other_ops, assignmentOps);
943
944 for (auto other_op = other_ops.cbegin(); other_op != other_ops.cend(); ++other_op) {
945 auto tokensFrontBack = std::make_shared<TokensFrontBack>();
946 Token tok(list, std::move(tokensFrontBack));
947 tok.str(*other_op);
948 ASSERT_EQUALS_MSG(false, tok.isConstOp(), "Failing normal operator: " + *other_op);
949 }
950 }
951
952 void isExtendedOp() const {
953 std::vector<std::string> test_ops;

Callers 12

createAstAtTokenInnerFunction · 0.80
minUnsignedValueFunction · 0.80
isDecayedPointerFunction · 0.80
isVariableUsedFunction · 0.80
checkScopeForVariableMethod · 0.80
bifurcateFunction · 0.80
multiComparePercentFunction · 0.80
hasNoreturnFunctionFunction · 0.80
getExprUsageFunction · 0.80

Calls 1

strMethod · 0.45

Tested by

no test coverage detected