Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2005-06-25 12:42:39 -0400
committerAlain Magloire2005-06-25 12:42:39 -0400
commit1252d8004a18579d0c4f786c881cb5f2588307ed (patch)
treefe3e165178158276f4c861fcfdbd4cfe8c22417d
parentdd2d2f9a52db3f3bdb4053be6286f0e185ffad86 (diff)
downloadorg.eclipse.cdt-1252d8004a18579d0c4f786c881cb5f2588307ed.tar.gz
org.eclipse.cdt-1252d8004a18579d0c4f786c881cb5f2588307ed.tar.xz
org.eclipse.cdt-1252d8004a18579d0c4f786c881cb5f2588307ed.zip
2005-06-25 Alain Magloire
PR 98788: Templates * model/org/eclipse/cdt/core/model/tests/CModleElementsTests.java * model/org/eclipse/cdt/core/model/tests/ITemplateTests.java * model/org/eclipse/cdt/core/model/tests/StructureCModelElementsTests.java * model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
-rw-r--r--core/org.eclipse.cdt.core.tests/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java19
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/ITemplateTests.java107
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralCModelElementsTests.java18
-rw-r--r--core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java34
5 files changed, 132 insertions, 53 deletions
diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog
index a384c5f762..2aeddec3dc 100644
--- a/core/org.eclipse.cdt.core.tests/ChangeLog
+++ b/core/org.eclipse.cdt.core.tests/ChangeLog
@@ -1,3 +1,10 @@
+2005-06-25 Alain Magloire
+ PR 98788: Templates
+ * model/org/eclipse/cdt/core/model/tests/CModleElementsTests.java
+ * model/org/eclipse/cdt/core/model/tests/ITemplateTests.java
+ * model/org/eclipse/cdt/core/model/tests/StructureCModelElementsTests.java
+ * model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
+
2005-06-16 Vladimir Hirsl
Updated search related tests to reflect function parameters in search pattern.
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java
index c5e520ba3b..f6e8970175 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/CModelElementsTests.java
@@ -27,15 +27,19 @@ import org.eclipse.cdt.core.model.IEnumerator;
import org.eclipse.cdt.core.model.IField;
import org.eclipse.cdt.core.model.IFunction;
import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.IFunctionTemplateDeclaration;
import org.eclipse.cdt.core.model.IInclude;
import org.eclipse.cdt.core.model.IMacro;
import org.eclipse.cdt.core.model.IMethod;
import org.eclipse.cdt.core.model.IMethodDeclaration;
+import org.eclipse.cdt.core.model.IMethodTemplate;
+import org.eclipse.cdt.core.model.IMethodTemplateDeclaration;
import org.eclipse.cdt.core.model.INamespace;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.ISourceRange;
import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.IStructureTemplate;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.ITypeDef;
import org.eclipse.cdt.core.model.IVariable;
@@ -43,9 +47,6 @@ import org.eclipse.cdt.core.model.IVariableDeclaration;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.internal.core.model.FunctionTemplate;
-import org.eclipse.cdt.internal.core.model.MethodTemplate;
-import org.eclipse.cdt.internal.core.model.StructureTemplate;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -436,8 +437,8 @@ public class CModelElementsTests extends TestCase {
private void checkTemplates(IParent namespace) throws CModelException{
// template function
- List functionTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION);
- FunctionTemplate ft = (FunctionTemplate)functionTemplates.get(0);
+ List functionTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION);
+ IFunctionTemplateDeclaration ft = (IFunctionTemplateDeclaration)functionTemplates.get(0);
assertEquals(ft.getElementName(), new String("aTemplatedFunction"));
checkElementOffset(ft);
ft.getTemplateSignature();
@@ -448,8 +449,8 @@ public class CModelElementsTests extends TestCase {
List nsClasses = namespace.getChildrenOfType(ICElement.C_CLASS);
IStructure enclosingClass = (IStructure) nsClasses.get(1);
checkLineNumbers(enclosingClass, 115, 120);
- List methodTemplates = enclosingClass.getChildrenOfType(ICElement.C_TEMPLATE_METHOD);
- MethodTemplate mt = (MethodTemplate)methodTemplates.get(0);
+ List methodTemplates = enclosingClass.getChildrenOfType(ICElement.C_TEMPLATE_METHOD_DECLARATION);
+ IMethodTemplateDeclaration mt = (IMethodTemplateDeclaration)methodTemplates.get(0);
assertEquals(mt.getElementName(), new String("aTemplatedMethod"));
checkElementOffset(mt);
assertEquals(mt.getTemplateSignature(), new String("aTemplatedMethod<A, B>(B) : A"));
@@ -458,7 +459,7 @@ public class CModelElementsTests extends TestCase {
// template class
List classTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_CLASS);
- StructureTemplate ct = (StructureTemplate)classTemplates.get(0);
+ IStructureTemplate ct = (IStructureTemplate)classTemplates.get(0);
assertEquals(ct.getElementName(), new String("myarray"));
checkElementOffset(ct);
assertEquals(ct.getTemplateSignature(), new String("myarray<T, Tibor>"));
@@ -466,7 +467,7 @@ public class CModelElementsTests extends TestCase {
// template struct
List structTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_STRUCT);
- StructureTemplate st = (StructureTemplate)structTemplates.get(0);
+ IStructureTemplate st = (IStructureTemplate)structTemplates.get(0);
assertEquals(st.getElementName(), new String("mystruct"));
checkElementOffset(st);
assertEquals(st.getTemplateSignature(), new String("mystruct<T, Tibor>"));
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/ITemplateTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/ITemplateTests.java
index 5a4631105c..597b40abf5 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/ITemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/ITemplateTests.java
@@ -77,7 +77,9 @@ public class ITemplateTests extends IntegratedCModelTest {
assertNotNull( c );
}
assertNotNull(myElem);
- return myElem.getChildrenOfType(ICElement.C_TEMPLATE_METHOD);
+ List list = myElem.getChildrenOfType(ICElement.C_TEMPLATE_METHOD_DECLARATION);
+ list.addAll((myElem.getChildrenOfType(ICElement.C_TEMPLATE_METHOD)));
+ return list;
}
public void testGetChildrenOfTypeTemplate() throws CModelException {
@@ -89,9 +91,10 @@ public class ITemplateTests extends IntegratedCModelTest {
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
{
@@ -101,9 +104,10 @@ public class ITemplateTests extends IntegratedCModelTest {
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
{
@@ -113,31 +117,87 @@ public class ITemplateTests extends IntegratedCModelTest {
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
{
- // Methods and Functions are tested together as
- // Function declarations in Quick Parse mode
- // are considered Method Declarations in Structural parse mode
+ // Method from the TemplateContainer
List arrayElements = getTemplateMethods(tu);
- arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION));
String[] myExpectedValues = {
- "fum",
- "scrum",
- "nonVector<T>::first",
- "IsGreaterThan",
- "Foo::fum"
+ "fum",
+ "scrum",
+ };
+ assertEquals(myExpectedValues.length, arrayElements.size());
+ // This test is no correct there is no guaranty on the order
+ // for this particular case
+ for(int i=0; i<myExpectedValues.length; i++) {
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
+ assertNotNull( "Failed on "+i, myITemplate);
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
+ }
+ }
+ {
+ // Check the template function
+ List arrayElements = tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION);
+ String[] myExpectedValues = {
+ "nonVector<T>::first",
+ "Foo::fum",
+ };
+ assertEquals(myExpectedValues.length, arrayElements.size());
+ // This test is no correct there is no guaranty on the order
+ // for this particular case
+ for(int i=0; i<myExpectedValues.length; i++) {
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
+ assertNotNull( "Failed on "+i, myITemplate);
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
+ }
+
+ }
+ {
+ // Template function declation
+ List arrayElements = tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION);
+ String[] myExpectedValues = {
+ "IsGreaterThan"
};
assertEquals(myExpectedValues.length, arrayElements.size());
+ // This test is no correct there is no guaranty on the order
+ // for this particular case
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
+ {
+// // Methods and Functions are tested together as
+// // Function declarations in Quick Parse mode
+// // are considered Method Declarations in Structural parse mode
+// List arrayElements = getTemplateMethods(tu);
+// arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION));
+// arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION));
+// String[] myExpectedValues = {
+// "fum",
+// "scrum",
+// "nonVector<T>::first",
+// "Foo::fum",
+// "IsGreaterThan"
+// };
+// assertEquals(myExpectedValues.length, arrayElements.size());
+// // This test is no correct there is no guaranty on the order
+// // for this particular case
+// for(int i=0; i<myExpectedValues.length; i++) {
+// ICElement celement = (ICElement) arrayElements.get(i);
+// ITemplate myITemplate = (ITemplate)celement;
+// assertNotNull( "Failed on "+i, myITemplate);
+// assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
+// }
+ }
/*
// TEMPLATE_VARIABLE moved to failed tests
{
@@ -164,6 +224,7 @@ public class ITemplateTests extends IntegratedCModelTest {
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_UNION ) );
arrayElements.addAll( getTemplateMethods(tu) );
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION ) );
+ arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION ) );
// TEMPLATE_VARIABLE moved to failed tests
//arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_VARIABLE ) );
@@ -188,8 +249,9 @@ public class ITemplateTests extends IntegratedCModelTest {
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_UNION ) );
arrayElements.addAll( getTemplateMethods(tu) );
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION ) );
+ arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION ) );
// TEMPLATE_VARIABLE moved to failed tests
- //arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_VARIABLE ) );
+ //arrayElements.addAll( tu.getChildrenOfType(ICElement.C_VARIABLE_TEMPLATE ) );
String[][] myExpectedValues = {
//"Map"
@@ -204,10 +266,10 @@ public class ITemplateTests extends IntegratedCModelTest {
{"int"},
//"nonVector::first"
{"T"},
- //"IsGreaterThan"
- {"X"},
//"Foo::fum"
{"Bar"},
+ //"IsGreaterThan"
+ {"X"},
/*
//"default_alloc_template::S_start_free"
{"bool", "int"},*/
@@ -233,6 +295,7 @@ public class ITemplateTests extends IntegratedCModelTest {
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_UNION ) );
arrayElements.addAll( getTemplateMethods(tu) );
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION ) );
+ arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION ) );
// TEMPLATE_VARIABLE moved to failed tests
//arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_VARIABLE ) );
@@ -243,9 +306,9 @@ public class ITemplateTests extends IntegratedCModelTest {
"fum<Bar>(int) : void",
"scrum<int>(void) : void", // TODO: deduce the rules of () versus (void), compare below.
"nonVector<T>::first<T>() : const T&", // TODO: where should <T> be?
+ "Foo::fum<Bar>(int) : void",
// TODO: shouldn't signature indicate const function as well?
"IsGreaterThan<X>(X, X) : bool",
- "Foo::fum<Bar>(int) : void",
/*"default_alloc_template<threads,inst>::S_start_free<bool, int> : char*",*/
};
assertEquals(myExpectedValues.length, arrayElements.size());
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralCModelElementsTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralCModelElementsTests.java
index 50f1d6e432..956b3ef0d2 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralCModelElementsTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralCModelElementsTests.java
@@ -28,15 +28,18 @@ import org.eclipse.cdt.core.model.IEnumerator;
import org.eclipse.cdt.core.model.IField;
import org.eclipse.cdt.core.model.IFunction;
import org.eclipse.cdt.core.model.IFunctionDeclaration;
+import org.eclipse.cdt.core.model.IFunctionTemplateDeclaration;
import org.eclipse.cdt.core.model.IInclude;
import org.eclipse.cdt.core.model.IMacro;
import org.eclipse.cdt.core.model.IMethod;
import org.eclipse.cdt.core.model.IMethodDeclaration;
+import org.eclipse.cdt.core.model.IMethodTemplateDeclaration;
import org.eclipse.cdt.core.model.INamespace;
import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.core.model.ISourceRange;
import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.IStructure;
+import org.eclipse.cdt.core.model.IStructureTemplate;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.model.ITypeDef;
import org.eclipse.cdt.core.model.IVariable;
@@ -44,9 +47,6 @@ import org.eclipse.cdt.core.model.IVariableDeclaration;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.CTestPlugin;
-import org.eclipse.cdt.internal.core.model.FunctionTemplate;
-import org.eclipse.cdt.internal.core.model.MethodTemplate;
-import org.eclipse.cdt.internal.core.model.StructureTemplate;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -444,8 +444,8 @@ public class StructuralCModelElementsTests extends TestCase {
private void checkTemplates(IParent namespace) throws CModelException{
// template function
- List functionTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION);
- FunctionTemplate ft = (FunctionTemplate)functionTemplates.get(0);
+ List functionTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION);
+ IFunctionTemplateDeclaration ft = (IFunctionTemplateDeclaration)functionTemplates.get(0);
assertEquals(ft.getElementName(), new String("aTemplatedFunction")); //$NON-NLS-1$
checkElementOffset(ft);
ft.getTemplateSignature();
@@ -456,8 +456,8 @@ public class StructuralCModelElementsTests extends TestCase {
List nsClasses = namespace.getChildrenOfType(ICElement.C_CLASS);
IStructure enclosingClass = (IStructure) nsClasses.get(1);
checkLineNumbers(enclosingClass, 115, 120);
- List methodTemplates = enclosingClass.getChildrenOfType(ICElement.C_TEMPLATE_METHOD);
- MethodTemplate mt = (MethodTemplate)methodTemplates.get(0);
+ List methodTemplates = enclosingClass.getChildrenOfType(ICElement.C_TEMPLATE_METHOD_DECLARATION);
+ IMethodTemplateDeclaration mt = (IMethodTemplateDeclaration)methodTemplates.get(0);
assertEquals(mt.getElementName(), new String("aTemplatedMethod")); //$NON-NLS-1$
checkElementOffset(mt);
assertEquals(mt.getTemplateSignature(), new String("aTemplatedMethod<A, B>(B) : A")); //$NON-NLS-1$
@@ -466,7 +466,7 @@ public class StructuralCModelElementsTests extends TestCase {
// template class
List classTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_CLASS);
- StructureTemplate ct = (StructureTemplate)classTemplates.get(0);
+ IStructureTemplate ct = (IStructureTemplate)classTemplates.get(0);
assertEquals(ct.getElementName(), new String("myarray")); //$NON-NLS-1$
checkElementOffset(ct);
assertEquals(ct.getTemplateSignature(), new String("myarray<T, Tibor>")); //$NON-NLS-1$
@@ -474,7 +474,7 @@ public class StructuralCModelElementsTests extends TestCase {
// template struct
List structTemplates = namespace.getChildrenOfType(ICElement.C_TEMPLATE_STRUCT);
- StructureTemplate st = (StructureTemplate)structTemplates.get(0);
+ IStructureTemplate st = (IStructureTemplate)structTemplates.get(0);
assertEquals(st.getElementName(), new String("mystruct")); //$NON-NLS-1$
checkElementOffset(st);
assertEquals(st.getTemplateSignature(), new String("mystruct<T, Tibor>")); //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
index 06d4ffba5a..29f3436374 100644
--- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
+++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/model/tests/StructuralTemplateTests.java
@@ -57,9 +57,10 @@ public class StructuralTemplateTests extends ITemplateTests {
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
{
@@ -69,9 +70,10 @@ public class StructuralTemplateTests extends ITemplateTests {
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
{
@@ -81,9 +83,10 @@ public class StructuralTemplateTests extends ITemplateTests {
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
{
@@ -93,18 +96,20 @@ public class StructuralTemplateTests extends ITemplateTests {
List arrayElements = getTemplateMethods(tu);
arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION));
arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_METHOD));
+ arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION));
String[] myExpectedValues = {
"fum",
"scrum",
- "IsGreaterThan",
"first",
- "fum"
+ "fum",
+ "IsGreaterThan",
};
assertEquals(myExpectedValues.length, arrayElements.size());
for(int i=0; i<myExpectedValues.length; i++) {
- ITemplate myITemplate = (ITemplate) arrayElements.get(i);
+ ICElement celement = (ICElement) arrayElements.get(i);
+ ITemplate myITemplate = (ITemplate)celement;
assertNotNull( "Failed on "+i, myITemplate);
- assertEquals("Failed on "+i, myExpectedValues[i], myITemplate.getElementName());
+ assertEquals("Failed on "+i, myExpectedValues[i], celement.getElementName());
}
}
}
@@ -120,6 +125,7 @@ public class StructuralTemplateTests extends ITemplateTests {
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_UNION ) );
arrayElements.addAll( getTemplateMethods(tu) );
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION ) );
+ arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION ) );
arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_METHOD));
// TEMPLATE_VARIABLE moved to failed tests
//arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_VARIABLE ) );
@@ -149,6 +155,7 @@ public class StructuralTemplateTests extends ITemplateTests {
arrayElements.addAll( getTemplateMethods(tu) );
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION ) );
arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_METHOD));
+ arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION));
// TEMPLATE_VARIABLE moved to failed tests
//arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_VARIABLE ) );
@@ -163,12 +170,12 @@ public class StructuralTemplateTests extends ITemplateTests {
{"Bar"},
//"TemplateParameter::scrum"
{"int"},
- //"IsGreaterThan"
- {"X"},
//"nonVector::first"
{"T"},
//"Foo::fum"
{"Bar"},
+ //"IsGreaterThan"
+ {"X"},
/*
//"default_alloc_template::S_start_free"
{"bool", "int"},*/
@@ -198,6 +205,7 @@ public class StructuralTemplateTests extends ITemplateTests {
arrayElements.addAll( getTemplateMethods(tu) );
arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION ) );
arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_METHOD));
+ arrayElements.addAll(tu.getChildrenOfType(ICElement.C_TEMPLATE_FUNCTION_DECLARATION));
// TEMPLATE_VARIABLE moved to failed tests
//arrayElements.addAll( tu.getChildrenOfType(ICElement.C_TEMPLATE_VARIABLE ) );
@@ -208,9 +216,9 @@ public class StructuralTemplateTests extends ITemplateTests {
"fum<Bar>(int) : void",
"scrum<int>(void) : void", // TODO: deduce the rules of () versus (void), compare below.
// TODO: shouldn't signature indicate const function as well?
- "IsGreaterThan<X>(X, X) : bool",
"first<T>() : const T&", // TODO: where should <T> be?
"fum<Bar>(int) : void",
+ "IsGreaterThan<X>(X, X) : bool",
/*"default_alloc_template<threads,inst>::S_start_free<bool, int> : char*",*/
};
assertEquals(myExpectedValues.length, arrayElements.size());

Back to the top