Skip to content

Commit

Permalink
Merge branch 'master' into fixed-tgg-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyanjorin authored Jun 22, 2018
2 parents 4469bfe + 472cfb2 commit 596359e
Show file tree
Hide file tree
Showing 33 changed files with 1,014 additions and 664 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ refines createCharacter {
}
}

/**
* Creates another character, but not on an exit platform.
*/
rule createCharacterOfColorOnEmptyPlatform
refines createCharacterOfColor
when noOtherCharacterOnPlatform

condition noOtherCharacterOnPlatform = forbid otherCharacterOnPlatform

abstract pattern otherCharacterOnPlatform {
platform: Platform {
-charactersStandingOn -> anotherCharacter
}

anotherCharacter: Character
}

/**
* Creates a blue character.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,12 @@ condition platformHasAtMostOneConnection = forbid findPlatformWithTwoConnections

condition platformHasExactlyOneConnection = platformHasAtLeastOneConnection
&& platformHasAtMostOneConnection

/**
* Finds a platform which is a neighbor of itself.
*/
pattern findPlatformSelfNeighbor {
platform: Platform {
-neighbors -> platform
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ refines findFamily {
}

/**
* Finds any family not named Simpson.
* Finds a family not named Simpson.
*/
pattern findFamilyButNotSimpson
refines findFamily {
Expand All @@ -74,6 +74,46 @@ refines findFamily {
}
}

/**
* Finds a family with a name lexicographically greater or equal than "Simpson".
*/
pattern findFamilyWithNameGreaterOrEqualThanSimpson
refines findFamily {
family: Family {
.name >= "Simpson"
}
}

/**
* Finds a family with a name lexicographically greater than "Simpson".
*/
pattern findFamilyWithNameGreaterThanSimpson
refines findFamily {
family: Family {
.name > "Simpson"
}
}

/**
* Finds a family with a name lexicographically smaller or equal than "Simpson".
*/
pattern findFamilyWithNameSmallerOrEqualThanSimpson
refines findFamily {
family: Family {
.name <= "Simpson"
}
}

/**
* Finds a family with a name lexicographically smaller than "Simpson".
*/
pattern findFamilyWithNameSmallerThanSimpson
refines findFamily {
family: Family {
.name < "Simpson"
}
}

/**
* Finds a family with the given name.
*/
Expand Down Expand Up @@ -115,6 +155,27 @@ refines findFamily {
}
}

/**
* Finds a family with a name which is lexicographically smaller the given name.
*/
pattern findFamilyWithNameSmallerThan(name: EString)
refines findFamily {
family: Family {
.name < param::name
}
}

/**
* Finds a family with a name which is lexicographically smaller than
* or equal to the given name.
*/
pattern findFamilyWithNameSmallerOrEqualThan(name: EString)
refines findFamily {
family: Family {
.name <= param::name
}
}

/**
* Renames a family.
*/
Expand All @@ -124,3 +185,18 @@ rule renameFamily(oldName: EString, newName: EString) {
.name := param::newName
}
}

