Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions TODOLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
A faire :

TESTS:
- Pretty Printer (30/11/2015)
- Table des symboles (3/12/2015)
- Fuites mémoires (INDEFINI)
_FONCTION GC : Demande au JavaScript l'état du garbage Collector

- Test de stress (4/12/2015)

TABLE DES SYMBOLES :

-Ecrire la troisième table des symboles

5 changes: 5 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
.
13 changes: 13 additions & 0 deletions me.qfdk.esir.wh.tests.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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="/me.qfdk.esir.wh.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=me.qfdk.esir.wh.tests"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="me.qfdk.esir.wh.tests"/>
</launchConfiguration>
10 changes: 10 additions & 0 deletions me.qfdk.esir.wh.tests/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="/home/aburam/Téléchargements/junit-4.12.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
34 changes: 34 additions & 0 deletions me.qfdk.esir.wh.tests/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>me.qfdk.esir.wh.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
7 changes: 7 additions & 0 deletions me.qfdk.esir.wh.tests/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
25 changes: 25 additions & 0 deletions me.qfdk.esir.wh.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: me.qfdk.esir.wh.tests
Bundle-Vendor: My Company
Bundle-Version: 1.0.0.qualifier
Bundle-SymbolicName: me.qfdk.esir.wh.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: me.qfdk.esir.wh,
me.qfdk.esir.wh.ui,
org.eclipse.core.runtime,
org.eclipse.xtext.junit4,
org.eclipse.xtext.xbase.lib,
org.eclipse.ui.workbench;resolution:=optional,
org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional
Import-Package: org.apache.log4j,
org.junit;version="4.5.0",
org.junit.runner;version="4.5.0",
org.junit.runner.manipulation;version="4.5.0",
org.junit.runner.notification;version="4.5.0",
org.junit.runners;version="4.5.0",
org.junit.runners.model;version="4.5.0",
org.hamcrest.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: me.qfdk.esir.wh,
me.qfdk.esir.wh.tests
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions me.qfdk.esir.wh.tests/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/,\
src-gen/,\
xtend-gen/
bin.includes = META-INF/,\
.
13 changes: 13 additions & 0 deletions me.qfdk.esir.wh.tests/me.qfdk.esir.wh.tests.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?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="/me.qfdk.esir.wh.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=me.qfdk.esir.wh.tests"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="me.qfdk.esir.wh.tests"/>
</launchConfiguration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* generated by Xtext
*/
package me.qfdk.esir.wh;

import org.eclipse.xtext.junit4.GlobalRegistries;
import org.eclipse.xtext.junit4.GlobalRegistries.GlobalStateMemento;
import org.eclipse.xtext.junit4.IInjectorProvider;
import org.eclipse.xtext.junit4.IRegistryConfigurator;

import com.google.inject.Injector;

public class WhInjectorProvider implements IInjectorProvider, IRegistryConfigurator {

protected GlobalStateMemento stateBeforeInjectorCreation;
protected GlobalStateMemento stateAfterInjectorCreation;
protected Injector injector;

static {
GlobalRegistries.initializeDefaults();
}

@Override
public Injector getInjector()
{
if (injector == null) {
stateBeforeInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
this.injector = internalCreateInjector();
stateAfterInjectorCreation = GlobalRegistries.makeCopyOfGlobalState();
}
return injector;
}

protected Injector internalCreateInjector() {
return new WhStandaloneSetup().createInjectorAndDoEMFRegistration();
}

@Override
public void restoreRegistry() {
stateBeforeInjectorCreation.restoreGlobalState();
}

@Override
public void setupRegistry() {
getInjector();
stateAfterInjectorCreation.restoreGlobalState();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* generated by Xtext
*/
package me.qfdk.esir.wh;

import org.eclipse.xtext.junit4.IInjectorProvider;

import com.google.inject.Injector;

public class WhUiInjectorProvider implements IInjectorProvider {

@Override
public Injector getInjector() {
return me.qfdk.esir.wh.ui.internal.WhActivator.getInstance().getInjector("me.qfdk.esir.wh.Wh");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package me.qfdk.esir.wh.tests

import com.google.inject.Inject
import me.qfdk.esir.wh.WhInjectorProvider
import me.qfdk.esir.wh.wh.wh
import org.eclipse.xtext.generator.IFileSystemAccess
import org.eclipse.xtext.generator.IGenerator
import org.eclipse.xtext.generator.InMemoryFileSystemAccess
import org.eclipse.xtext.generator.JavaIoFileSystemAccess
import org.eclipse.xtext.junit4.InjectWith
import org.eclipse.xtext.junit4.XtextRunner
import org.eclipse.xtext.junit4.util.ParseHelper
import org.junit.Test
import org.junit.runner.RunWith

import static org.junit.Assert.*

@RunWith(typeof(XtextRunner))
@InjectWith(typeof(WhInjectorProvider))
class PrettyPrinterTest {
@Inject IGenerator underTest
@Inject IGenerator underTestPrettyPrint
@Inject ParseHelper<wh> parseHelper

@Test
def testDefinition() {
val model = parseHelper.parse('''
function bonjour : read X,Y,Z,E%nop%write Z
''')
val fsa = new InMemoryFileSystemAccess()
underTest.doGenerate(model.eResource, fsa)
println(fsa.files)
assertEquals(
'''
function bonjour:
read X, Y, Z, E
%
nop
%
write Z

'''.toString, fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString)

assertTrue(fsa.files.containsKey(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp"))
assertTrue(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains("function "))
assertTrue(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains(": \nread "))
assertTrue(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains("read "))
assertTrue(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains("write "))
assertTrue(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains("%"))
assertFalse(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains(" write "))
assertFalse(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains(" read "))
assertFalse(fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString.contains("% "))
}

@Inject
private JavaIoFileSystemAccess fileAccess;

@Test
def testDoublePrettyPrinter() {

fileAccess.setOutputPath(".");

val model = parseHelper.parse(fileAccess.readTextFile("test.wh").toString());
val fsa = new InMemoryFileSystemAccess()
underTest.doGenerate(model.eResource, fsa)
//val model = parseHelper.parse(fileAccess.readTextFile("sth.wh").toString())
println(fsa.files+"\n");
val parserPrettyPrint=fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString();
val modelPrettyPrint = parseHelper.parse(parserPrettyPrint);
assertEquals(parserPrettyPrint.toString, fsa.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString)

println("Double pretty print"+"\n");
val f = new InMemoryFileSystemAccess()

underTestPrettyPrint.doGenerate(modelPrettyPrint.eResource, f);
println(f.files);
assertEquals(parserPrettyPrint.toString, f.files.get(IFileSystemAccess::DEFAULT_OUTPUT+"sth.whpp").toString)
}
}
9 changes: 9 additions & 0 deletions me.qfdk.esir.wh.tests/test.wh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function bonjour : read X,Y,Z,E%nop%write Z
function li : read Y,TRUC%nop;for e do nop od%write X,Yhufkshfid!
function allo : read Z,Salifou!%nop;nop
;nop;while truc do while t do nop;if x then if e then nop else foreach z in a do nop;nop od fi;nop fi od od;
nop%write Youssouf!,Truc



function ali : read Steven!,Mohammed%nop;nop;nop;if test then nop fi; if test2 then nop else nop;nop fi%write Esir,ESIR_RIDOUX!
Binary file not shown.
Binary file not shown.
Loading