MCPcopy Create free account
hub / github.com/Samsung/UTopia / TEST

Function TEST

tests/constantanalysis/TestConstAnalyzer.cpp:11–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9using namespace ftg;
10
11TEST(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
25TEST(TestConstAnalyzer, CodeWithDoubleConstP) {
26 auto AST =

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
getConstValueMethod · 0.80
getMethod · 0.45
getReportMethod · 0.45

Tested by

no test coverage detected