/**
* Find three families of the same name.
*/
pattern findThreeFamiliesOfTheSameName {
family1: Family

family2: Family {
.name == family1.name
}

family3: Family {
.name == family1.name
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,49 @@ pattern findPerson {
/**
* Finds a male.
*/
pattern findMale {
pattern findMale
refines findPerson {
person: Male
}

/**
* Finds a female.
*/
pattern findFemale {
pattern findFemale
refines findPerson {
person: Female
}

/**
* Finds the first person when ordering the persons in the register alphabetically.
*/
pattern findFirstPerson
refines findPerson
when noPersonWithSmallerName

condition noPersonWithSmallerName = forbid anotherPersonWithSmallerName

abstract pattern anotherPersonWithSmallerName
refines findPerson {
anotherPerson: Person {
.name < person.name
}
}

/**
* Finds the last person when ordering the persons in the register alphabetically.
*/
pattern findLastPerson
refines findPerson
when noPersonWithGreaterName

condition noPersonWithGreaterName = forbid anotherPersonWithGreaterName

abstract pattern anotherPersonWithGreaterName
refines findPerson {
person: Person {
.name < anotherPerson.name
}

anotherPerson: Person
}
26 changes: 26 additions & 0 deletions testsuites/TestsuiteGT/TestsuiteGT_CodeCoverage.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/TestsuiteGT"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.eclemma.core.SCOPE_IDS">
<listEntry value="=org.emoflon.ibex.common/xtend-gen"/>
<listEntry value="=org.emoflon.ibex.gt.democles/src"/>
<listEntry value="=org.emoflon.ibex.gt/gen"/>
<listEntry value="=org.emoflon.ibex.gt/src"/>
<listEntry value="=org.emoflon.ibex.gt/xtend-gen"/>
<listEntry value="=org.emoflon.ibex.common/gen"/>
<listEntry value="=org.emoflon.ibex.common/src"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=TestsuiteGT"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TestsuiteGT"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
</launchConfiguration>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.emoflon.ibex.gt.api.GraphTransformationApp;

public abstract class GTPerformanceTest {
protected static final String WORKSPACE_PATH = "../../gt-rules/";
protected static final String RESULT_DIRECTORY = "performance/";
private static final String CSV_SEPARATOR = ";";
private static final String CSV_LINE_DELIMITER = "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ protected List<String> getColumnNames() {

@Override
public void run(int modelSize) {
SheRememberedCaterpillarsGraphTransformationDemoclesApp app = new SheRememberedCaterpillarsGraphTransformationDemoclesApp();
SheRememberedCaterpillarsGraphTransformationDemoclesApp app = new SheRememberedCaterpillarsGraphTransformationDemoclesApp(
WORKSPACE_PATH);

// Initialization.
long initStart = System.nanoTime();
app.createModel(createDateURI(modelSize));
app.setWorkspacePath("../../gt-rules/");
SheRememberedCaterpillarsGraphTransformationAPI api = app.initAPI();
long initEnd = System.nanoTime();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ protected List<String> getColumnNames() {
@Override
protected void prepare(int[] modelSizes) {
for (int modelSize : modelSizes) {
SheRememberedCaterpillarsGraphTransformationDemoclesApp app = new SheRememberedCaterpillarsGraphTransformationDemoclesApp();
SheRememberedCaterpillarsGraphTransformationDemoclesApp app = new SheRememberedCaterpillarsGraphTransformationDemoclesApp(WORKSPACE_PATH);
app.createModel(createURI(modelSize));
app.setWorkspacePath("../../gt-rules/");
SheRememberedCaterpillarsGraphTransformationAPI api = app.initAPI();
api.createGame().apply();
for (int i = 1; i <= modelSize; i++) {
Expand All @@ -52,12 +51,11 @@ private URI createURI(final int modelSize) {

@Override
public void run(int modelSize) {
SheRememberedCaterpillarsGraphTransformationDemoclesApp app = new SheRememberedCaterpillarsGraphTransformationDemoclesApp();
SheRememberedCaterpillarsGraphTransformationDemoclesApp app = new SheRememberedCaterpillarsGraphTransformationDemoclesApp(WORKSPACE_PATH);

// Initialization.
long initStart = System.nanoTime();
app.loadModel(createURI(modelSize));
app.setWorkspacePath("../../gt-rules/");
SheRememberedCaterpillarsGraphTransformationAPI api = app.initAPI();
long initEnd = System.nanoTime();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ protected String getTestName() {

@Override
public void run(int modelSize) {
SimpleFamiliesGraphTransformationDemoclesApp app = new SimpleFamiliesGraphTransformationDemoclesApp();
SimpleFamiliesGraphTransformationDemoclesApp app = new SimpleFamiliesGraphTransformationDemoclesApp(
WORKSPACE_PATH);

// Initialization.
long initStart = System.nanoTime();
app.createModel(createDateURI(modelSize));
app.setWorkspacePath("../../gt-rules/");
SimpleFamiliesGraphTransformationAPI api = app.initAPI();
long initEnd = System.nanoTime();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<SimpleFamilies:FamilyRegister
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:SimpleFamilies="platform:/resource/SimpleFamilies/model/SimpleFamilies.ecore">
<families
name="Simpson"/>
<families
name="Watson"/>
<families
name="Simpson"/>
<families
name="Simpson"/>
</SimpleFamilies:FamilyRegister>
27 changes: 27 additions & 0 deletions testsuites/TestsuiteGT/resources/SimplePersons/PersonRegister.xmi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<SimplePersons:PersonRegister
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SimplePersons="platform:/resource/SimplePersons/model/SimplePersons.ecore">
<persons xsi:type="SimplePersons:Female"
name="Adams, Adriana"/>
<persons xsi:type="SimplePersons:Male"
name="Adams, Alexander"/>
<persons xsi:type="SimplePersons:Female"
name="Jackson, James"/>
<persons xsi:type="SimplePersons:Male"
name="Jackson, Jason"/>
<persons xsi:type="SimplePersons:Male"
name="Miller, Martin"/>
<persons xsi:type="SimplePersons:Male"
name="Owen, Oliver"/>
<persons xsi:type="SimplePersons:Female"
name="Owen, Olivia"/>
<persons xsi:type="SimplePersons:Male"
name="Smith, Samuel"/>
<persons xsi:type="SimplePersons:Female"
name="Smith, Sally"/>
<persons xsi:type="SimplePersons:Female"
name="Smith, Sarah"/>
</SimplePersons:PersonRegister>
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
package org.emoflon.ibex.gt.testsuite.BPMN;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.emoflon.ibex.common.operational.IContextPatternInterpreter;
import org.emoflon.ibex.gt.testsuite.GTTestCase;
import org.emoflon.ibex.gt.testsuite.GTAppTestCase;

import BPMNGraphTransformation.api.BPMNGraphTransformationAPI;
import bpmn2.Bpmn2Package;
import bpmn2InstanceRepresentation.Bpmn2InstanceRepresentationPackage;
import BPMNGraphTransformation.api.BPMNGraphTransformationApp;

/**
* Abstract test class for the BPMN Graph Transformation API. All tests for this
* API should inherit from this class.
*/
public class BPMNAbstractTest extends GTTestCase<BPMNGraphTransformationAPI> {
public class BPMNAbstractTest extends GTAppTestCase<BPMNGraphTransformationApp, BPMNGraphTransformationAPI> {

@Override
protected String getTestName() {
return "BPMN";
}

@Override
protected BPMNGraphTransformationAPI getAPI(final IContextPatternInterpreter engine, final ResourceSet model) {
return new BPMNGraphTransformationAPI(engine, model, GTTestCase.workspacePath);
}

@Override
protected Map<String, EPackage> getMetaModelPackages() {
HashMap<String, EPackage> map = new HashMap<String, EPackage>();
map.put(Bpmn2Package.eNS_URI, Bpmn2Package.eINSTANCE);
map.put(Bpmn2InstanceRepresentationPackage.eNS_URI, Bpmn2InstanceRepresentationPackage.eINSTANCE);
return map;
protected BPMNGraphTransformationApp getApp() {
return new BPMNGraphTransformationApp(initEngine(), workspacePath);
}
}
Loading

0 comments on commit 596359e

Please sign in to comment.