| 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; |
no test coverage detected