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

Function TEST_F

tests/astirmap/TestDebugInfoMap.cpp:106–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104};
105
106TEST_F(TestDebugInfoMap, getDef_ArgumentP) {
107 const std::string Code = "extern \"C\" {\n"
108 "void API(int P1, int P2);\n"
109 "class CLS {\n"
110 "public:\n"
111 " CLS() = default;\n"
112 " CLS(int P) : F(P) {}\n"
113 "private:\n"
114 " int F;\n"
115 "};\n"
116 "void test_call() {\n"
117 " API(1, 2);\n"
118 "}\n"
119 "void test_constructor() {\n"
120 " CLS *Var1 = new CLS(1);\n"
121 " CLS Var2(2);\n"
122 "}\n"
123 "void test_new_delete(void *P) {\n"
124 " CLS *Var1 = new CLS(10);\n"
125 " CLS *Var2 = new CLS[10];\n"
126 " delete Var1;\n"
127 " delete[] Var2;\n"
128 "}\n"
129 "}\n";
130 SourceFileManager SFM;
131 SFM.createFile("test.cpp", Code);
132 ASSERT_TRUE(load(SFM.getSrcDirPath(), SFM.getFilePath("test.cpp")));
133
134 ASTDefNode *ADN;
135
136 ADN = getASTDefNode("test_call", 0, 0, 0);
137 ASSERT_TRUE(ADN);
138 ASSERT_TRUE(verifyLocation(*ADN, 11, 7, 11, 3, 9, 11, 7, 1));
139
140 ADN = getASTDefNode("test_call", 0, 0, 1);
141 ASSERT_TRUE(ADN);
142 ASSERT_TRUE(verifyLocation(*ADN, 11, 10, 11, 3, 9, 11, 10, 1));
143
144 ADN = getASTDefNode("test_constructor", 0, 7, 1);
145 ASSERT_TRUE(ADN);
146 ASSERT_TRUE(verifyLocation(*ADN, 14, 23, 14, 19, 6, 14, 23, 1));
147
148 ADN = getASTDefNode("test_constructor", 1, 2, 1);
149 ASSERT_TRUE(ADN);
150 ASSERT_TRUE(verifyLocation(*ADN, 15, 12, 15, 7, 7, 15, 12, 1));
151
152 ADN = getASTDefNode("test_new_delete", 0, 10, 1);
153 ASSERT_TRUE(ADN);
154 ASSERT_TRUE(verifyLocation(*ADN, 18, 23, 18, 19, 7, 18, 23, 2));
155
156 ADN = getASTDefNode("test_new_delete", 1, 2, 0);
157 ASSERT_TRUE(ADN);
158 ASSERT_TRUE(verifyLocation(*ADN, 19, 23, 19, 15, 11, 19, 23, 2));
159
160 ADN = getASTDefNode("test_new_delete", 2, 1, 0);
161 ASSERT_TRUE(ADN);
162 ASSERT_TRUE(verifyLocation(*ADN, 20, 10, 20, 3, 11, 20, 10, 4));
163

Callers

nothing calls this directly

Calls 8

getSrcDirPathMethod · 0.80
getInstructionMethod · 0.80
getDiffNumArgsMethod · 0.80
hasDiffNumArgsMethod · 0.80
getLLVMModuleMethod · 0.80
createFileMethod · 0.45
getFilePathMethod · 0.45
getASTDefNodeMethod · 0.45

Tested by

no test coverage detected