| 9 | using namespace ftg; |
| 10 | |
| 11 | TEST(TestConstAnalyzer, CodeWithIntConstP) { |
| 12 | auto AST = clang::tooling::buildASTFromCode("const int IntConst = 1;"); |
| 13 | auto Constants = ConstAnalyzer::extractConst(*AST); |
| 14 | ASSERT_EQ(Constants.size(), 1); |
| 15 | auto ConstPair = Constants.at(0); |
| 16 | ASSERT_EQ(ConstPair.first, "IntConst"); |
| 17 | |
| 18 | // Might need better way to check value |
| 19 | ASSERT_EQ(ConstPair.second.getValues().size(), 1); |
| 20 | auto &ValueData = ConstPair.second.getValues().at(0); |
| 21 | ASSERT_EQ(ValueData.Type, ASTValueData::VType::VType_INT); |
| 22 | ASSERT_EQ(ValueData.Value, "1"); |
| 23 | } |
| 24 | |
| 25 | TEST(TestConstAnalyzer, CodeWithDoubleConstP) { |
| 26 | auto AST = |
nothing calls this directly
no test coverage detected