Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordwagelaar2011-12-12 06:11:20 -0500
committerdwagelaar2011-12-12 06:11:20 -0500
commit0afe5481184c8922cfdf0f2494dd78757246fb13 (patch)
tree2d2be26bbbd224a0703c80b99c5ea8fbda89a792
parentbad3ec5045d5cd04ef1727edfd77a782a947d145 (diff)
downloadorg.eclipse.atl-0afe5481184c8922cfdf0f2494dd78757246fb13.tar.gz
org.eclipse.atl-0afe5481184c8922cfdf0f2494dd78757246fb13.tar.xz
org.eclipse.atl-0afe5481184c8922cfdf0f2494dd78757246fb13.zip
Add support for the GET_SUPER instruction.
-rw-r--r--tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/CodeBlockTest.java14
-rw-r--r--tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/EmftvmTests.java1
-rw-r--r--tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/ExecEnvTest.java36
-rw-r--r--tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/GetSuperTest.java71
-rw-r--r--tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestLib.atl6
-rw-r--r--tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestQuery.atl2
6 files changed, 111 insertions, 19 deletions
diff --git a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/CodeBlockTest.java b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/CodeBlockTest.java
index bb4245f5..8c6bf49b 100644
--- a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/CodeBlockTest.java
+++ b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/CodeBlockTest.java
@@ -36,6 +36,7 @@ import org.eclipse.m2m.atl.emftvm.EmftvmFactory;
* <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getStackLevel() <em>Get Stack Level</em>}</li>
* <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getModule() <em>Get Module</em>}</li>
* <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getOperation() <em>Get Operation</em>}</li>
+ * <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getField() <em>Get Field</em>}</li>
* <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getPredecessors(org.eclipse.m2m.atl.emftvm.Instruction) <em>Get Predecessors</em>}</li>
* <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getAllPredecessors(org.eclipse.m2m.atl.emftvm.Instruction) <em>Get All Predecessors</em>}</li>
* <li>{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getNonLoopingPredecessors(org.eclipse.m2m.atl.emftvm.Instruction) <em>Get Non Looping Predecessors</em>}</li>
@@ -219,6 +220,19 @@ public class CodeBlockTest extends TestCase {
}
/**
+ * Tests the '{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getField() <em>Get Field</em>}' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.m2m.atl.emftvm.CodeBlock#getField()
+ * @generated
+ */
+ public void testGetField() {
+ // TODO: implement this operation test method
+ // Ensure that you remove @generated or mark it @generated NOT
+ fail();
+ }
+
+ /**
* Tests the '{@link org.eclipse.m2m.atl.emftvm.CodeBlock#getPredecessors(org.eclipse.m2m.atl.emftvm.Instruction) <em>Get Predecessors</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/EmftvmTests.java b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/EmftvmTests.java
index 02c2cd66..5895b70c 100644
--- a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/EmftvmTests.java
+++ b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/EmftvmTests.java
@@ -100,6 +100,7 @@ public class EmftvmTests extends TestSuite {
suite.addTestSuite(AddTest.class);
suite.addTestSuite(RemoveTest.class);
suite.addTestSuite(InsertTest.class);
+ suite.addTestSuite(GetSuperTest.class);
return suite;
}
diff --git a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/ExecEnvTest.java b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/ExecEnvTest.java
index 14b7c4f9..39ea18f4 100644
--- a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/ExecEnvTest.java
+++ b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/ExecEnvTest.java
@@ -172,7 +172,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getMonitor()
- * @generated
+ * @generated NOT
*/
public void testGetMonitor() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -216,7 +216,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#loadModule(org.eclipse.m2m.atl.emftvm.util.ModuleResolver, java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testLoadModule__ModuleResolver_String() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -239,7 +239,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#registerFeature(org.eclipse.m2m.atl.emftvm.Feature)
- * @generated
+ * @generated NOT
*/
public void testRegisterFeature__Feature() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -263,7 +263,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#registerRule(org.eclipse.m2m.atl.emftvm.Rule)
- * @generated
+ * @generated NOT
*/
public void testRegisterRule__Rule() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -284,7 +284,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#findOperation(java.lang.Object, java.lang.String, java.lang.Object[])
- * @generated
+ * @generated NOT
*/
public void testFindOperation__Object_String_Object() {
final ExecEnv env = getFixture();
@@ -301,7 +301,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#findStaticOperation(java.lang.Object, java.lang.String, java.lang.Object[])
- * @generated
+ * @generated NOT
*/
public void testFindStaticOperation__Object_String_Object() {
final ExecEnv env = getFixture();
@@ -318,7 +318,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#findField(java.lang.Object, java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testFindField__Object_String() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -342,7 +342,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#findStaticField(java.lang.Object, java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testFindStaticField__Object_String() {
final ExecEnv env = getFixture();
@@ -358,7 +358,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#findRule(java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testFindRule__String() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -378,7 +378,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#findType(java.lang.String, java.lang.String)
- * @generated
+ * @generated NOT
*/
public void testFindType__String_String() {
final ExecEnv env = getFixture();
@@ -430,7 +430,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getRules()
- * @generated
+ * @generated NOT
*/
public void testGetRules() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -451,7 +451,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getModelOf(org.eclipse.emf.ecore.EObject)
- * @generated
+ * @generated NOT
*/
public void testGetModelOf__EObject() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -483,7 +483,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getModelID(org.eclipse.m2m.atl.emftvm.Model)
- * @generated
+ * @generated NOT
*/
public void testGetModelID__Model() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -511,7 +511,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#queueForDelete(org.eclipse.emf.ecore.EObject, org.eclipse.m2m.atl.emftvm.util.StackFrame)
- * @generated
+ * @generated NOT
*/
public void testQueueForDelete__EObject_StackFrame() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -548,7 +548,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#deleteQueue()
- * @generated
+ * @generated NOT
*/
public void testDeleteQueue() {
// already tested in testQueueForDelete__EObject_StackFrame
@@ -559,7 +559,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getInputModelOf(org.eclipse.emf.ecore.EObject)
- * @generated
+ * @generated NOT
*/
public void testGetInputModelOf__EObject() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -591,7 +591,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getInoutModelOf(org.eclipse.emf.ecore.EObject)
- * @generated
+ * @generated NOT
*/
public void testGetInoutModelOf__EObject() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
@@ -623,7 +623,7 @@ public class ExecEnvTest extends TestCase {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.m2m.atl.emftvm.ExecEnv#getOutputModelOf(org.eclipse.emf.ecore.EObject)
- * @generated
+ * @generated NOT
*/
public void testGetOutputModelOf__EObject() {
final ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
diff --git a/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/GetSuperTest.java b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/GetSuperTest.java
new file mode 100644
index 00000000..cd5f534d
--- /dev/null
+++ b/tests/org.eclipse.m2m.atl.emftvm.tests/src/org/eclipse/m2m/atl/emftvm/tests/GetSuperTest.java
@@ -0,0 +1,71 @@
+/**
+ * (C) 2011 Dennis Wagelaar, Vrije Universiteit Brussel
+ */
+package org.eclipse.m2m.atl.emftvm.tests;
+
+import junit.textui.TestRunner;
+
+import org.eclipse.m2m.atl.emftvm.EmftvmFactory;
+import org.eclipse.m2m.atl.emftvm.GetSuper;
+
+/**
+ * <!-- begin-user-doc -->
+ * A test case for the model object '<em><b>Get Super</b></em>'.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class GetSuperTest extends FieldInstructionTest {
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static void main(String[] args) {
+ TestRunner.run(GetSuperTest.class);
+ }
+
+ /**
+ * Constructs a new Get Super test case with the given name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GetSuperTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Returns the fixture for this Get Super test case.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected GetSuper getFixture() {
+ return (GetSuper)fixture;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see junit.framework.TestCase#setUp()
+ * @generated
+ */
+ @Override
+ protected void setUp() throws Exception {
+ setFixture(EmftvmFactory.eINSTANCE.createGetSuper());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see junit.framework.TestCase#tearDown()
+ * @generated
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ setFixture(null);
+ }
+
+} //GetSuperTest
diff --git a/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestLib.atl b/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestLib.atl
index d9cb0a46..e566bd52 100644
--- a/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestLib.atl
+++ b/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestLib.atl
@@ -15,3 +15,9 @@ helper context OclAny def : encode() : String =
helper context String def : encode() : String =
self.replaceAll('\\s+', ' ')
.replaceAll('"', '');
+
+helper context EMFTVM!NamedElement def : testProp : Boolean =
+ (not self.name.oclIsUndefined()).debug('TestLib::NamedElement.testProp');
+
+helper context EMFTVM!Operation def : testProp : Boolean =
+ super.testProp.debug('TestLib::Operation.testProp'); \ No newline at end of file
diff --git a/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestQuery.atl b/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestQuery.atl
index 8abe32a7..cda35572 100644
--- a/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestQuery.atl
+++ b/tests/org.eclipse.m2m.atl.emftvm.tests/test-data/TestQuery.atl
@@ -1,7 +1,7 @@
-- @atlcompiler emftvm
-- @nsURI EMFTVM=http://www.eclipse.org/m2m/atl/2011/EMFTVM
-- Tests ATL compilation strategy
-query TestQuery = EMFTVM!Operation.allInstances()->select(r|r.test()).debug('TestQuery');
+query TestQuery = EMFTVM!Operation.allInstances()->select(r|r.test() or r.testProp).debug('TestQuery');
uses TestLib;
uses NativeTest;

Back to the top