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

Function TEST_F

tests/analysis/TestTypeAnalyzer.cpp:23–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21};
22
23TEST_F(TestTypeAnalyzer, getReportP) {
24 std::string Code = "enum E1 { M1, M2, M3 };\n"
25 "namespace N1 { enum E2 { M1 = 3, M2, M3 }; }\n"
26 "namespace { enum E3 { M1 = 6, M2, M3 }; }\n";
27 SourceFileManager SFM;
28 SFM.createFile("test.cpp", Code);
29 ASSERT_TRUE(load(SFM.getSrcDirPath(), SFM.getFilePath("test.cpp")));
30
31 TypeAnalyzer Analyzer(SC->getASTUnits());
32 auto Report = Analyzer.getReport();
33 ASSERT_TRUE(Report);
34
35 Json::Value AnswerJson = util::strToJson(R"(
36 {
37 "typeanalysis": {
38 "enums": {
39 "(anonymous namespace)::E3": {
40 "Enumerators": [
41 {"Name": "M1","Value": 6},
42 {"Name": "M2","Value": 7},
43 {"Name": "M3","Value": 8}
44 ],
45 "Name": "(anonymous namespace)::E3"
46 },
47 "E1": {
48 "Enumerators": [
49 { "Name": "M1", "Value": 0 },
50 { "Name": "M2", "Value": 1 },
51 { "Name": "M3", "Value": 2 }
52 ],
53 "Name": "E1"
54 },
55 "N1::E2": {
56 "Enumerators": [
57 { "Name": "M1", "Value": 3 },
58 { "Name": "M2", "Value": 4 },
59 { "Name": "M3", "Value": 5 }
60 ],
61 "Name": "N1::E2"
62 }
63 }
64 }
65 }
66 )");
67 ASSERT_EQ(Report->toJson(), AnswerJson);
68}
69
70TEST_F(TestTypeAnalyzer, getReportN) {
71 std::string Code = "";

Callers

nothing calls this directly

Calls 7

strToJsonFunction · 0.85
getSrcDirPathMethod · 0.80
createFileMethod · 0.45
getFilePathMethod · 0.45
getASTUnitsMethod · 0.45
getReportMethod · 0.45
toJsonMethod · 0.45

Tested by

no test coverage detected