/cpp/src/test/java/com/google/test/metric/cpp/CppParserTest.java

http://testability-explorer.googlecode.com/ · Java · 520 lines · 446 code · 58 blank · 16 comment · 0 complexity · a47e9b91f8a5b525eeaffb95688280b4 MD5 · raw file

  1. /*
  2. * Copyright 2008 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.google.test.metric.cpp;
  17. import com.google.test.metric.ParameterInfo;
  18. import com.google.test.metric.Visibility;
  19. import com.google.test.metric.cpp.dom.AssignmentExpression;
  20. import com.google.test.metric.cpp.dom.BaseClass;
  21. import com.google.test.metric.cpp.dom.BaseClass.AccessSpecifier;
  22. import com.google.test.metric.cpp.dom.BreakStatement;
  23. import com.google.test.metric.cpp.dom.CaseStatement;
  24. import com.google.test.metric.cpp.dom.ClassDeclaration;
  25. import com.google.test.metric.cpp.dom.DefaultStatement;
  26. import com.google.test.metric.cpp.dom.ElseStatement;
  27. import com.google.test.metric.cpp.dom.Expression;
  28. import com.google.test.metric.cpp.dom.ExpressionStatement;
  29. import com.google.test.metric.cpp.dom.FunctionDeclaration;
  30. import com.google.test.metric.cpp.dom.FunctionDefinition;
  31. import com.google.test.metric.cpp.dom.FunctionInvocation;
  32. import com.google.test.metric.cpp.dom.IfStatement;
  33. import com.google.test.metric.cpp.dom.LoopStatement;
  34. import com.google.test.metric.cpp.dom.Name;
  35. import com.google.test.metric.cpp.dom.Namespace;
  36. import com.google.test.metric.cpp.dom.NodeList;
  37. import com.google.test.metric.cpp.dom.ReturnStatement;
  38. import com.google.test.metric.cpp.dom.SwitchStatement;
  39. import com.google.test.metric.cpp.dom.TernaryOperation;
  40. import com.google.test.metric.cpp.dom.TranslationUnit;
  41. import com.google.test.metric.cpp.dom.VariableDeclaration;
  42. import junit.framework.TestCase;
  43. import java.util.List;
  44. public class CppParserTest extends TestCase {
  45. private TranslationUnit parse(String source, NodeDictionary dict)
  46. throws Exception {
  47. return new Parser().parse(source, dict);
  48. }
  49. private TranslationUnit parse(String source) throws Exception {
  50. return new Parser().parse(source);
  51. }
  52. public void testEmptyClass() throws Exception {
  53. TranslationUnit unit = parse("class A{};");
  54. ClassDeclaration classA = unit.getChild(0);
  55. assertEquals("A", classA.getName());
  56. }
  57. public void testTwoClasses() throws Exception {
  58. TranslationUnit unit = parse("class A{}; class B{};");
  59. ClassDeclaration classA = unit.getChild(0);
  60. assertEquals("A", classA.getName());
  61. ClassDeclaration classB = unit.getChild(1);
  62. assertEquals("B", classB.getName());
  63. }
  64. public void testNestedClass() throws Exception {
  65. TranslationUnit unit = parse("class A{ class B{}; };");
  66. ClassDeclaration classA = unit.getChild(0);
  67. assertEquals("A", classA.getName());
  68. ClassDeclaration classB = classA.getChild(0);
  69. assertEquals("B", classB.getName());
  70. }
  71. public void testUnnamedNamespace() throws Exception {
  72. TranslationUnit unit = parse("namespace {}");
  73. Namespace namespace = unit.getChild(0);
  74. assertNull(namespace.getName());
  75. }
  76. public void testEmptyNamespace() throws Exception {
  77. TranslationUnit unit = parse("namespace A{}");
  78. Namespace namespaceA = unit.getChild(0);
  79. assertEquals("A", namespaceA.getName());
  80. }
  81. public void testTwoNamespaces() throws Exception {
  82. TranslationUnit unit = parse("namespace A{} namespace B{}");
  83. Namespace namespaceA = unit.getChild(0);
  84. assertEquals("A", namespaceA.getName());
  85. Namespace namespaceB = unit.getChild(1);
  86. assertEquals("B", namespaceB.getName());
  87. }
  88. public void testNestedNamespace() throws Exception {
  89. TranslationUnit unit = parse("namespace A{ namespace B{} }");
  90. Namespace namespaceA = unit.getChild(0);
  91. assertEquals("A", namespaceA.getName());
  92. Namespace namespaceB = namespaceA.getChild(0);
  93. assertEquals("B", namespaceB.getName());
  94. }
  95. public void testClassInNamespace() throws Exception {
  96. TranslationUnit unit = parse("namespace A{ class B{}; }");
  97. Namespace namespaceA = unit.getChild(0);
  98. assertEquals("A", namespaceA.getName());
  99. ClassDeclaration classB = namespaceA.getChild(0);
  100. assertEquals("B", classB.getName());
  101. }
  102. public void testGlobalFunctionDeclaration() throws Exception {
  103. TranslationUnit unit = parse("void foo();");
  104. FunctionDeclaration functionFoo = unit.getChild(0);
  105. assertEquals("foo", functionFoo.getName());
  106. }
  107. public void testGlobalVarableDeclaration() throws Exception {
  108. TranslationUnit unit = parse("int a = 0, b = 1, c;");
  109. VariableDeclaration variableA = unit.getChild(0);
  110. assertEquals("a", variableA.getName());
  111. VariableDeclaration variableB = unit.getChild(1);
  112. assertEquals("b", variableB.getName());
  113. VariableDeclaration variableC = unit.getChild(2);
  114. assertEquals("c", variableC.getName());
  115. }
  116. public void testFunctionDeclarationInNamespace() throws Exception {
  117. TranslationUnit unit = parse("namespace A { void foo(); };");
  118. Namespace namespaceA = unit.getChild(0);
  119. assertEquals("A", namespaceA.getName());
  120. FunctionDeclaration functionFoo = namespaceA.getChild(0);
  121. assertEquals("foo", functionFoo.getName());
  122. }
  123. public void testMemberFunctionDeclaration() throws Exception {
  124. TranslationUnit unit = parse("class A { void foo(); };");
  125. ClassDeclaration classA = unit.getChild(0);
  126. assertEquals("A", classA.getName());
  127. FunctionDeclaration functionFoo = classA.getChild(0);
  128. assertEquals("foo", functionFoo.getName());
  129. }
  130. public void testEmptyGlobalFunction() throws Exception {
  131. TranslationUnit unit = parse("void foo() {}");
  132. FunctionDefinition functionFoo = unit.getChild(0);
  133. assertEquals("foo", functionFoo.getName());
  134. }
  135. public void testEmptyFunctionInNamespace() throws Exception {
  136. TranslationUnit unit = parse("namespace A { void foo() {} }");
  137. Namespace namespaceA = unit.getChild(0);
  138. assertEquals("A", namespaceA.getName());
  139. FunctionDefinition functionFoo = namespaceA.getChild(0);
  140. assertEquals("foo", functionFoo.getName());
  141. }
  142. public void testEmptyMemberFunction() throws Exception {
  143. TranslationUnit unit = parse("class A { void foo() {} };");
  144. ClassDeclaration classA = unit.getChild(0);
  145. assertEquals("A", classA.getName());
  146. FunctionDefinition functionFoo = classA.getChild(0);
  147. assertEquals("foo", functionFoo.getName());
  148. assertEquals(1, functionFoo.getLine());
  149. }
  150. public void testFunctionLineNumbers() throws Exception {
  151. TranslationUnit unit = parse("class A { void foo() {}\n void\n bar() {} };");
  152. ClassDeclaration classA = unit.getChild(0);
  153. FunctionDefinition functionFoo = classA.getChild(0);
  154. assertEquals(1, functionFoo.getLine());
  155. FunctionDefinition functionBar = classA.getChild(1);
  156. assertEquals(3, functionBar.getLine());
  157. }
  158. public void testSimpleFunction() throws Exception {
  159. TranslationUnit unit = parse("int foo() { int a = 0; a = a + 1;\n return a; }");
  160. FunctionDefinition functionFoo = unit.getChild(0);
  161. assertEquals("foo", functionFoo.getName());
  162. ReturnStatement returnStatement = functionFoo.getChild(2);
  163. assertNotNull(returnStatement);
  164. assertEquals(2, returnStatement.getLineNumber());
  165. }
  166. public void testFunctionWithParameters() throws Exception {
  167. TranslationUnit unit = parse("int foo(int a, int b) { return a + b; }");
  168. FunctionDefinition functionFoo = unit.getChild(0);
  169. assertEquals("foo", functionFoo.getName());
  170. ReturnStatement returnStatement = functionFoo.getChild(0);
  171. assertNotNull(returnStatement);
  172. List<ParameterInfo> parameters = functionFoo.getParameters();
  173. assertEquals(2, parameters.size());
  174. ParameterInfo parameterA = parameters.get(0);
  175. assertEquals("a", parameterA.getName());
  176. assertEquals("int", parameterA.getType().toString());
  177. ParameterInfo parameterB = parameters.get(1);
  178. assertEquals("b", parameterB.getName());
  179. assertEquals("int", parameterB.getType().toString());
  180. }
  181. public void testForStatement() throws Exception {
  182. TranslationUnit unit = parse("void foo() { for(;;); }");
  183. FunctionDefinition functionFoo = unit.getChild(0);
  184. LoopStatement forStatement = functionFoo.getChild(0);
  185. assertNotNull(forStatement);
  186. }
  187. public void testWhileStatement() throws Exception {
  188. TranslationUnit unit = parse("void foo() { while(true); }");
  189. FunctionDefinition functionFoo = unit.getChild(0);
  190. LoopStatement whileStatement = functionFoo.getChild(0);
  191. assertNotNull(whileStatement);
  192. }
  193. public void testDoStatement() throws Exception {
  194. TranslationUnit unit = parse("void foo() { do {} while(true); }");
  195. FunctionDefinition functionFoo = unit.getChild(0);
  196. LoopStatement doStatement = functionFoo.getChild(0);
  197. assertNotNull(doStatement);
  198. }
  199. public void testWhileInForStatement() throws Exception {
  200. TranslationUnit unit = parse("void foo() { for(;;) while(true); }");
  201. FunctionDefinition functionFoo = unit.getChild(0);
  202. LoopStatement forStatement = functionFoo.getChild(0);
  203. assertNotNull(forStatement);
  204. LoopStatement whileStatement = forStatement.getChild(0);
  205. assertNotNull(whileStatement);
  206. }
  207. public void testForInDoStatement() throws Exception {
  208. TranslationUnit unit = parse("void foo() { do for(;;); while(true); }");
  209. FunctionDefinition functionFoo = unit.getChild(0);
  210. LoopStatement doStatement = functionFoo.getChild(0);
  211. assertNotNull(doStatement);
  212. LoopStatement forStatement = doStatement.getChild(0);
  213. assertNotNull(forStatement);
  214. }
  215. public void testForInCompoundDoStatement() throws Exception {
  216. TranslationUnit unit = parse("void foo() { do { for(;;); } while(true); }");
  217. FunctionDefinition functionFoo = unit.getChild(0);
  218. LoopStatement doStatement = functionFoo.getChild(0);
  219. assertNotNull(doStatement);
  220. LoopStatement forStatement = doStatement.getChild(0);
  221. assertNotNull(forStatement);
  222. }
  223. public void testForInSeveralCompoundStatements() throws Exception {
  224. TranslationUnit unit = parse("void foo() { {{{ for(;;); }}} }");
  225. FunctionDefinition functionFoo = unit.getChild(0);
  226. LoopStatement forStatement = functionFoo.getChild(0);
  227. assertNotNull(forStatement);
  228. }
  229. public void testIfStatement() throws Exception {
  230. TranslationUnit unit = parse("void foo() { if (true); }");
  231. FunctionDefinition functionFoo = unit.getChild(0);
  232. IfStatement ifStatement = functionFoo.getChild(0);
  233. assertNotNull(ifStatement);
  234. }
  235. public void testIfElseStatement() throws Exception {
  236. TranslationUnit unit = parse("void foo() { if (true); else; }");
  237. FunctionDefinition functionFoo = unit.getChild(0);
  238. IfStatement ifStatement = functionFoo.getChild(0);
  239. assertNotNull(ifStatement);
  240. ElseStatement elseStatement = functionFoo.getChild(1);
  241. assertNotNull(elseStatement);
  242. }
  243. public void testCompoundIfElseStatement() throws Exception {
  244. TranslationUnit unit = parse("void foo() { if (true) {} else {} }");
  245. FunctionDefinition functionFoo = unit.getChild(0);
  246. IfStatement ifStatement = functionFoo.getChild(0);
  247. assertNotNull(ifStatement);
  248. ElseStatement elseStatement = functionFoo.getChild(1);
  249. assertNotNull(elseStatement);
  250. }
  251. public void testIfElseAndLoopStatements() throws Exception {
  252. TranslationUnit unit = parse("void foo() { if (true) { for(;;); } else { while(true); } }");
  253. FunctionDefinition functionFoo = unit.getChild(0);
  254. IfStatement ifStatement = functionFoo.getChild(0);
  255. LoopStatement forStatement = ifStatement.getChild(0);
  256. assertNotNull(forStatement);
  257. ElseStatement elseStatement = functionFoo.getChild(1);
  258. LoopStatement whileStatement = elseStatement.getChild(0);
  259. assertNotNull(whileStatement);
  260. }
  261. public void testSwitchStatement() throws Exception {
  262. TranslationUnit unit = parse("void foo() { switch (a) { case 1: break; } }");
  263. FunctionDefinition functionFoo = unit.getChild(0);
  264. SwitchStatement switchStatement = functionFoo.getChild(0);
  265. CaseStatement caseStatement = switchStatement.getChild(0);
  266. assertNotNull(caseStatement);
  267. }
  268. public void testSwitchStatementWithDefault() throws Exception {
  269. TranslationUnit unit = parse("void foo() { switch (a) { case 1: break; default: break; } }");
  270. FunctionDefinition functionFoo = unit.getChild(0);
  271. SwitchStatement switchStatement = functionFoo.getChild(0);
  272. CaseStatement caseStatement = switchStatement.getChild(0);
  273. BreakStatement breakStatement = caseStatement.getChild(0);
  274. assertNotNull(breakStatement);
  275. DefaultStatement defaultStatement = switchStatement.getChild(1);
  276. breakStatement = defaultStatement.getChild(0);
  277. assertNotNull(breakStatement);
  278. }
  279. public void testTernaryOperator() throws Exception {
  280. TranslationUnit unit = parse("int foo(int a, int b) { return a ? 0 : b; }");
  281. FunctionDefinition functionFoo = unit.getChild(0);
  282. ReturnStatement returnStatement = functionFoo.getChild(0);
  283. TernaryOperation ternaryOperation = returnStatement.getExpression(0);
  284. assertNotNull(ternaryOperation);
  285. }
  286. public void testNestedTernaryOperator() throws Exception {
  287. TranslationUnit unit = parse("int foo(int a, int b) { int c = a ? 0 : (b ? 1 : 2); }");
  288. FunctionDefinition functionFoo = unit.getChild(0);
  289. VariableDeclaration variableC = functionFoo.getChild(0);
  290. TernaryOperation ternaryOperation = variableC.getExpression(0);
  291. TernaryOperation nestedTernaryOperation = ternaryOperation.getExpression(1);
  292. assertNotNull(nestedTernaryOperation);
  293. }
  294. public void testFunctionCall() throws Exception {
  295. TranslationUnit unit = parse("void foo(int) {} void bar(int) { foo(5); }");
  296. FunctionDefinition functionBar = unit.getChild(1);
  297. ExpressionStatement expressionStatement = functionBar.getChild(0);
  298. FunctionInvocation callFoo = expressionStatement.getExpression(0);
  299. assertEquals("foo", callFoo.getName());
  300. }
  301. public void testNestedFunctionCall() throws Exception {
  302. TranslationUnit unit = parse(
  303. "int foo(int a) { return a; } " +
  304. "int bar(int b) { return foo(foo(b)); } ");
  305. FunctionDefinition functionBar = unit.getChild(1);
  306. assertEquals("bar", functionBar.getName());
  307. ReturnStatement returnStatement = functionBar.getChild(0);
  308. FunctionInvocation callFoo = returnStatement.getExpression(0);
  309. assertEquals("foo", callFoo.getName());
  310. NodeList parameters = callFoo.getParameters();
  311. FunctionInvocation callFooAgain = parameters.get(0);
  312. assertEquals("foo", callFooAgain.getName());
  313. assertEquals(0, callFooAgain.getChildren().size());
  314. }
  315. public void testSequentialFunctionCalls() throws Exception {
  316. TranslationUnit unit = parse(
  317. "class A { public: void foo() {} }; " +
  318. "A bar() { A a; return a; } " +
  319. "void main() { bar().foo(); } ");
  320. FunctionDefinition functionMain = unit.getChild(2);
  321. assertEquals("main", functionMain.getName());
  322. ExpressionStatement expressionStatement = functionMain.getChild(0);
  323. FunctionInvocation callBar = expressionStatement.getExpression(0);
  324. assertEquals("bar", callBar.getName());
  325. FunctionInvocation callFoo = callBar.getChild(0);
  326. assertEquals("foo", callFoo.getName());
  327. assertEquals(0, callFoo.getChildren().size());
  328. }
  329. public void testLocalVariable() throws Exception {
  330. TranslationUnit unit = parse(
  331. "void main() { int a = 0, b = 0; a += 1; }");
  332. FunctionDefinition functionMain = unit.getChild(0);
  333. assertEquals("main", functionMain.getName());
  334. VariableDeclaration variableA = functionMain.getChild(0);
  335. assertEquals("a", variableA.getName());
  336. VariableDeclaration variableB = functionMain.getChild(1);
  337. assertEquals("b", variableB.getName());
  338. }
  339. public void testPrivateAccessSpecifier() throws Exception {
  340. TranslationUnit unit = parse(
  341. "class A { private: void foo(); };");
  342. ClassDeclaration classA = unit.getChild(0);
  343. FunctionDeclaration functionFoo = classA.getChild(0);
  344. Visibility visibility = functionFoo.getVisibility();
  345. assertEquals(Visibility.PRIVATE, visibility);
  346. }
  347. public void testProtectedAccessSpecifier() throws Exception {
  348. TranslationUnit unit = parse(
  349. "class A { protected: void foo() {} void bar() {} };");
  350. ClassDeclaration classA = unit.getChild(0);
  351. FunctionDefinition functionFoo = classA.getChild(0);
  352. Visibility visibilityFoo = functionFoo.getVisibility();
  353. assertEquals(Visibility.PROTECTED, visibilityFoo);
  354. FunctionDefinition functionBar = classA.getChild(1);
  355. Visibility visibilityBar = functionBar.getVisibility();
  356. assertEquals(Visibility.PROTECTED, visibilityBar);
  357. }
  358. public void testLocalAssgnment() throws Exception {
  359. TranslationUnit unit = parse(
  360. "void main() { int a = 0, b = 1; a = b; }");
  361. FunctionDefinition functionMain = unit.getChild(0);
  362. VariableDeclaration variableA = functionMain.getChild(0);
  363. assertEquals("a", variableA.getName());
  364. VariableDeclaration variableB = functionMain.getChild(1);
  365. assertEquals("b", variableB.getName());
  366. ExpressionStatement statement = functionMain.getChild(2);
  367. Expression expression = statement.getExpression(0);
  368. assertTrue(expression instanceof AssignmentExpression);
  369. AssignmentExpression assignment = (AssignmentExpression) expression;
  370. Name leftSide = assignment.getExpression(0);
  371. Name rightSide = assignment.getExpression(1);
  372. assertEquals("a", leftSide.getIdentifier());
  373. assertEquals("b", rightSide.getIdentifier());
  374. }
  375. public void testPointerVariable() throws Exception {
  376. TranslationUnit unit = parse(
  377. "void main() { int *p = 0, a = 0, *pp = 0; }");
  378. FunctionDefinition functionMain = unit.getChild(0);
  379. VariableDeclaration variableP = functionMain.getChild(0);
  380. assertEquals("p", variableP.getName());
  381. assertEquals("int", variableP.getType());
  382. assertTrue(variableP.isPointer());
  383. VariableDeclaration variableA = functionMain.getChild(1);
  384. assertEquals("a", variableA.getName());
  385. assertEquals("int", variableA.getType());
  386. assertFalse(variableA.isPointer());
  387. VariableDeclaration variablePP = functionMain.getChild(2);
  388. assertEquals("pp", variablePP.getName());
  389. assertEquals("int", variablePP.getType());
  390. assertTrue(variablePP.isPointer());
  391. }
  392. public void testReferenceVariable() throws Exception {
  393. TranslationUnit unit = parse(
  394. "void main() { int a = 0; int& r = a; }");
  395. FunctionDefinition functionMain = unit.getChild(0);
  396. VariableDeclaration variableA = functionMain.getChild(0);
  397. assertEquals("a", variableA.getName());
  398. assertEquals("int", variableA.getType());
  399. assertFalse(variableA.isPointer());
  400. VariableDeclaration variableR = functionMain.getChild(1);
  401. assertEquals("r", variableR.getName());
  402. assertEquals("int", variableR.getType());
  403. assertTrue(variableR.isPointer());
  404. }
  405. public void testClassLoadCppVariables() throws Exception {
  406. assertEquals(64, CPPvariables.QI_TYPE.size());
  407. }
  408. public void testInheritance() throws Exception {
  409. TranslationUnit unit = parse("class A{}; class B : public A {};");
  410. ClassDeclaration classA = unit.getChild(0);
  411. ClassDeclaration classB = unit.getChild(1);
  412. assertEquals("A", classA.getName());
  413. assertEquals("B", classB.getName());
  414. ClassDeclaration baseB = classB.getBaseClass(0).getDeclaration();
  415. assertEquals("A", baseB.getName());
  416. assertEquals(AccessSpecifier.PUBLIC, classB.getBaseClass(0)
  417. .getAccessSpecifier());
  418. }
  419. public void testMultipleInheritence() throws Exception {
  420. TranslationUnit unit = parse(
  421. "class A{}; class B{}; class C : public A, protected B {};");
  422. ClassDeclaration classA = unit.getChild(0);
  423. ClassDeclaration classB = unit.getChild(1);
  424. ClassDeclaration classC = unit.getChild(2);
  425. assertEquals("A", classA.getName());
  426. assertEquals("B", classB.getName());
  427. assertEquals("C", classC.getName());
  428. BaseClass baseC0 = classC.getBaseClass(0);
  429. BaseClass baseC1 = classC.getBaseClass(1);
  430. assertEquals("A", baseC0.getDeclaration().getName());
  431. assertEquals(AccessSpecifier.PUBLIC, baseC0.getAccessSpecifier());
  432. assertEquals("B", baseC1.getDeclaration().getName());
  433. assertEquals(AccessSpecifier.PROTECTED, baseC1.getAccessSpecifier());
  434. }
  435. public void testInheritedClassInSpecifiedNamespace() throws Exception {
  436. TranslationUnit unit = parse(
  437. "namespace Foo { class A {}; } " +
  438. "class B : public Foo::A {};");
  439. Namespace namespaceFoo = unit.getChild(0);
  440. ClassDeclaration classA = namespaceFoo.getChild(0);
  441. ClassDeclaration classB = unit.getChild(1);
  442. assertEquals("Foo::A", classA.getQualifiedName());
  443. assertEquals("B", classB.getName());
  444. ClassDeclaration baseB = classB.getBaseClass(0).getDeclaration();
  445. assertEquals("A", baseB.getName());
  446. assertEquals(AccessSpecifier.PUBLIC, classB.getBaseClass(0)
  447. .getAccessSpecifier());
  448. }
  449. public void testInheritedClassInOtherTranslationUnit() throws Exception {
  450. // Build other tree with external declaration.
  451. NodeDictionary knownSymbols = new NodeDictionary();
  452. ClassDeclaration other = new ClassDeclaration("B");
  453. other.setParent(new Namespace("Bar"));
  454. knownSymbols.registerNode("Bar::B", other);
  455. TranslationUnit unit = parse("class A : public Bar::B {};", knownSymbols);
  456. ClassDeclaration classA = unit.getChild(0);
  457. assertEquals("A", classA.getName());
  458. ClassDeclaration baseA = classA.getBaseClass(0).getDeclaration();
  459. assertEquals("B", baseA.getName());
  460. assertEquals("Bar::B", baseA.getQualifiedName());
  461. }
  462. }