From 1b54f1147b4de985ae2254151ab224e6544e68ba Mon Sep 17 00:00:00 2001 From: Jan Belle Date: Sun, 5 May 2019 22:26:00 +0200 Subject: [generator.tests] Migrate tests to new import system Bug 545235 Change-Id: I5f349f7ab6cf12e23cfc68323987e24c998ae263 --- .../model/PingPong/PingPong.room | 8 +- gradle/etGenerator.gradle | 14 +- gradle/etTest.gradle | 9 +- gradle/etUnitConverter.gradle | 14 +- .../eTrice-rt.launch | 2 +- .../etrice/generator/base/args/IntegerOption.java | 30 - .../etrice/generator/base/args/PathOption.java | 26 + .../generator/base/args/StringArrayOption.java | 27 - .../generator/base/cli/CommandLineParser.java | 21 +- .../etrice/generator/base/cli/HelpFormatter.java | 3 +- .../generator/base/cli/ICommandLineParser.java | 6 +- .../etrice/generator/base/cli/IHelpFormatter.java | 4 +- .../base/setup/GeneratorApplicationOptions.java | 9 +- runtime/org.eclipse.etrice.modellib.c/build.gradle | 4 + runtime/org.eclipse.etrice.modellib.c/modelpath | 1 + .../org.eclipse.etrice.modellib.cpp/build.gradle | 4 + runtime/org.eclipse.etrice.modellib.cpp/modelpath | 1 + .../org.eclipse.etrice.modellib.java/build.gradle | 4 + runtime/org.eclipse.etrice.modellib.java/modelpath | 1 + .../build.gradle | 5 + .../org.eclipse.etrice.generator.c.tests/modelpath | 2 + .../models/SendingDataTest.room | 631 +++++++++------------ .../models/StaticConfigTest.config | 8 +- .../models/StaticConfigTest.etmap | 8 +- .../models/StaticConfigTest.room | 420 +++++++------- ...clipse.etrice.generator.c.tests make.xml.launch | 38 -- .../build.gradle | 13 +- .../common.xml | 219 ------- .../modelpath | 2 + .../models/ActorCommunicationTest.room | 255 ++++----- .../models/ChoicePointTest.room | 173 ++---- .../models/ChoicePointTestExtended.room | 416 ++++++-------- .../models/CompileTest.room | 31 + .../models/CompileTests.room | 37 -- .../models/ContinuationTransitionTest.room | 168 ++---- .../models/DataDrivenTest.room | 100 ++-- .../models/DetailExpressionEnum.room | 2 +- .../models/DetailExpressionTest.room | 14 +- .../models/EnumTest.room | 5 +- .../models/GenericPhysical.etphys | 2 +- .../models/HandlerTest.room | 228 +++----- .../models/OperationInheritanceTest.room | 117 ++-- .../models/PingPongThreadReplPortTest.etmap | 4 +- .../models/PingPongThreadReplPortTest.room | 101 ++-- .../models/PingPongThreadTest.etmap | 5 +- .../models/PingPongThreadTest.room | 109 ++-- .../models/StatemachineInterfaceInheritedTest.room | 12 +- .../models/StatemachineInterfaceTest.room | 6 +- .../models/SubSystemUserCodeTest.room | 5 +- .../models/VarargsTest.room | 6 +- .../models/sendingData/SendingDataTestCpp.room | 605 -------------------- .../models/sendingData/SendingDataTestJava.room | 586 ------------------- .../build.gradle | 5 + .../modelpath | 2 + .../models/InitializationTest.room | 131 ++--- .../models/SendingDataTest.room | 623 +++++++++----------- ...ipse.etrice.generator.cpp.tests make.xml.launch | 38 -- .../.project | 6 + .../build.gradle | 5 + .../make.xml | 130 ----- .../modelpath | 2 + .../models/DynamicActorTest1.etmap | 5 +- .../models/DynamicActorTest1.room | 127 ++--- .../models/DynamicActorTest2.etmap | 4 +- .../models/DynamicActorTest2.room | 183 +++--- .../models/DynamicActorTest3.room | 128 ++--- .../models/DynamicActorTest4.room | 69 +-- .../models/DynamicActorTest5.room | 106 ++-- .../models/DynamicActorTest6.room | 127 ++--- .../models/DynamicActorTest7.etmap | 5 +- .../models/DynamicActorTest7.room | 245 ++++---- .../models/DynamicConfigTest.config | 4 +- .../models/DynamicConfigTest.etmap | 8 +- .../models/DynamicConfigTest.room | 245 ++++---- .../models/SendingDataTest.room | 591 +++++++++---------- .../models/StaticConfigTest.config | 8 +- .../models/StaticConfigTest.etmap | 8 +- .../models/StaticConfigTest.room | 367 ++++++------ .../models/StoreRestoreTest.room | 157 +++-- .../models/TCPTest.room | 155 +++-- ...pse.etrice.generator.java.tests make.xml.launch | 44 -- .../targetModels/DynamicActorTest1.room | 182 ------ .../targetModels/DynamicActorTest2.room | 236 -------- .../targetModels/DynamicActorTest3.room | 235 -------- .../targetModels/DynamicActorTest4.room | 97 ---- .../targetModels/DynamicActorTest5.room | 149 ----- .../targetModels/DynamicActorTest6.room | 243 -------- .../targetModels/DynamicActorTest7.room | 375 ------------ .../targetModels/StoreRestore.room | 217 ------- .../targetModels/TCPTest.room | 160 ------ .../build.gradle | 5 +- .../build.gradle | 5 +- 92 files changed, 2826 insertions(+), 7127 deletions(-) delete mode 100644 plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/IntegerOption.java create mode 100644 plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/PathOption.java delete mode 100644 plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/StringArrayOption.java create mode 100644 runtime/org.eclipse.etrice.modellib.c/modelpath create mode 100644 runtime/org.eclipse.etrice.modellib.cpp/modelpath create mode 100644 runtime/org.eclipse.etrice.modellib.java/modelpath create mode 100644 tests/org.eclipse.etrice.generator.c.tests/modelpath delete mode 100644 tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/common.xml create mode 100644 tests/org.eclipse.etrice.generator.common.tests/modelpath create mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/CompileTest.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room delete mode 100644 tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room create mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/modelpath delete mode 100644 tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/make.xml create mode 100644 tests/org.eclipse.etrice.generator.java.tests/modelpath delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room delete mode 100644 tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room diff --git a/examples/org.eclipse.etrice.tutorials.java.aspecttrace/model/PingPong/PingPong.room b/examples/org.eclipse.etrice.tutorials.java.aspecttrace/model/PingPong/PingPong.room index 511b10917..d7e23c1b5 100644 --- a/examples/org.eclipse.etrice.tutorials.java.aspecttrace/model/PingPong/PingPong.room +++ b/examples/org.eclipse.etrice.tutorials.java.aspecttrace/model/PingPong/PingPong.room @@ -30,9 +30,7 @@ RoomModel PingPong_Model { } } State SendingPing { - entry { - "receiver.ping();" - } + entry '''receiver.ping();''' } State ReceivedPong } @@ -55,9 +53,7 @@ RoomModel PingPong_Model { } State WaingForPing State ReceivedPing { - entry { - "sender.pong();" - } + entry '''sender.pong();''' } } } diff --git a/gradle/etGenerator.gradle b/gradle/etGenerator.gradle index 7bceef1ec..e448c7502 100644 --- a/gradle/etGenerator.gradle +++ b/gradle/etGenerator.gradle @@ -2,6 +2,10 @@ configurations { etrice_c etrice_cpp etrice_java + + modelpath_c + modelpath_cpp + modelpath_java } dependencies { @@ -22,11 +26,13 @@ ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] return tasks.create(name: name, type: JavaExec) { main = "org.eclipse.etrice.generator.${lang}.Main" classpath = configurations."etrice_$lang" - args '-clean', '-msc_instr', '-genDir', genDir + args '-clean', '-msc_instr' + args '-genDir', genDir args options + def modelpath = configurations."modelpath_$lang" + if(!modelpath.isEmpty()) { + args '-modelpath', modelpath.asPath + } args models - // not incremental (modellib input files missing) - // inputs.files models - // outputs.dir genDir } } \ No newline at end of file diff --git a/gradle/etTest.gradle b/gradle/etTest.gradle index 25f53cac9..af5bed904 100644 --- a/gradle/etTest.gradle +++ b/gradle/etTest.gradle @@ -7,7 +7,6 @@ def outputDir = 'log' def srcGenDir = 'src-gen' clean.delete srcGenDir, outputDir -//clean.delete outputDir def getMainClass(String genDir) { // search for SubSystemRunner java file @@ -40,8 +39,6 @@ ext.createTest = { lang, name, models, options = [] -> def etuFile = "$workingDir/log/${nameCap}.etu" def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) - generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" - // generateTask.enabled = false def runTask @@ -74,10 +71,9 @@ ext.createTest = { lang, name, models, options = [] -> def exeFile = "$buildDir/exe/$testName/$testName" runTask = tasks.create(name: "run$testNameCap", type: Exec) { dependsOn "${testName}Executable" - commandLine exeFile, '-run_as_test' + executable = exeFile + args '-run_as_test' it.workingDir = workingDir - // inputs.file exeFile - // outputs.file etuFile } } @@ -98,7 +94,6 @@ ext.createTest = { lang, name, models, options = [] -> classpath = testSourceSet.runtimeClasspath args '-run_as_test' it.workingDir = workingDir - // outputs.file etuFile doFirst { main = getMainClass(genDir) } } diff --git a/gradle/etUnitConverter.gradle b/gradle/etUnitConverter.gradle index cd1369bde..fb4c9ea06 100644 --- a/gradle/etUnitConverter.gradle +++ b/gradle/etUnitConverter.gradle @@ -1,6 +1,10 @@ +configurations { + etunit +} -def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' -evaluationDependsOn(etUnitConverter) +dependencies { + etunit project(':plugins:org.eclipse.etrice.etunit.converter') +} /** * Creates a tasks that converts etu files to xml files @@ -11,9 +15,9 @@ evaluationDependsOn(etUnitConverter) ext.createEtUnitConverterTask = { name, etuFiles, options = [] -> def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } - return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { - main = project(etUnitConverter).mainClassName - classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath + return tasks.create(name: name, type: JavaExec) { + main = 'org.eclipse.etrice.etunit.converter.EtUnitReportConverter' + classpath = configurations.etunit args options args etuFiles inputs.files etuFiles diff --git a/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch b/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch index 98fc0beb4..6e4b0ece6 100644 --- a/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch +++ b/plugins/org.eclipse.etrice.core.room.ui/eTrice-rt.launch @@ -13,7 +13,7 @@ - + diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/IntegerOption.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/IntegerOption.java deleted file mode 100644 index b3cec8e30..000000000 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/IntegerOption.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2018 protos software gmbh (http://www.protos.de). -* All rights reserved. -* -* This program and the accompanying materials are made -* available under the terms of the Eclipse Public License 2.0 -* which is available at https://www.eclipse.org/legal/epl-2.0/ -* -* SPDX-License-Identifier: EPL-2.0 -* -* CONTRIBUTORS: -* Jan Belle (initial contribution) -* - *******************************************************************************/ - -package org.eclipse.etrice.generator.base.args; - -/** - * Describes an option that takes an {@link Integer} value. - */ -public class IntegerOption extends Option { - - /** - * @see Option#Option - */ - public IntegerOption(String group, String name, String argumentName, String description, int defaultValue) { - super(Integer.class, group, name, argumentName, description, defaultValue); - } - -} diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/PathOption.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/PathOption.java new file mode 100644 index 000000000..41efa7a70 --- /dev/null +++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/PathOption.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2019 protos software gmbh (http://www.protos.de). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * CONTRIBUTORS: + * Jan Belle (initial contribution) + * + *******************************************************************************/ + +package org.eclipse.etrice.generator.base.args; + +public class PathOption extends Option { + + /** + * @see Option#Option + */ + public PathOption(String group, String name, String argumentName, String description, String[] defaultValue) { + super(String[].class, group, name, argumentName, description, defaultValue); + } + +} diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/StringArrayOption.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/StringArrayOption.java deleted file mode 100644 index 5e09e4f61..000000000 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/args/StringArrayOption.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2018 protos software gmbh (http://www.protos.de). -* All rights reserved. -* -* This program and the accompanying materials are made -* available under the terms of the Eclipse Public License 2.0 -* which is available at https://www.eclipse.org/legal/epl-2.0/ -* -* SPDX-License-Identifier: EPL-2.0 -* -* CONTRIBUTORS: -* Jan Belle (initial contribution) -* - *******************************************************************************/ - -package org.eclipse.etrice.generator.base.args; - -public class StringArrayOption extends Option { - - /** - * @see Option#Option - */ - public StringArrayOption(String group, String name, String argumentName, String description, String[] defaultValue) { - super(String[].class, group, name, argumentName, description, defaultValue); - } - -} diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/CommandLineParser.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/CommandLineParser.java index 539bfb9f7..9e6e65271 100644 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/CommandLineParser.java +++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/CommandLineParser.java @@ -15,14 +15,18 @@ package org.eclipse.etrice.generator.base.cli; +import java.io.File; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import org.eclipse.etrice.generator.base.args.Arguments; +import org.eclipse.etrice.generator.base.args.BooleanOption; +import org.eclipse.etrice.generator.base.args.EnumOption; import org.eclipse.etrice.generator.base.args.Option; import org.eclipse.etrice.generator.base.args.Options; -import org.eclipse.etrice.generator.base.args.StringArrayOption; +import org.eclipse.etrice.generator.base.args.PathOption; +import org.eclipse.etrice.generator.base.args.StringOption; /** * Simple implementation of a command line parser. @@ -39,7 +43,7 @@ public class CommandLineParser implements ICommandLineParser { } @Override - public Arguments parseArgs(Options options, StringArrayOption defaultOption, List args) throws CommandLineParseException { + public Arguments parseArgs(Options options, Option defaultOption, List args) throws CommandLineParseException { Arguments parsedArgs = new Arguments(options); List nArgs = normalize(args); ListIterator iterator = nArgs.listIterator(); @@ -81,23 +85,20 @@ public class CommandLineParser implements ICommandLineParser { } private Object parseValue(Option opt, ListIterator iterator) throws CommandLineParseException { - Class type = opt.getType(); - - if(type == Boolean.class) { + if(opt instanceof BooleanOption) { return true; } if(iterator.hasNext()) { String str = iterator.next(); - if(type == String.class) { + if(opt instanceof StringOption) { return str; } - else if(type == String[].class) { - String[] strArray = str.split(";"); - return strArray; + else if(opt instanceof PathOption) { + return str.split(File.pathSeparator); } - else if(type.isEnum()) { + else if(opt instanceof EnumOption) { return parseEnum(opt, str); } diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/HelpFormatter.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/HelpFormatter.java index e1aa1fafd..0b578250e 100644 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/HelpFormatter.java +++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/HelpFormatter.java @@ -19,7 +19,6 @@ import java.util.Formatter; import org.eclipse.etrice.generator.base.args.Option; import org.eclipse.etrice.generator.base.args.Options; -import org.eclipse.etrice.generator.base.args.StringArrayOption; /** * Simple implementation for command line help formatting. @@ -30,7 +29,7 @@ public class HelpFormatter implements IHelpFormatter { } @Override - public String getHelp(String name, Options options, StringArrayOption defaultOption) { + public String getHelp(String name, Options options, Option defaultOption) { try(Formatter formatter = new Formatter()) { formatter.format("%s usage: [options] %s...%n", name, defaultOption.getName()); formatter.format("Options:%n"); diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/ICommandLineParser.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/ICommandLineParser.java index f3c3759e4..e17b55af1 100644 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/ICommandLineParser.java +++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/ICommandLineParser.java @@ -19,8 +19,8 @@ import java.util.Arrays; import java.util.List; import org.eclipse.etrice.generator.base.args.Arguments; +import org.eclipse.etrice.generator.base.args.Option; import org.eclipse.etrice.generator.base.args.Options; -import org.eclipse.etrice.generator.base.args.StringArrayOption; import com.google.inject.ImplementedBy; @@ -37,7 +37,7 @@ public interface ICommandLineParser { * @param defaultOption the option for arguments without option identifier * @param args the command line arguments */ - Arguments parseArgs(Options options, StringArrayOption defaultOption, List args) throws CommandLineParseException; + Arguments parseArgs(Options options, Option defaultOption, List args) throws CommandLineParseException; /** @@ -47,7 +47,7 @@ public interface ICommandLineParser { * @param defaultOption the option to store arguments without identifier * @param args the command line arguments */ - default Arguments parseArgs(Options options, StringArrayOption defaultOption, String[] args) throws CommandLineParseException { + default Arguments parseArgs(Options options, Option defaultOption, String[] args) throws CommandLineParseException { return parseArgs(options, defaultOption, Arrays.asList(args)); } } diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/IHelpFormatter.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/IHelpFormatter.java index ac6a5f791..7a8e42bdb 100644 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/IHelpFormatter.java +++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/cli/IHelpFormatter.java @@ -15,8 +15,8 @@ package org.eclipse.etrice.generator.base.cli; +import org.eclipse.etrice.generator.base.args.Option; import org.eclipse.etrice.generator.base.args.Options; -import org.eclipse.etrice.generator.base.args.StringArrayOption; import com.google.inject.ImplementedBy; @@ -34,6 +34,6 @@ public interface IHelpFormatter { * @param defaultOption the option for arguments without option identifier * @return the help message */ - String getHelp(String name, Options options, StringArrayOption defaultOption); + String getHelp(String name, Options options, Option defaultOption); } diff --git a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorApplicationOptions.java b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorApplicationOptions.java index 31e1f0882..4ebb88e0e 100644 --- a/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorApplicationOptions.java +++ b/plugins/org.eclipse.etrice.generator.base/src/org/eclipse/etrice/generator/base/setup/GeneratorApplicationOptions.java @@ -21,7 +21,7 @@ import org.eclipse.etrice.generator.base.args.BooleanOption; import org.eclipse.etrice.generator.base.args.EnumOption; import org.eclipse.etrice.generator.base.args.IOptionModule; import org.eclipse.etrice.generator.base.args.Option; -import org.eclipse.etrice.generator.base.args.StringArrayOption; +import org.eclipse.etrice.generator.base.args.PathOption; import org.eclipse.etrice.generator.base.args.StringOption; import org.eclipse.etrice.generator.base.logging.Loglevel; @@ -32,18 +32,19 @@ public class GeneratorApplicationOptions implements IOptionModule { public static final String GROUP_APPLICATION = "application"; - public static final StringArrayOption FILES = new StringArrayOption( + public static final Option FILES = new Option( + String[].class, GROUP_APPLICATION, "files", "input files", "input files for the generator", new String[0]); - public static final StringArrayOption MODELPATH = new StringArrayOption( + public static final PathOption MODELPATH = new PathOption( GROUP_APPLICATION, "modelpath", "paths", - "model imported paths separated by ';'", + "model import paths separated by path separators", new String[0]); public static final BooleanOption HELP = new BooleanOption( diff --git a/runtime/org.eclipse.etrice.modellib.c/build.gradle b/runtime/org.eclipse.etrice.modellib.c/build.gradle index ce2e6bd20..2841e2063 100644 --- a/runtime/org.eclipse.etrice.modellib.c/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.c/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'c' apply from: "$rootDir/gradle/publish.gradle" apply from: "$rootDir/gradle/etGenerator.gradle" +dependencies { + modelpath_c files('model') +} + def models = [ 'model/PInterrupt.room', 'model/TcpService.room', diff --git a/runtime/org.eclipse.etrice.modellib.c/modelpath b/runtime/org.eclipse.etrice.modellib.c/modelpath new file mode 100644 index 000000000..0dc9f41d8 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.c/modelpath @@ -0,0 +1 @@ +srcDir model \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle index 2233bd102..abb7bf843 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle @@ -2,6 +2,10 @@ apply plugin: 'cpp' apply from: "$rootDir/gradle/etGenerator.gradle" +dependencies { + modelpath_cpp files('model') +} + def models = [ 'model/TimingService.room' ] diff --git a/runtime/org.eclipse.etrice.modellib.cpp/modelpath b/runtime/org.eclipse.etrice.modellib.cpp/modelpath new file mode 100644 index 000000000..0dc9f41d8 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.cpp/modelpath @@ -0,0 +1 @@ +srcDir model \ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle index 9a5d77227..598f4fd32 100644 --- a/runtime/org.eclipse.etrice.modellib.java/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle @@ -3,6 +3,10 @@ apply plugin: 'java' apply from: "$rootDir/gradle/publish.gradle" apply from: "$rootDir/gradle/etGenerator.gradle" +dependencies { + modelpath_java files('model') +} + def models = [ 'model/ALogService.room', 'model/TcpService.room', diff --git a/runtime/org.eclipse.etrice.modellib.java/modelpath b/runtime/org.eclipse.etrice.modellib.java/modelpath new file mode 100644 index 000000000..0dc9f41d8 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.java/modelpath @@ -0,0 +1 @@ +srcDir model \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/build.gradle b/tests/org.eclipse.etrice.generator.c.tests/build.gradle index 54b58ac41..5b799cd8a 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.c.tests/build.gradle @@ -2,6 +2,11 @@ apply plugin: 'c' apply from: "$rootDir/gradle/etTest.gradle" +dependencies { + modelpath_c project(path: ':runtime:org.eclipse.etrice.modellib.c', configuration: 'modelpath_c') + modelpath_c files('models') +} + def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' createTest('c', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) diff --git a/tests/org.eclipse.etrice.generator.c.tests/modelpath b/tests/org.eclipse.etrice.generator.c.tests/modelpath new file mode 100644 index 000000000..6b24a696f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/modelpath @@ -0,0 +1,2 @@ +srcDir models +project org.eclipse.etrice.modellib.c \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room index d8d7fdd82..b1cb1bc9d 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.c.tests/models/SendingDataTest.room @@ -1,8 +1,13 @@ RoomModel SendingDataTest { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" - import room.basic.language.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Language.room" + + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.int64 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.language.languageIndicator + import room.basic.test.TestInstance ActorClass SendingDataTop { @TestInstance @@ -11,7 +16,8 @@ RoomModel SendingDataTest { ActorRef mrPong: MrPong Binding mrPong.PingPongPort and mrPing.PingPongPort } - Behavior { } + Behavior { + } } ActorClass MrPong { @@ -29,134 +35,97 @@ RoomModel SendingDataTest { triggers { } - action { - "PingPongPort.pongInt16(transitionData);" - } + action '''PingPongPort.pongInt16(transitionData);''' } Transition tr1: reply -> reply { triggers { } - action { - "PingPongPort.pongInt8(transitionData);" - } + action '''PingPongPort.pongInt8(transitionData);''' + } + Transition init: initial -> reply { } - Transition init: initial -> reply { } Transition tr2: reply -> reply { triggers { } - action { - "PingPongPort.pongInt32(transitionData);" - } + action '''PingPongPort.pongInt32(transitionData);''' } Transition tr3: reply -> reply { triggers { } - action { - "PingPongPort.pongFloat32(transitionData);" - } + action '''PingPongPort.pongFloat32(transitionData);''' } Transition tr4: reply -> reply { triggers { } - action { - "PingPongPort.pongFloat64(transitionData);" - } + action '''PingPongPort.pongFloat64(transitionData);''' } Transition tr7: reply -> cp cp0 { triggers { - + } } Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*transitionData)+10);" - } + action '''PingPongPort.pongInt32((*transitionData)+10);''' } Transition tr6: cp cp0 -> reply { - cond { - "(*transitionData)!=5" - } - action { - "PingPongPort.pongInt32(*transitionData);" - } + cond '''(*transitionData)!=5''' + action '''PingPongPort.pongInt32(*transitionData);''' } Transition tr9: reply -> reply { triggers { } - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr11: reply -> reply { triggers { } - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr5: reply -> reply { triggers { } - action { - "PingPongPort.pongInt64(transitionData);" - } + action '''PingPongPort.pongInt64(transitionData);''' } Transition tr10: reply -> reply { triggers { } - action { - "PingPongPort.pongInt16(*transitionData);" - } + action '''PingPongPort.pongInt16(*transitionData);''' } Transition tr12: reply -> cp cp1 { triggers { - i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(transitionData);" + i8ValPPD == 5'''> } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr14: cp cp1 -> reply { - cond { - "transitionData->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(transitionData);" - } + cond '''transitionData->i8ValPPD==7''' + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr15: reply -> reply { triggers { } - action { - "PingPongPort.pongComplexDerived(transitionData);" - } + action '''PingPongPort.pongComplexDerived(transitionData);''' } Transition tr16: my tp0 -> my tp0 { triggers { } - } + } ChoicePoint cp0 ChoicePoint cp1 - TransitionPoint tp0 + TransitionPoint tp0 State reply } } @@ -168,298 +137,271 @@ RoomModel SendingDataTest { } Structure { external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" + Attribute i8Val: int8 = "5" + Attribute i16Val: int16 = "19" Attribute i32Val: int32 = "4711" Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14f" - Attribute f64Val: float64="7.987654321" + Attribute i32Array [10]: int32 = "{0,1,2,3,4,5,6,7,8,9}" + Attribute f32Val: float32 = "3.14f" + Attribute f64Val: float64 = "7.987654321" Attribute data: PingPongData Attribute dataD: PingPongDataDerived - Attribute counter:int32 + Attribute counter: int32 Attribute caseId: int32 Attribute lang: languageIndicator - Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" + Attribute resultlist [23]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" } Behavior { StateMachine { Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log\", \"SendingDataTest\", \"org.eclipse.etrice.generator.c.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "/* send the default values */" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - } + action ''' + caseId = etUnit_openAll("log", "SendingDataTest", "org.eclipse.etrice.generator.c.tests.SendingDataTest", "SendingDataTest_case"); + EXPECT_ORDER_START(caseId,resultlist,23); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1); + /* send the default values */ + + PingPongPort.pingInt8(i8Val); + PingPongPort.pingInt16(i16Val); + PingPongPort.pingInt32(i32Val); + PingPongPort.pingInt64(i64Val); + PingPongPort.pingFloat32(f32Val); + PingPongPort.pingFloat64(f64Val); + PingPongPort.pingInt16Ref(&i16Val); + PingPongPort.pingInt32Ref(&i32Val); + i8Val++; + i16Val++; + i32Val++; + i64Val++; + f32Val+=10.1; + f64Val+=20.2; + PingPongPort.pingInt8(i8Val); + PingPongPort.pingInt16(i16Val); + PingPongPort.pingInt32(i32Val); + PingPongPort.pingInt64(i64Val); + PingPongPort.pingFloat32(f32Val); + PingPongPort.pingFloat64(f64Val); + PingPongPort.pingInt16Ref(&i16Val); + PingPongPort.pingInt32Ref(&i32Val);''' } Transition tr0: tp1 of state0 -> tp0 of state1 Transition tr1: tp1 of state1 -> test_finished State state0 { subgraph { Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } + action '''counter=0;''' } Transition tr1: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==5){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 2); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr2: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==19){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 3); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr3: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } + action ''' + counter++; + if (transitionData==4711){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 4); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' + } Transition tr4: receiveFirst7 -> receiveSecond7 { triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (transitionData==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (transitionData==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } + + } + action ''' + counter=0; + if (lang == 1){ + /* Java cannot send references of primitive types */ + if (transitionData==4711){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + } + if (lang == 2){ + /* C */ + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + }''' } Transition tr6: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==11470815){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 5); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr5: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if ((transitionData>3)&&(transitionData<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>3)&&(transitionData<4)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 6); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr7: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if ((transitionData>7)&&(transitionData<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>7)&&(transitionData<8)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 7); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr8: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==6){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 10); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr9: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 11); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr10: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 12); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr11: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==11470816){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 13); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr12: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if ((transitionData>13)&&(transitionData<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>13)&&(transitionData<14)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 14); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr13: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if ((transitionData>28)&&(transitionData<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>28)&&(transitionData<29)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 15); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr14: receiveSecond7 -> my tp1 { triggers { - - } - action { - "if (transitionData==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + + } + action ''' + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 17); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr15: receiveFirst7 -> receiveFirst7 { triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (transitionData==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (transitionData==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } + + } + action ''' + counter++; + if (lang == 1){ + /* Java cannot send references of primitive types */ + if (transitionData==19){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + } + if (lang == 2){ + /* C */ + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + }''' } Transition tr16: receiveSecond7 -> receiveSecond7 { triggers { - - } - action { - "counter++;" - "if (transitionData==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + + } + action ''' + counter++; + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 16); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } EntryPoint tp0 ExitPoint tp1 @@ -468,76 +410,69 @@ RoomModel SendingDataTest { } } State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 23); + etUnit_closeAll(caseId); + etUnit_testFinished(caseId);''' } State state1 { subgraph { Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "/* send default values */" - "PingPongPort.pingComplex(&(data));" - "PingPongPort.pingComplexRef(&(data));" - } + action ''' + counter=0; + /* send default values */ + PingPongPort.pingComplex(&(data)); + PingPongPort.pingComplexRef(&(data));''' } Transition tr1: state0 -> state1 { triggers { - - } - action { - "counter=0;" - "if (transitionData->i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData->complexVal.i32Val2PPDD==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8ValPPD=11;" - "PingPongPort.pingComplexDerived(&(dataD));" - } + + } + action ''' + counter=0; + if (transitionData->i8ValPPD==10){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 19); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + if (transitionData->complexVal.i32Val2PPDD==80){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 20); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + dataD.i8ValPPD=11; + PingPongPort.pingComplexDerived(&(dataD));''' } Transition tr2: state0 -> state0 { triggers { } - action { - "counter++;" - "if (transitionData->i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData->i8ValPPD==10){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 18); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr3: state1 -> my tp1 { triggers { } - action { - "if (transitionData->i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData->i32Val3PPDe==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + if (transitionData->i8ValPPD==11){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 21); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + if (transitionData->i32Val3PPDe==150){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 22); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } EntryPoint tp0 ExitPoint tp1 @@ -551,44 +486,42 @@ RoomModel SendingDataTest { ProtocolClass PingPongProtocol { incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) + Message pingInt8(int8) + Message pingInt16(int16) + Message pingInt32(int32) + Message pingInt64(int64) + Message pingFloat32(float32) + Message pingFloat64(float64) + Message pingInt16Ref(int16 ref) + Message pingInt32Ref(int32 ref) + Message pingComplex(PingPongData) + Message pingComplexRef(PingPongData ref) + Message pingComplexDerived(PingPongDataDerived) } outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) + Message pongInt8(int8) + Message pongInt16(int16) + Message pongInt32(int32) + Message pongInt64(int64) + Message pongFloat32(float32) + Message pongFloat64(float64) + Message pongComplex(PingPongData) + Message pongComplexDerived(PingPongDataDerived) } } - + ProtocolClass PCExternal { - usercode1 { - "typedef int extMsg;" - } + usercode1 '''typedef int extMsg;''' incoming { - Message in1(can: DExtMsg) + Message in1(DExtMsg) } } DataClass PingPongData { Attribute i8ValPPD: int8 = "10" Attribute i8ValRefPPD: int8 ref - Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRefPPD [ 2 ]: int8 ref + Attribute i32ArrayPPD [3]: int32 = "{200,300,400}" + Attribute i8ArrayRefPPD [2]: int8 ref Attribute complexVal: PingPongDataDeep } diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config index 426adc5e6..8ce007ba5 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.config @@ -1,6 +1,12 @@ ConfigModel StaticTestConfig { - import StaticConfigTest.* from "StaticConfigTest.room" + import StaticConfigTest.Tester_ac + import StaticConfigTest.Testee_1_ac + import StaticConfigTest.Testee_Super2_ac + import StaticConfigTest.Testee_2_ac + import StaticConfigTest.TestProtocolAttributes + import StaticConfigTest.TestProtocolWithDataClass + import StaticConfigTest.System_StaticConfigTest ActorClassConfig Tester_ac { // nothing diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap index c0f26f88d..2fd5a28df 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.etmap @@ -1,10 +1,12 @@ MappingModel StaticConfigTest { - import StaticConfigTest.* from "StaticConfigTest.room" - import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + import StaticConfigTest.System_StaticConfigTest + import room.generic.physical.GenericPhysicalSystem Mapping System_StaticConfigTest -> GenericPhysicalSystem { - SubSystemMapping main -> node {} + SubSystemMapping main -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room index 484f8ac0e..53151deb9 100644 --- a/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room +++ b/tests/org.eclipse.etrice.generator.c.tests/models/StaticConfigTest.room @@ -1,47 +1,52 @@ RoomModel StaticConfigTest { - - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" - import room.basic.service.timing.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/TimingService.room" + + import room.basic.types.boolean + import room.basic.types.char + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.int64 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.types.string + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService LogicalSystem System_StaticConfigTest { - SubSystemRef main : SubSystem_StaticConfigTest + SubSystemRef main: SubSystem_StaticConfigTest } - + SubSystemClass SubSystem_StaticConfigTest { LayerConnection ref top satisfied_by timer.timer ActorRef top: Top_ac - ActorRef timer : ATimingService - } + ActorRef timer: ATimingService + LogicalThread defaultThread + } + ActorClass Top_ac { Structure { ActorRef testee_1: Testee_1_ac ActorRef tester: Tester_ac LayerConnection ref testee_1 satisfied_by tester.spp - SAP timer : PTimer + SAP timer: PTimer } Behavior { - ctor { - "etUnit_open(\"log\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.c.tests.StaticConfigTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } + ctor ''' + etUnit_open("log", "StaticConfigTest"); + etUnit_openTestSuite("org.eclipse.etrice.generator.c.tests.StaticConfigTest");''' + dtor ''' + etUnit_closeTestSuite(); + etUnit_close();''' StateMachine { Transition init: initial -> state0 { - action { - "timer.startTimeout(1000);" - } + action '''timer.startTimeout(1000);''' } Transition tr0: state0 -> state0 { triggers { } - action { - "etUnit_testFinished(-1);" - } + action '''etUnit_testFinished(-1);''' } State state0 } @@ -62,13 +67,13 @@ RoomModel StaticConfigTest { } Behavior { StateMachine { - Transition init: initial -> s1 { } + Transition init: initial -> s1 { + } State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" - "Data_3_dc_varCheck3(&(data_3), caseId);" - "etUnit_closeTestCase(caseId);" - } + entry ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Tester_ac"); + Data_3_dc_varCheck3(&(data_3), caseId); + etUnit_closeTestCase(caseId);''' } } } @@ -79,9 +84,7 @@ RoomModel StaticConfigTest { conjugated Port conj_port: TestProtocolAttributes } Structure { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } + usercode1 '''#include "etUnit/etUnit.h"''' external Port conj_port Attribute caseId: int32 Attribute data_1: Data_1_dc @@ -91,68 +94,62 @@ RoomModel StaticConfigTest { } Behavior { StateMachine { - Transition init: initial -> s1 { } + Transition init: initial -> s1 { + } State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");" - "Data_1_dc_varCheck1(&(data_1), caseId);" - "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", data_1.bool_c);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", data_1.int8_c == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", data_1.int16_c == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", data_1.int32_c == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", data_1.int64_c == 192);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, data_1.float32_c, 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId,\"testee_1:data_1:7\", 19.2, data_1.float64_c, 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", data_1.char_c == \'C\');" - "EXPECT_TRUE(caseId,\"testee_1:varCheck:8.1\", strcmp(data_1.string_c, \":)\") == 0 );" - "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", data_1.bool_i);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", data_1.int8_i == 2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", data_1.int16_i == 4);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", data_1.int32_i == 8);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", data_1.int64_i == 16);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, data_1.float32_i, 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId,\"testee_1:data_1:16\", 3.2, data_1.float64_i, 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", data_1.char_i == \'I\');" - "EXPECT_TRUE(caseId,\"testee_1:varCheck:18\", strcmp(data_1.string_i, \":]\") == 0 );" - - // Array - "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", data_1.bool_array_c[0] == ET_TRUE && data_1.bool_array_c[1] == ET_FALSE);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", data_1.int8_array_c[0] == 24 && data_1.int8_array_c[1] == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", data_1.int16_array_c[0] == 48 && data_1.int16_array_c[1] == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", data_1.int32_array_c[0] == 96 && data_1.int32_array_c[1] == 192);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", data_1.int64_array_c[0] == 192 && data_1.int64_array_c[1] == 384);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:24_1\", 9.6f, data_1.float32_array_c[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:24_2\", 9.6f, data_1.float32_array_c[1], 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:25_1\", 19.2, data_1.float64_array_c[0], 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:25_2\", 19.2, data_1.float64_array_c[1], 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", strcmp(data_1.char_array_c, \"Claz\") == 0);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", data_1.bool_array_i[0] == ET_TRUE && data_1.bool_array_i[1] == ET_TRUE);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", data_1.int8_array_i[0] == 2 && data_1.int8_array_i[1] == 6);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", data_1.int16_array_i[0] == 4 && data_1.int16_array_i[1] == 12);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", data_1.int32_array_i[0] == 8 && data_1.int32_array_i[1] == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", data_1.int64_array_i[0] == 16 && data_1.int64_array_i[1] == 48);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:32_1\", 1.6f, data_1.float32_array_i[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"testee_1:data_1:32_2\", 1.6f, data_1.float32_array_i[1], 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:33_1\", 3.2, data_1.float64_array_i[0], 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"testee_1:data_1:33_2\", 3.2, data_1.float64_array_i[1], 0.1);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", strcmp(data_1.char_array_i, \"Inst\") == 0);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", data_1.data_2.int32_c == 42);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", data_1.data_2.int32_i == 43);" - - // conj_port - "EXPECT_TRUE(caseId,\"testee_1:conj_port:36\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:37\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:38\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:39\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:40\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1);" - "EXPECT_TRUE(caseId,\"testee_1:conj_port:41\", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2);" - "etUnit_testFinished(caseId);" - - // enums - "EXPECT_TRUE(caseId,\"testee_1:enumval1\", enumval1 == Enum_1.two);" - "EXPECT_TRUE(caseId,\"testee_1:enumval2\", enumval2 == Enum_2.three);" - "etUnit_closeTestCase(caseId);" - } + entry ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Testee_1_ac"); + Data_1_dc_varCheck1(&(data_1), caseId); + EXPECT_FALSE(caseId,"testee_1:data_1:1", data_1.bool_c); + EXPECT_TRUE(caseId,"testee_1:data_1:2", data_1.int8_c == 24); + EXPECT_TRUE(caseId,"testee_1:data_1:3", data_1.int16_c == 48); + EXPECT_TRUE(caseId,"testee_1:data_1:4", data_1.int32_c == 96); + EXPECT_TRUE(caseId,"testee_1:data_1:5", data_1.int64_c == 192); + EXPECT_EQUAL_FLOAT32(caseId,"testee_1:data_1:6", 9.6f, data_1.float32_c, 0.1f); + EXPECT_EQUAL_FLOAT64(caseId,"testee_1:data_1:7", 19.2, data_1.float64_c, 0.1); + EXPECT_TRUE(caseId,"testee_1:data_1:8", data_1.char_c == 'C'); + EXPECT_TRUE(caseId,"testee_1:varCheck:8.1", strcmp(data_1.string_c, ":)") == 0 ); + EXPECT_TRUE(caseId,"testee_1:data_1:10", data_1.bool_i); + EXPECT_TRUE(caseId,"testee_1:data_1:11", data_1.int8_i == 2); + EXPECT_TRUE(caseId,"testee_1:data_1:12", data_1.int16_i == 4); + EXPECT_TRUE(caseId,"testee_1:data_1:13", data_1.int32_i == 8); + EXPECT_TRUE(caseId,"testee_1:data_1:14", data_1.int64_i == 16); + EXPECT_EQUAL_FLOAT32(caseId,"testee_1:data_1:15", 1.6f, data_1.float32_i, 0.1f); + EXPECT_EQUAL_FLOAT64(caseId,"testee_1:data_1:16", 3.2, data_1.float64_i, 0.1); + EXPECT_TRUE(caseId,"testee_1:data_1:17", data_1.char_i == 'I'); + EXPECT_TRUE(caseId,"testee_1:varCheck:18", strcmp(data_1.string_i, ":]") == 0 ); + EXPECT_TRUE(caseId,"testee_1:data_1:19", data_1.bool_array_c[0] == ET_TRUE && data_1.bool_array_c[1] == ET_FALSE); + EXPECT_TRUE(caseId,"testee_1:data_1:20", data_1.int8_array_c[0] == 24 && data_1.int8_array_c[1] == 48); + EXPECT_TRUE(caseId,"testee_1:data_1:21", data_1.int16_array_c[0] == 48 && data_1.int16_array_c[1] == 96); + EXPECT_TRUE(caseId,"testee_1:data_1:22", data_1.int32_array_c[0] == 96 && data_1.int32_array_c[1] == 192); + EXPECT_TRUE(caseId,"testee_1:data_1:23", data_1.int64_array_c[0] == 192 && data_1.int64_array_c[1] == 384); + EXPECT_EQUAL_FLOAT32(caseId, "testee_1:data_1:24_1", 9.6f, data_1.float32_array_c[0], 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "testee_1:data_1:24_2", 9.6f, data_1.float32_array_c[1], 0.1f); + EXPECT_EQUAL_FLOAT64(caseId, "testee_1:data_1:25_1", 19.2, data_1.float64_array_c[0], 0.1); + EXPECT_EQUAL_FLOAT64(caseId, "testee_1:data_1:25_2", 19.2, data_1.float64_array_c[1], 0.1); + EXPECT_TRUE(caseId,"testee_1:data_1:26", strcmp(data_1.char_array_c, "Claz") == 0); + EXPECT_TRUE(caseId,"testee_1:data_1:27", data_1.bool_array_i[0] == ET_TRUE && data_1.bool_array_i[1] == ET_TRUE); + EXPECT_TRUE(caseId,"testee_1:data_1:28", data_1.int8_array_i[0] == 2 && data_1.int8_array_i[1] == 6); + EXPECT_TRUE(caseId,"testee_1:data_1:29", data_1.int16_array_i[0] == 4 && data_1.int16_array_i[1] == 12); + EXPECT_TRUE(caseId,"testee_1:data_1:30", data_1.int32_array_i[0] == 8 && data_1.int32_array_i[1] == 24); + EXPECT_TRUE(caseId,"testee_1:data_1:31", data_1.int64_array_i[0] == 16 && data_1.int64_array_i[1] == 48); + EXPECT_EQUAL_FLOAT32(caseId, "testee_1:data_1:32_1", 1.6f, data_1.float32_array_i[0], 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "testee_1:data_1:32_2", 1.6f, data_1.float32_array_i[1], 0.1f); + EXPECT_EQUAL_FLOAT64(caseId, "testee_1:data_1:33_1", 3.2, data_1.float64_array_i[0], 0.1); + EXPECT_EQUAL_FLOAT64(caseId, "testee_1:data_1:33_2", 3.2, data_1.float64_array_i[1], 0.1); + EXPECT_TRUE(caseId,"testee_1:data_1:34", strcmp(data_1.char_array_i, "Inst") == 0); + EXPECT_TRUE(caseId,"testee_1:data_1:35", data_1.data_2.int32_c == 42); + EXPECT_TRUE(caseId,"testee_1:data_1:36", data_1.data_2.int32_i == 43); + EXPECT_TRUE(caseId,"testee_1:conj_port:36", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[0] == 11); + EXPECT_TRUE(caseId,"testee_1:conj_port:37", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_r[1] == 22); + EXPECT_TRUE(caseId,"testee_1:conj_port:38", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[0] == 16); + EXPECT_TRUE(caseId,"testee_1:conj_port:39", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_c[1] == 32); + EXPECT_TRUE(caseId,"testee_1:conj_port:40", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[0] == 1); + EXPECT_TRUE(caseId,"testee_1:conj_port:41", ((TestProtocolAttributesConjPort_var*)self->constData->conj_port.varData)->array2_i[1] == 2); + etUnit_testFinished(caseId); + EXPECT_TRUE(caseId,"testee_1:enumval1", enumval1 == Enum_1.two); + EXPECT_TRUE(caseId,"testee_1:enumval2", enumval2 == Enum_2.three); + etUnit_closeTestCase(caseId);''' } } } @@ -163,9 +160,7 @@ RoomModel StaticConfigTest { Port reg_port: TestProtocolAttributes } Structure { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } + usercode1 '''#include "etUnit/etUnit.h"''' external Port reg_port Attribute caseId: int32 @@ -176,20 +171,16 @@ RoomModel StaticConfigTest { Attribute float64_super_i: float64 = "1.1" } Behavior { - ctor { - "testInstanceConfig();" - } - Operation testInstanceConfig(){ - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:1\", 1.1, float64_super_r, 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:2\", 2.2, float64_super_c, 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_Super2_ac:3\", 3.3, float64_super_i, 0.1);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:7\", 25.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);" - // reg_port - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:5\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_Super2_ac:6\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);" - "etUnit_closeTestCase(caseId);" - } + ctor '''testInstanceConfig();''' + Operation testInstanceConfig() ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Testee_Super2_ac"); + EXPECT_EQUAL_FLOAT64(caseId, "Testee_Super2_ac:1", 1.1, float64_super_r, 0.1); + EXPECT_EQUAL_FLOAT64(caseId, "Testee_Super2_ac:2", 2.2, float64_super_c, 0.1); + EXPECT_EQUAL_FLOAT64(caseId, "Testee_Super2_ac:3", 3.3, float64_super_i, 0.1); + EXPECT_EQUAL_FLOAT32(caseId, "Testee_Super2_ac:7", 25.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "Testee_Super2_ac:5", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "Testee_Super2_ac:6", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f); + etUnit_closeTestCase(caseId);''' } } @@ -201,31 +192,26 @@ RoomModel StaticConfigTest { Attribute int32_own_i: int32 = "11" } Behavior { - override Operation testInstanceConfig(){ - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");" - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_2_ac:2\", 4.4, float64_super_i, 0.1);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:9\", 50.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);" - } + override Operation testInstanceConfig() ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Testee_2_ac"); + EXPECT_EQUAL_FLOAT64(caseId, "Testee_2_ac:2", 4.4, float64_super_i, 0.1); + EXPECT_EQUAL_FLOAT32(caseId, "Testee_2_ac:9", 50.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_i, 0.1f);''' StateMachine { - Transition init: initial -> s1 { } + Transition init: initial -> s1 { + } State s1 { - entry { - "EXPECT_EQUAL_FLOAT64(caseId, \"Testee_2_ac:1\", 2.2, float64_super_c, 0.1);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);" - - // reg_port - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:6\", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Testee_2_ac:7\", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f);" - - // sap - "Data_3_dc_varCheck3(&(((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_3), caseId);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:10\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_r == 1);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:11\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_c == 2);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:sap:12\", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_i == 3);" - "etUnit_closeTestCase(caseId);" - } + entry ''' + EXPECT_EQUAL_FLOAT64(caseId, "Testee_2_ac:1", 2.2, float64_super_c, 0.1); + EXPECT_TRUE(caseId, "Testee_2_ac:3", int32_own_r == 11); + EXPECT_TRUE(caseId, "Testee_2_ac:4", int32_own_c == 12); + EXPECT_TRUE(caseId, "Testee_2_ac:5", int32_own_i == 13); + EXPECT_EQUAL_FLOAT32(caseId, "Testee_2_ac:6", 4.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_r, 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "Testee_2_ac:7", 3.0f, ((TestProtocolAttributesPort_var*) self->constData->reg_port.varData)->float_c, 0.1f); + Data_3_dc_varCheck3(&(((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_3), caseId); + EXPECT_TRUE(caseId, "Testee_2_ac:sap:10", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_r == 1); + EXPECT_TRUE(caseId, "Testee_2_ac:sap:11", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_c == 2); + EXPECT_TRUE(caseId, "Testee_2_ac:sap:12", ((TestProtocolWithDataClassConjPort_var*)self->constData->sap.varData)->sap_data_2.int32_i == 3); + etUnit_closeTestCase(caseId);''' } } } @@ -243,22 +229,21 @@ RoomModel StaticConfigTest { } conjugated PortClass { - Attribute array2_r [ 2 ]: int64 = "{11,22}" - Attribute array2_c [ 2 ]: int64 = "{0,0}" - Attribute array2_i [ 2 ]: int64 = "{0,0}" + Attribute array2_r [2]: int64 = "{11,22}" + Attribute array2_c [2]: int64 = "{0,0}" + Attribute array2_i [2]: int64 = "{0,0}" } } ProtocolClass TestProtocolWithDataClass { - usercode1 { - "#include \"Data_2_dc.h\"" - "#include \"Data_3_dc.h\"" - } + usercode1 ''' + #include "Data_2_dc.h" + #include "Data_3_dc.h"''' incoming { Message dummy() } - //SAP + // SAP conjugated PortClass { Attribute sap_data_2: Data_2_dc @@ -271,20 +256,20 @@ RoomModel StaticConfigTest { ExternalType extType -> "int" default "999" DataClass Data_Super1_dc { + // PrimitiveType Attribute bool_r: boolean = "false" Attribute bool_c: boolean = "false" Attribute bool_i: boolean = "false" + // Array - Attribute bool_array_r [ 2 ]: boolean = "{ ET_FALSE, false }" - Attribute bool_array_c [ 2 ]: boolean = "{ false, false }" - Attribute bool_array_i [ 2 ]: boolean = "{ false, false }" + Attribute bool_array_r [2]: boolean = "{ ET_FALSE, false }" + Attribute bool_array_c [2]: boolean = "{ false, false }" + Attribute bool_array_i [2]: boolean = "{ false, false }" } - DataClass Data_1_dc extends Data_Super1_dc{ - usercode1 { - "#include \"etUnit/etUnit.h\"" - } + DataClass Data_1_dc extends Data_Super1_dc { + usercode1 '''#include "etUnit/etUnit.h"''' Attribute int8_r: int8 = "8" Attribute int8_c: int8 = "8" @@ -312,99 +297,87 @@ RoomModel StaticConfigTest { Attribute string_i: string = ":/" // Array - Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }" - Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }" - Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }" - Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }" - Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute char_array_r [ 5 ]: char = "ROOM" - Attribute char_array_c [ 5 ]: char = "ROOM" - Attribute char_array_i [ 5 ]: char = "ROOM" + Attribute int8_array_r [2]: int8 = "{ 8, 16 }" + Attribute int8_array_c [2]: int8 = "{ 8, 16 }" + Attribute int8_array_i [2]: int8 = "{ 8, 16 }" + Attribute int16_array_r [2]: int16 = "{ 16, 32 }" + Attribute int16_array_c [2]: int16 = "{ 16, 32 }" + Attribute int16_array_i [2]: int16 = "{ 16, 32 }" + Attribute int32_array_r [2]: int32 = "{ 32, 64 }" + Attribute int32_array_c [2]: int32 = "{ 32, 64 }" + Attribute int32_array_i [2]: int32 = "{ 32, 64 }" + Attribute int64_array_r [2]: int64 = "{ 64, 128 }" + Attribute int64_array_c [2]: int64 = "{ 64, 128 }" + Attribute int64_array_i [2]: int64 = "{ 64, 128 }" + Attribute float32_array_r [2]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_c [2]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_i [2]: float32 = "{ 3.2, 6.4 }" + Attribute float64_array_r [2]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_c [2]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_i [2]: float64 = "{ 6.4, 12.8 }" + Attribute char_array_r [5]: char = "ROOM" + Attribute char_array_c [5]: char = "ROOM" + Attribute char_array_i [5]: char = "ROOM" // ComplexType Attribute data_2: Data_2_dc - Operation varCheck1(caseId: int32) { - "Data_2_dc_varCheck2(&(data_2), caseId);" - - // PrimitiveType - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == ET_FALSE);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId,\"Data_1_dc:varCheck:7\", 6.4, float64_r, 0.1);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", strcmp(string_r, \":/\") == 0 );" - - // Array - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == ET_FALSE && bool_array_r[1] == ET_FALSE);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Data_1_dc:varCheck:25_1\", 3.2f, float32_array_r[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"Data_1_dc:varCheck:25_2\", 6.4f, float32_array_r[1], 0.1f);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Data_1_dc:varCheck:26_1\", 6.4, float64_array_r[0], 0.1);" - "EXPECT_EQUAL_FLOAT64(caseId, \"Data_1_dc:varCheck:26_2\", 12.8, float64_array_r[1], 0.1);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", strcmp(char_array_r, \"ROOM\")==0);" - } + Operation varCheck1(caseId: int32) ''' + Data_2_dc_varCheck2(&(data_2), caseId); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:1", bool_r == ET_FALSE); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:2", int8_r == 8); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:3", int16_r == 16); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:4", int32_r == 32); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:5", int64_r == 64); + EXPECT_EQUAL_FLOAT32(caseId,"Data_1_dc:varCheck:6", 3.2f, float32_r, 0.1f); + EXPECT_EQUAL_FLOAT64(caseId,"Data_1_dc:varCheck:7", 6.4, float64_r, 0.1); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:8", char_r == 'R'); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:8", strcmp(string_r, ":/") == 0 ); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:10", bool_array_r[0] == ET_FALSE && bool_array_r[1] == ET_FALSE); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:11", int8_array_r[0] == 8 && int8_array_r[1] == 16); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:12", int16_array_r[0] == 16 && int16_array_r[1] == 32); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:13", int32_array_r[0] == 32 && int32_array_r[1] == 64); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:24", int64_array_r[0] == 64 && int64_array_r[1] == 128); + EXPECT_EQUAL_FLOAT32(caseId, "Data_1_dc:varCheck:25_1", 3.2f, float32_array_r[0], 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "Data_1_dc:varCheck:25_2", 6.4f, float32_array_r[1], 0.1f); + EXPECT_EQUAL_FLOAT64(caseId, "Data_1_dc:varCheck:26_1", 6.4, float64_array_r[0], 0.1); + EXPECT_EQUAL_FLOAT64(caseId, "Data_1_dc:varCheck:26_2", 12.8, float64_array_r[1], 0.1); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:27", strcmp(char_array_r, "ROOM")==0);''' } DataClass Data_2_dc { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } + usercode1 '''#include "etUnit/etUnit.h"''' Attribute int32_r: int32 = "1" Attribute int32_c: int32 = "1" Attribute int32_i: int32 = "1" - Operation varCheck2(caseId: int32): void { - "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);" - } + Operation varCheck2(caseId: int32): void '''EXPECT_TRUE(caseId, "Data_2_dc:1", int32_r == 1);''' } DataClass Data_3_dc { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } + usercode1 '''#include "etUnit/etUnit.h"''' // none config test Attribute primitive_ref: int32 ref - Attribute primitive_ref_array [ 2 ]: int32 ref - Attribute dataClass_array [ 2 ]: Data_2_dc + Attribute primitive_ref_array [2]: int32 ref + Attribute dataClass_array [2]: Data_2_dc Attribute dataClass_ref: Data_2_dc ref - Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref + Attribute dataClass_ref_array [2]: Data_2_dc ref Attribute ext_type: extType - Attribute ext_type_array [ 2 ]: extType + Attribute ext_type_array [2]: extType Attribute ext_type_ref: extType ref - Attribute ext_type_ref_array [ 2 ]: extType ref - Operation varCheck3(caseId: int32): void { - "EXPECT_TRUE(caseId, \"Data_3_dc:1\", primitive_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:2\", primitive_ref_array[0] == NULL && primitive_ref_array[1] == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[0].int32_r == 1 && dataClass_array[0].int32_c == 1 && dataClass_array[0].int32_i == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_array[1].int32_r == 1 && dataClass_array[1].int32_c == 1 && dataClass_array[1].int32_i == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:5\", dataClass_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:6\", dataClass_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type == 999);" - "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_array[0] == 999 && ext_type_array[1] == 999);" - "EXPECT_TRUE(caseId, \"Data_3_dc:9\", ext_type_ref == NULL);" - "EXPECT_TRUE(caseId, \"Data_3_dc:10\", ext_type_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);" - } + Attribute ext_type_ref_array [2]: extType ref + Operation varCheck3(caseId: int32): void ''' + EXPECT_TRUE(caseId, "Data_3_dc:1", primitive_ref == NULL); + EXPECT_TRUE(caseId, "Data_3_dc:2", primitive_ref_array[0] == NULL && primitive_ref_array[1] == NULL); + EXPECT_TRUE(caseId, "Data_3_dc:3", dataClass_ref == NULL); + EXPECT_TRUE(caseId, "Data_3_dc:4", dataClass_array[0].int32_r == 1 && dataClass_array[0].int32_c == 1 && dataClass_array[0].int32_i == 1); + EXPECT_TRUE(caseId, "Data_3_dc:4", dataClass_array[1].int32_r == 1 && dataClass_array[1].int32_c == 1 && dataClass_array[1].int32_i == 1); + EXPECT_TRUE(caseId, "Data_3_dc:5", dataClass_ref == NULL); + EXPECT_TRUE(caseId, "Data_3_dc:6", dataClass_ref_array[0] == NULL && dataClass_ref_array[1] == NULL); + EXPECT_TRUE(caseId, "Data_3_dc:7", ext_type == 999); + EXPECT_TRUE(caseId, "Data_3_dc:8", ext_type_array[0] == 999 && ext_type_array[1] == 999); + EXPECT_TRUE(caseId, "Data_3_dc:9", ext_type_ref == NULL); + EXPECT_TRUE(caseId, "Data_3_dc:10", ext_type_ref_array[0] == NULL && dataClass_ref_array[1] == NULL);''' } Enumeration Enum_1 { @@ -412,10 +385,9 @@ RoomModel StaticConfigTest { one, two } - + Enumeration Enum_2 of int16 { - three=3, + three = 3, four } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch b/tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch deleted file mode 100644 index 82407cfc0..000000000 --- a/tests/org.eclipse.etrice.generator.c.tests/org.eclipse.etrice.generator.c.tests make.xml.launch +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle index 5046158f5..ebbcfc814 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle @@ -4,6 +4,15 @@ apply plugin: 'java-base' apply from: "$rootDir/gradle/etTest.gradle" +dependencies { + modelpath_c project(path: ':runtime:org.eclipse.etrice.modellib.c', configuration: 'modelpath_c') + modelpath_cpp project(path: ':runtime:org.eclipse.etrice.modellib.cpp', configuration: 'modelpath_cpp') + modelpath_java project(path: ':runtime:org.eclipse.etrice.modellib.java', configuration: 'modelpath_java') + modelpath_c files('models') + modelpath_cpp files('models') + modelpath_java files('models') +} + def genericPhysical = 'models/GenericPhysical.etphys' def tests = [ @@ -12,7 +21,7 @@ def tests = [ choicePointTestExtended: ['models/ChoicePointTestExtended.room', genericPhysical], dataDrivenTest: ['models/DataDrivenTest.room', genericPhysical], /* enumTest: ['models/EnumTest.room', genericPhysical], not supported in c++ */ - compileTests: ['models/CompileTests.room', genericPhysical, 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room'], + compileTest: ['models/CompileTest.room', genericPhysical, 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room'], handlerTest: ['models/HandlerTest.room', genericPhysical], operationInheritanceTest: ['models/OperationInheritanceTest.room', genericPhysical], @@ -34,7 +43,7 @@ createTest('java', 'enumTest', ['models/EnumTest.room', genericPhysical]) createTest('c', 'detailExpressionCompileTest', [genericPhysical, 'models/DetailExpressionTest.room', 'models/DetailExpressionEnum.room', 'models/DetailExpressionTypes.room']) createTest('java', 'detailExpressionCompileTest', [genericPhysical, 'models/DetailExpressionTest.room', 'models/DetailExpressionEnum.room', 'models/DetailExpressionTypes.room']) -// VarargsTTest +// VarargsTest createTest('c', 'varargsTest', [genericPhysical, 'models/VarargsTest.room']) createTest('java', 'varargsTest', [genericPhysical, 'models/VarargsTest.room']) diff --git a/tests/org.eclipse.etrice.generator.common.tests/common.xml b/tests/org.eclipse.etrice.generator.common.tests/common.xml deleted file mode 100644 index 90d29d8a0..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/common.xml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ant.project.name = ${ant.project.name} - runtime.path = ${runtime.path} - testlog.path = ${testlog.path} - test.results = ${test.results} - output = ${output} - bin.path = ${bin.path} - target.platform = ${target.platform} - modellib.path = ${modellib.path} - models.path = ${models.path} - basedir = ${basedir} - - org.eclipse.emf.ecore = ${org.eclipse.emf.ecore} - org.eclipse.emf.common = ${org.eclipse.emf.common} - org.eclipse.emf.ecore.xmi = ${org.eclipse.emf.ecore.xmi} - com.google.inject = ${com.google.inject} - com.google.guava = ${com.google.guava} - org.eclipse.equinox.common = ${org.eclipse.equinox.common} - org.eclipse.xtext = ${org.eclipse.xtext} - org.eclipse.xtext.util = ${org.eclipse.xtext.util} - org.eclipse.xtext.common.types = ${org.eclipse.xtext.common.types} - org.eclipse.xtend.lib = ${org.eclipse.xtend.lib} - org.eclipse.xtext.xbase.lib = ${org.eclipse.xtext.xbase.lib} - org.apache.log4j = ${org.apache.log4j} - org.antlr.runtime = ${org.antlr.runtime} - javax.inject = ${javax.inject} - - - etrice.clspath = ${classpathProp} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/modelpath b/tests/org.eclipse.etrice.generator.common.tests/modelpath new file mode 100644 index 000000000..6b24a696f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/modelpath @@ -0,0 +1,2 @@ +srcDir models +project org.eclipse.etrice.modellib.c \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room index 8948c557d..0d624e139 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room @@ -1,26 +1,27 @@ RoomModel ActorCommunicationTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" + import room.basic.types.boolean + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.test.TestInstance + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService - SubSystemClass SubSystem_ActorCommunicationTest { + ActorClass ActorCommunicationTest_Top { @TestInstance - ActorRef singleThread_Appl: Appl - ActorRef timing: ATimingService - LayerConnection ref singleThread_Appl satisfied_by timing.timer - - // all unmapped instances are mapped to the default *physical* thread - //LogicalThread dflt_thread - //ActorInstanceMapping timing -> dflt_thread - //ActorInstanceMapping singleThread_Appl -> dflt_thread + Structure { + ActorRef singleThread_Appl: Appl + ActorRef timing: ATimingService + LayerConnection ref singleThread_Appl satisfied_by timing.timer + } } /* - * On each timing event Tester sends a message with a counter to all Testees - * From counter=1-9: each Testee does an expect order - * On counter=10: each Testee sends finish message to Tester, that does last expect order - */ + * On each timing event Tester sends a message with a counter to all Testees + * From counter=1-9: each Testee does an expect order + * On counter=10: each Testee sends finish message to Tester, that does last expect order + */ ActorClass Appl { Structure { ActorRef tester: Tester @@ -33,7 +34,8 @@ RoomModel ActorCommunicationTest { Binding tester.async_counter1 and async_Testee.event_counter Binding tester.async_counter2 and async_Testee.data_counter } - Behavior { } + Behavior { + } } async ActorClass Tester { @@ -57,96 +59,76 @@ RoomModel ActorCommunicationTest { Attribute counter: int32 Attribute finish_counter: int32 Attribute data_finish_flag: boolean - Attribute data_result [ 10 ]: int16 = "{1,2,3,4,5,6,7,8,9,10}" - Attribute event_result [ 10 ]: int16 = "{101,102,103,104,105,106,107,108,109,110}" - Attribute async_result [ 10 ]: int16 = "{1051,1002,1053,1004,1055,1006,1057,1008,1059,1010}" + Attribute data_result [10]: int16 = "{1,2,3,4,5,6,7,8,9,10}" + Attribute event_result [10]: int16 = "{101,102,103,104,105,106,107,108,109,110}" + Attribute async_result [10]: int16 = "{1051,1002,1053,1004,1055,1006,1057,1008,1059,1010}" } Behavior { - ctor { - "etUnit_open(\"log\", \"ActorCommunicationTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.ActorCommunicationTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } + ctor ''' + etUnit_open("log", "ActorCommunicationTest"); + etUnit_openTestSuite("org.eclipse.etrice.generator.common.tests.ActorCommunicationTest");''' + dtor ''' + etUnit_closeTestSuite(); + etUnit_close();''' StateMachine { Transition init: initial -> tester_run { - action { - "data_caseId = etUnit_openTestCase(\"Datadriven ActorCommunicationTest\");" - "event_caseId = etUnit_openTestCase(\"Eventdriven ActorCommunicationTest\");" - "async_caseId = etUnit_openTestCase(\"Async ActorCommunicationTest\");" - "" - "event_counter.caseId(event_caseId);" - "data_counter.caseId(data_caseId);" - "async_counter2.caseId(async_caseId);" - "" - "counter = 0;" - "finish_counter = 0;" - "data_finish_flag = false;" - "EXPECT_ORDER_START(data_caseId, data_result, 10);" - "EXPECT_ORDER_START(event_caseId, event_result, 10);" - "EXPECT_ORDER_START(async_caseId, async_result, 10);" - "timer.startTimer(400);" - } + action ''' + data_caseId = etUnit_openTestCase("Datadriven ActorCommunicationTest"); + event_caseId = etUnit_openTestCase("Eventdriven ActorCommunicationTest"); + async_caseId = etUnit_openTestCase("Async ActorCommunicationTest"); + + event_counter.caseId(event_caseId); + data_counter.caseId(data_caseId); + async_counter2.caseId(async_caseId); + + counter = 0; + finish_counter = 0; + data_finish_flag = false; + EXPECT_ORDER_START(data_caseId, data_result, 10); + EXPECT_ORDER_START(event_caseId, event_result, 10); + EXPECT_ORDER_START(async_caseId, async_result, 10); + timer.startTimer(400);''' } Transition tr0: tester_run -> tester_run { triggers { - - } - action { - "counter++;" - // "System.out.println(\"Timer: \"+counter);" - "event_counter.in1(counter);" - "data_counter.in1(counter);" - "async_counter1.in1(counter);" - "async_counter2.in1(counter);" + } + action ''' + counter++; + event_counter.in1(counter); + data_counter.in1(counter); + async_counter1.in1(counter); + async_counter2.in1(counter);''' } Transition tr1: tester_run -> tester_run { triggers { } - action { - // "System.out.println(\"Finish event\");" - "EXPECT_ORDER_END(event_caseId,\"<|MODEL_LOCATION|>\", 110);" - "etUnit_closeTestCase(event_caseId);" - "finish_counter++;" - } + action ''' + EXPECT_ORDER_END(event_caseId,"<|MODEL_LOCATION|>", 110); + etUnit_closeTestCase(event_caseId); + finish_counter++;''' } Transition tr2: tester_run -> tester_run { - guard { - "data_counter_finish.finish == true && data_finish_flag == false" - } - action { - - //"System.out.println(\"Finish transitionData\");" - "data_finish_flag = true;" - "EXPECT_ORDER_END(data_caseId,\"<|MODEL_LOCATION|>\", 10);" - "etUnit_closeTestCase(data_caseId);" - "finish_counter++;" - } + guard '''data_counter_finish.finish == true && data_finish_flag == false''' + action ''' + data_finish_flag = true; + EXPECT_ORDER_END(data_caseId,"<|MODEL_LOCATION|>", 10); + etUnit_closeTestCase(data_caseId); + finish_counter++;''' } Transition tr3: tester_run -> tester_run { triggers { } - action { - //"System.out.println(\"Finish async\");" - "EXPECT_ORDER_END(async_caseId,\"<|MODEL_LOCATION|>\", 1010);" - "etUnit_closeTestCase(async_caseId);" - "finish_counter++;" - } + action ''' + EXPECT_ORDER_END(async_caseId,"<|MODEL_LOCATION|>", 1010); + etUnit_closeTestCase(async_caseId); + finish_counter++;''' } Transition terminate: my tp0 -> my tp0 { - guard { - "finish_counter == 3" - } - action { - "etUnit_testFinished(event_caseId);" - } + guard '''finish_counter == 3''' + action '''etUnit_testFinished(event_caseId);''' } TransitionPoint tp0 State tester_run @@ -167,43 +149,27 @@ RoomModel ActorCommunicationTest { Behavior { StateMachine { Transition init: initial -> Idle { - action { - "counter = 0;" - } + action '''counter = 0;''' } Transition tr0: Idle -> Idle { - guard { - "data_counter.in1 != counter && data_counter.in1 % 2 == 1" - } - action { - "counter = data_counter.in1;" - - //"System.out.println(\"Async transitionData \"+counter);" - "EXPECT_ORDER(data_counter.caseId,\"<|MODEL_LOCATION|>\", counter + 1050);" - } + guard '''data_counter.in1 != counter && data_counter.in1 % 2 == 1''' + action ''' + counter = data_counter.in1; + EXPECT_ORDER(data_counter.caseId,"<|MODEL_LOCATION|>", counter + 1050);''' } Transition tr1: Idle -> Idle { triggers { - - } - action { - "counter = transitionData;" - - //"System.out.println(\"Async event \"+counter);" - "EXPECT_ORDER(data_counter.caseId,\"<|MODEL_LOCATION|>\", counter + 1000);" + } + action ''' + counter = transitionData; + EXPECT_ORDER(data_counter.caseId,"<|MODEL_LOCATION|>", counter + 1000);''' } Transition tr2: Idle -> state0 { triggers { - - } - action { - "event_counter.finish();" + } + action '''event_counter.finish();''' } State Idle State state0 @@ -223,39 +189,25 @@ RoomModel ActorCommunicationTest { Behavior { StateMachine { Transition init: initial -> state0 { - action { - "counter = 0;" - } + action '''counter = 0;''' } Transition tr0: state0 -> state0 { triggers { - - } - action { - - //"System.out.println(\"event \"+transitionData);" - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", transitionData+100);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", transitionData+100);''' } Transition tr1: state0 -> state1 { triggers { - - } - action { - "event_counter.finish();" + } + action '''event_counter.finish();''' } Transition tr2: state0 -> state0 { triggers { } - action { - "caseId = transitionData;" - } + action '''caseId = transitionData;''' } State state0 State state1 @@ -276,29 +228,19 @@ RoomModel ActorCommunicationTest { Behavior { StateMachine { Transition init: initial -> state0 { - action { - "counter = 0;" - "counter_finish.finish(false);" - } + action ''' + counter = 0; + counter_finish.finish(false);''' } Transition tr0: state0 -> state1 { - guard { - "data_counter.in1 == 10" - } - action { - "counter_finish.finish(true);" - } + guard '''data_counter.in1 == 10''' + action '''counter_finish.finish(true);''' } Transition tr1: state0 -> state0 { - guard { - "data_counter.in1 != counter && counter < 10" - } - action { - "counter = data_counter.in1;" - - //"System.out.println(\"transitionData \"+counter);" - "EXPECT_ORDER(data_counter.caseId, \"<|MODEL_LOCATION|>\", counter);" - } + guard '''data_counter.in1 != counter && counter < 10''' + action ''' + counter = data_counter.in1; + EXPECT_ORDER(data_counter.caseId, "<|MODEL_LOCATION|>", counter);''' } State state0 State state1 @@ -308,20 +250,19 @@ RoomModel ActorCommunicationTest { datadriven ProtocolClass Datadriven_PC { incoming { - Message caseId(data: int32) - Message in1(data: int32) - Message finish(data: boolean) + Message caseId(int32) + Message in1(int32) + Message finish(boolean) } } ProtocolClass Eventdriven_PC { incoming { - Message caseId(data: int32) - Message in1(data: int32) + Message caseId(int32) + Message in1(int32) } outgoing { Message finish() } } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room index 92fc9fcbb..5bfaed535 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room @@ -1,7 +1,8 @@ RoomModel ChoicePointTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.test.TestInstance ActorClass CPTest_Top { @TestInstance @@ -10,7 +11,8 @@ RoomModel ChoicePointTest { ActorRef cp_user: CPUser Binding cp_tester.TestPort1 and cp_user.TestPort1 } - Behavior { } + Behavior { + } } ActorClass CPUser { @@ -21,97 +23,67 @@ RoomModel ChoicePointTest { external Port TestPort1 Attribute counter: int32 Attribute caseId: int32 - Attribute resultlist[29]: int16 = "{1,2,3,4,5,6,3,4,5,7,8,10,11,12,9,16,3,4,5,17,8,13,15,11,19,12,9,18,20}" - + Attribute resultlist [29]: int16 = "{1,2,3,4,5,6,3,4,5,7,8,10,11,12,9,16,3,4,5,17,8,13,15,11,19,12,9,18,20}" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "ChoicePointTest", "org.eclipse.etrice.generator.common.tests.ChoicePointTest", "ChoicePointTest_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { Transition init: initial -> cp cp0 { - action { - "counter = 0;" - "EXPECT_ORDER_START(caseId,resultlist,29);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - } + action ''' + counter = 0; + EXPECT_ORDER_START(caseId,resultlist,29); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1);''' } Transition tr4: cp cp0 -> ENTRY3_EXIT4 { - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0);" - } + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0);''' } Transition EXPECT2: cp cp0 -> ENTRY3_EXIT4 { - cond { - "counter == 0" - } - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - } + cond '''counter == 0''' + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 2);''' } Transition EXPECT5: ENTRY3_EXIT4 -> cp cp1 { triggers { } - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - } + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 5);''' } Transition EXPECT6: cp cp1 -> ENTRY3_EXIT4 { - action { - "counter=3;" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - } + action ''' + counter=3; + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 6);''' } Transition EXPECT17: cp cp1 -> tp0 of ENTRY8_EXIT9 { - cond { - "counter == 4" - } - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - } + cond '''counter == 4''' + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 17);''' } Transition EXPECT7: cp cp1 -> ENTRY8_EXIT9 { - cond { - "counter == 3" - } - action { - "counter = 1;" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - } + cond '''counter == 3''' + action ''' + counter = 1; + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 7);''' } Transition EXPECT16: ENTRY8_EXIT9 -> ENTRY3_EXIT4 { triggers { - - } - action { - "counter=4;" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" + } + action ''' + counter=4; + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 16);''' } Transition EXPEXT19: my tp0 -> my tp0 { triggers { } - action { - "counter = 2;" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - } + action ''' + counter = 2; + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 19);''' } Transition EXPECT18: ENTRY8_EXIT9 -> testOk { triggers { - - } - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" + } + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 18);''' } Transition tr0: ENTRY3_EXIT4 -> cp cp1 { triggers { @@ -122,61 +94,38 @@ RoomModel ChoicePointTest { ChoicePoint cp1 handler TransitionPoint tp0 State ENTRY3_EXIT4 { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - } - exit { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - } + entry '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 3);''' + exit '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 4);''' } State ENTRY8_EXIT9 { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - } - exit { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - } + entry '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8);''' + exit '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9);''' subgraph { Transition EXPECT13: my tp0 -> cp cp0 { - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - } + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 13);''' } Transition EXPECT14: cp cp0 -> ENTRY11_EXIT12 { - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - } + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 14);''' } Transition EXPECT15: cp cp0 -> ENTRY11_EXIT12 { - cond { - "counter == 4" - } - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - } + cond '''counter == 4''' + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 15);''' } Transition init: initial -> ENTRY11_EXIT12 { - action { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - } + action '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 10);''' } ChoicePoint cp0 EntryPoint tp0 State ENTRY11_EXIT12 { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - } - exit { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - } + entry '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 11);''' + exit '''EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 12);''' } } } State testOk { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 20);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 20); + etUnit_testFinished(caseId);''' } } } @@ -192,14 +141,13 @@ RoomModel ChoicePointTest { Behavior { StateMachine { Transition init: initial -> state0 { - action { - "TestPort1.msg1(1);" - "TestPort1.msg1(2);" - "TestPort1.msg1(3);" - "TestPort1.msg1(4);" - "TestPort1.msg1(5);" - "TestPort1.msg1(6);" - } + action ''' + TestPort1.msg1(1); + TestPort1.msg1(2); + TestPort1.msg1(3); + TestPort1.msg1(4); + TestPort1.msg1(5); + TestPort1.msg1(6);''' } State state0 } @@ -208,12 +156,11 @@ RoomModel ChoicePointTest { ProtocolClass TestProtocol { incoming { - Message msg1(data: int32) - Message msg2(data: int32) - Message msg3(data: int32) - Message msg4(data: int32) - Message msg5(data: int32) + Message msg1(int32) + Message msg2(int32) + Message msg3(int32) + Message msg4(int32) + Message msg5(int32) } } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room index 4eebae58f..9d6e0ffd5 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room @@ -1,215 +1,188 @@ RoomModel ChoicePointTestExtended { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.test.TestInstance - SubSystemClass SubSystem_ChoicePointTestExtended { + ActorClass ChoicePointTestExtended_Top { @TestInstance - ActorRef tester_event: Tester_event + Structure { + ActorRef tester_event: Tester_event + } } abstract ActorClass Testee_event { Interface { - Port navPort : NavigationProtocol_event - Port testPort0 : CPTestProtocol_event - Port testPort1 : CPTestProtocol_inherited_event + Port navPort: NavigationProtocol_event + Port testPort0: CPTestProtocol_event + Port testPort1: CPTestProtocol_inherited_event } Structure { external Port navPort external Port testPort0 external Port testPort1 - Attribute caseId : int32 - Attribute testValue : int32 + Attribute caseId: int32 + Attribute testValue: int32 } Behavior { StateMachine { - Transition init: initial -> waiting { } + Transition init: initial -> waiting { + } Transition tr0: waiting -> testSubState { triggers { } - action { - "testValue = transitionData;" - } + action '''testValue = transitionData;''' } Transition tr1: waiting -> waiting { triggers { } - action { - "caseId = transitionData;" - } + action '''caseId = transitionData;''' } State testSubState { subgraph { - Transition init: initial -> cp cp0 { } + Transition init: initial -> cp cp0 { + } Transition tr0: cp cp0 -> state2 Transition tr1: cp cp0 -> state0 { - cond { - "testValue == 0" - } + cond '''testValue == 0''' } Transition tr2: cp cp0 -> state1 { - cond { - "testValue == 1" - } + cond '''testValue == 1''' } Transition tr3: my tp0 -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - } + action '''testValue = transitionData;''' } - + Transition tr6: my tp0 -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - } + action '''testValue = transitionData;''' } Transition tr7: my tp0 -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - } + action '''testValue = transitionData;''' } - - + ChoicePoint cp0 TransitionPoint tp0 - + State state0 { - entry { - "navPort.resultCP(1000);" - "testValue = -1;" - } + entry ''' + navPort.resultCP(1000); + testValue = -1;''' } State state1 { - entry { - "navPort.resultCP(1001);" - "testValue = -1;" - } + entry ''' + navPort.resultCP(1001); + testValue = -1;''' } State state2 { - entry { - "EXPECT_TRUE(caseId, \"testValue error\", testValue > 0);" - "navPort.resultCP(1002);" - "testValue = -1;" - } + entry ''' + EXPECT_TRUE(caseId, "testValue error", testValue > 0); + navPort.resultCP(1002); + testValue = -1;''' } - } } State waiting } } } - - ActorClass Testee_inherited_event extends Testee_event{ - Structure { } + + ActorClass Testee_inherited_event extends Testee_event { + Structure { + } Behavior { StateMachine { RefinedState testSubState { subgraph { Transition tr4: my tp1 -> simpleState { triggers { - + } } Transition tr5: simpleState -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(10);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(10); + navPort.onMessage(100);''' } Transition tr8: simpleState -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(100);''' } Transition tr9: simpleState -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(101);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(101);''' } Transition tr10: subState -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(10);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(10); + navPort.onMessage(100);''' } Transition tr11: subState -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(100);''' } Transition tr12: subState -> cp cp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(101);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(101);''' } Transition tr13: my tp1 -> subState { triggers { - + } } Transition tr14: my tp1 -> tp1 of exitPoints { triggers { - + } } Transition tr15: tp0 of exitPoints -> cp cp0 Transition tr16: my tp1 -> choicePoint { triggers { - + } } Transition tr17: cp cp1 -> cp cp0 @@ -217,58 +190,48 @@ RoomModel ChoicePointTestExtended { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(10);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(10); + navPort.onMessage(100);''' } Transition tr19: cp cp1 -> wrong { - cond { - "1 == 0" - } + cond '''1 == 0''' } Transition tr20: cp cp0 -> wrong { - cond { - "1 == 0" - } + cond '''1 == 0''' } Transition tr21: choicePoint -> cp cp1 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(100);''' } Transition tr22: choicePoint -> cp cp1 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(101);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(101);''' } ChoicePoint cp1 TransitionPoint tp1 State simpleState { - entry { - "navPort.onNode(1);" - } + entry '''navPort.onNode(1);''' } State subState { - entry { - "navPort.onNode(2);" - } + entry '''navPort.onNode(2);''' subgraph { - Transition init: initial -> state0 { } + Transition init: initial -> state0 { + } State state0 } } @@ -279,48 +242,41 @@ RoomModel ChoicePointTestExtended { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(10);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(10); + navPort.onMessage(100);''' } Transition tr2: state0 -> my tp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(100);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(100);''' } Transition tr3: state0 -> my tp0 { triggers { } - action { - "testValue = transitionData;" - "" - "navPort.onProtocol(11);" - "navPort.onMessage(101);" - } + action ''' + testValue = transitionData; + + navPort.onProtocol(11); + navPort.onMessage(101);''' } ExitPoint tp0 EntryPoint tp1 State state0 { - entry { - "navPort.onNode(3);" - } + entry '''navPort.onNode(3);''' } } } State choicePoint { - entry { - "navPort.onNode(4);" - } + entry '''navPort.onNode(4);''' } State wrong } @@ -331,32 +287,28 @@ RoomModel ChoicePointTestExtended { ActorClass Tester_event { Structure { - conjugated Port navPort : NavigationProtocol_event - conjugated Port testPort0 : CPTestProtocol_event - conjugated Port testPort1 : CPTestProtocol_inherited_event + conjugated Port navPort: NavigationProtocol_event + conjugated Port testPort0: CPTestProtocol_event + conjugated Port testPort1: CPTestProtocol_inherited_event ActorRef testee: Testee_inherited_event Binding navPort and testee.navPort Binding testPort0 and testee.testPort0 Binding testPort1 and testee.testPort1 - Attribute caseId : int32 - Attribute nodeId : int32 = "1" - Attribute protocolId : int32 = "0" - Attribute messageId : int32 = "0" - Attribute testValue : int32= "0" - - Attribute testOrder[148] : int16 = "{ 1001, 1000, 1002, 1, 10, 100, 1000, 1, 10, 100, 1001, 1, 10, 100, 1002, 1, 11, 100, 1000, 1, 11, 100, 1001, 1, 11, 100, 1002, 1, 11, 101, 1000, 1, 11, 101, 1001, 1, 11, 101, 1002, 2, 10, 100, 1000, 2, 10, 100, 1001, 2, 10, 100, 1002, 2, 11, 100, 1000, 2, 11, 100, 1001, 2, 11, 100, 1002, 2, 11, 101, 1000, 2, 11, 101, 1001, 2, 11, 101, 1002, 3, 10, 100, 1000, 3, 10, 100, 1001, 3, 10, 100, 1002, 3, 11, 100, 1000, 3, 11, 100, 1001, 3, 11, 100, 1002, 3, 11, 101, 1000, 3, 11, 101, 1001, 3, 11, 101, 1002, 4, 10, 100, 1000, 4, 10, 100, 1001, 4, 10, 100, 1002, 4, 11, 100, 1000, 4, 11, 100, 1001, 4, 11, 100, 1002, 4, 11, 101, 1000, 4, 11, 101, 1001, 4, 11, 101, 1002, 99 }" - Attribute testOrderSize : int32 = "148" - Attribute testNodes : int32 = "4" + Attribute caseId: int32 + Attribute nodeId: int32 = "1" + Attribute protocolId: int32 = "0" + Attribute messageId: int32 = "0" + Attribute testValue: int32 = "0" + + Attribute testOrder [148]: int16 = "{ 1001, 1000, 1002, 1, 10, 100, 1000, 1, 10, 100, 1001, 1, 10, 100, 1002, 1, 11, 100, 1000, 1, 11, 100, 1001, 1, 11, 100, 1002, 1, 11, 101, 1000, 1, 11, 101, 1001, 1, 11, 101, 1002, 2, 10, 100, 1000, 2, 10, 100, 1001, 2, 10, 100, 1002, 2, 11, 100, 1000, 2, 11, 100, 1001, 2, 11, 100, 1002, 2, 11, 101, 1000, 2, 11, 101, 1001, 2, 11, 101, 1002, 3, 10, 100, 1000, 3, 10, 100, 1001, 3, 10, 100, 1002, 3, 11, 100, 1000, 3, 11, 100, 1001, 3, 11, 100, 1002, 3, 11, 101, 1000, 3, 11, 101, 1001, 3, 11, 101, 1002, 4, 10, 100, 1000, 4, 10, 100, 1001, 4, 10, 100, 1002, 4, 11, 100, 1000, 4, 11, 100, 1001, 4, 11, 100, 1002, 4, 11, 101, 1000, 4, 11, 101, 1001, 4, 11, 101, 1002, 99 }" + Attribute testOrderSize: int32 = "148" + Attribute testNodes: int32 = "4" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - Operation test(){ - " + ctor '''caseId = etUnit_openAll("log", "ChoicePointTestExtended", "org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended", "ChoicePointTest_case");''' + dtor '''etUnit_closeAll(caseId);''' + Operation test() ''' + if(protocolId == 0) testPort0.testCP0(testValue); else if(protocolId == 1){ @@ -366,10 +318,9 @@ RoomModel ChoicePointTestExtended { testPort1.testCP1(testValue); } testValue++; - " - } - Operation next(){ - " + ''' + Operation next() ''' + if(testValue > 2){ testValue = 0; messageId++; @@ -386,148 +337,113 @@ RoomModel ChoicePointTestExtended { if(nodeId <= testNodes) navPort.toNode(nodeId); else { - EXPECT_ORDER_END(caseId, \"<|MODEL_LOCATION|>\", 99); + EXPECT_ORDER_END(caseId, "<|MODEL_LOCATION|>", 99); etUnit_testFinished(caseId); } - " - } - Operation check(value : int32){ - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", value);" - } + ''' + Operation check(value: int32) '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", value);''' StateMachine { Transition init: initial -> testInitial { - action { - "navPort.setCaseId(caseId);" - "EXPECT_ORDER_START(caseId, testOrder, testOrderSize);" - } + action ''' + navPort.setCaseId(caseId); + EXPECT_ORDER_START(caseId, testOrder, testOrderSize);''' } Transition tr0: testInitial -> testTr { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr7: testTr -> testTr1 { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr8: testTr1 -> testTr2 { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr1: testTr2 -> triggerTest { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr4: testPath -> testPath { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr5: testPath -> onCP { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr9: onCP -> triggerTest { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } Transition tr10: triggerTest -> testPath { triggers { } - action { - "check(transitionData);" - } + action '''check(transitionData);''' } State testInitial { - entry { - "testPort0.testInitialCP0(1);" - } + entry '''testPort0.testInitialCP0(1);''' } State testTr { - entry { - "testPort0.testTrCP0(0);" - } + entry '''testPort0.testTrCP0(0);''' } State triggerTest { - entry { - "test();" - } + entry '''test();''' } State testTr1 { - entry { - "testPort1.testTrCP0(2);" - } + entry '''testPort1.testTrCP0(2);''' } State testTr2 { - entry { - "next();" - } + entry '''next();''' } State testPath State onCP { - entry { - "next();" - } + entry '''next();''' } } } } - + ProtocolClass NavigationProtocol_event { incoming { - Message toNode(id: int32) - Message setCaseId(id : int32) + Message toNode(int32) + Message setCaseId(int32) } outgoing { - Message onNode(id: int32) - Message onProtocol(id : int32) - Message onMessage(id : int32) - Message resultCP(value: int32) + Message onNode(int32) + Message onProtocol(int32) + Message onMessage(int32) + Message resultCP(int32) } } ProtocolClass CPTestProtocol_event { incoming { - Message testCP0(value: int32) - Message testTrCP0(value : int32) - Message testInitialCP0(value : int32) + Message testCP0(int32) + Message testTrCP0(int32) + Message testInitialCP0(int32) } - } - - ProtocolClass CPTestProtocol_inherited_event extends CPTestProtocol_event{ - incoming{ - Message testCP1(value: int32) - Message testTrCP1(value : int32) + + ProtocolClass CPTestProtocol_inherited_event extends CPTestProtocol_event { + incoming { + Message testCP1(int32) + Message testTrCP1(int32) } } - - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTest.room new file mode 100644 index 000000000..2646da962 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTest.room @@ -0,0 +1,31 @@ +RoomModel CompileTest { + + import room.basic.types.int32 + import room.basic.test.TestInstance + import DetailExpressionTest.DetailExpressionTest + import StatemachineInterfaceTest.StatemachineInterfaceTest + import StatemachineInterfaceInheritedTest.StatemachineInterfaceInheritedTest + import ContinuationTransitionTest.ContinuationTransitionTest + + ActorClass CompileTests { + @TestInstance + Structure { + Attribute caseId : int32 + + // just compile + ActorRef statemachineInterfaceTest : StatemachineInterfaceTest + ActorRef statemachineInterfaceInheritedTest : StatemachineInterfaceInheritedTest + ActorRef continuationTransitionTest : ContinuationTransitionTest + } + Behavior { + ctor '''caseId = etUnit_openAll("log", "CompileTest", "org.eclipse.etrice.generator.common.tests.CompileTests", "CompileTests_case");''' + dtor '''etUnit_closeAll(caseId);''' + StateMachine { + Transition init: initial -> finish + State finish { + entry '''etUnit_testFinished(caseId);''' + } + } + } + } +} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room deleted file mode 100644 index f846c4db5..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room +++ /dev/null @@ -1,37 +0,0 @@ -RoomModel CompileTests { - - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - import DetailExpressionTestModel.DetailExpressionTest from "DetailExpressionTest.room" - import StatemachineInterfaceTestModel.StatemachineInterfaceTest from "StatemachineInterfaceTest.room" - import StatemachineInterfaceTestInheritedModel.StatemachineInterfaceInheritedTest from "StatemachineInterfaceInheritedTest.room" - import ContinuationTransitionTest.ContinuationTransitionTest from "ContinuationTransitionTest.room" - - ActorClass CompileTests { - @TestInstance - Structure { - Attribute caseId : int32 - - // just compile - ActorRef statemachineInterfaceTest : StatemachineInterfaceTest - ActorRef statemachineInterfaceInheritedTest : StatemachineInterfaceInheritedTest - ActorRef continuationTransitionTest : ContinuationTransitionTest - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> finish - State finish { - entry { - "etUnit_testFinished(caseId);" - } - } - } - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room index 516c50d1e..eee0e744e 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ContinuationTransitionTest.room @@ -1,31 +1,29 @@ RoomModel ContinuationTransitionTest { - - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - + + import room.basic.types.boolean + import room.basic.types.int32 + import room.basic.test.TestInstance + ActorClass ContinuationTransitionTest { Structure { ActorRef test1: TransitionChainsWithoutIfItem ActorRef test2: TransitionChainsWithSameMsgData ActorRef test3: TransitionChainsWithCompatibleData ActorRef test4: TransitionChainsWithInCompatibleData - ActorRef test5 : TransitionChainWithoutIfItem_Sub - - // not supported yet, TODO - //ActorRef test6 : TransitionChainWithData_Sub + ActorRef test5: TransitionChainWithoutIfItem_Sub + // not supported yet, TODO + // ActorRef test6 : TransitionChainWithData_Sub } } - + ActorClass TransitionChainsWithoutIfItem { Structure { - Port p0 : TestProtocol + Port p0: TestProtocol } Behavior { StateMachine { Transition continuationExit: exitPoint of substate -> endExit { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition init: initial -> entryPoint of substate Transition tr0: my startEntry -> entryPoint of substate { @@ -37,9 +35,7 @@ RoomModel ContinuationTransitionTest { State substate { subgraph { Transition continuationEntry: my entryPoint -> cp choicePoint { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition init: initial -> my exitPoint Transition triggerExit: startExit -> my exitPoint { @@ -48,17 +44,11 @@ RoomModel ContinuationTransitionTest { } } Transition continuationCpElse: cp choicePoint -> startExit { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition continuationCpCond: cp choicePoint -> endChoicePoint { - cond { - "true" - } - action { - "int x = 0;" - } + cond '''true''' + action '''int x = 0;''' } Transition triggerChoicePoint: my startChoicePoint -> cp choicePoint { triggers { @@ -77,11 +67,11 @@ RoomModel ContinuationTransitionTest { } } } - - ActorClass TransitionChainsWithSameMsgData { + + ActorClass TransitionChainsWithSameMsgData { Structure { - Attribute caseId : int32 - Port p0 : TestProtocol + Attribute caseId: int32 + Port p0: TestProtocol } Behavior { StateMachine { @@ -92,9 +82,7 @@ RoomModel ContinuationTransitionTest { } } Transition continuationExit: exitPoint of substate -> endExit { - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, transitionData);" - } + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, transitionData);''' } Transition tr0: startEntry2 -> entryPoint of substate { triggers { @@ -105,9 +93,7 @@ RoomModel ContinuationTransitionTest { State substate { subgraph { Transition continuationEntry: my entryPoint -> cp choicePoint { - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, transitionData);" - } + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, transitionData);''' } Transition triggerExit: startExit1 -> my exitPoint { triggers { @@ -115,17 +101,11 @@ RoomModel ContinuationTransitionTest { } } Transition continuationCpElse: cp choicePoint -> startExit1 { - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, transitionData);" - } + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, transitionData);''' } Transition continuationCpCond: cp choicePoint -> startExit2 { - cond { - "true" - } - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, transitionData);" - } + cond '''true''' + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, transitionData);''' } Transition triggerChoicePoint: my startChoicePoint -> cp choicePoint { triggers { @@ -150,11 +130,11 @@ RoomModel ContinuationTransitionTest { } } } - + ActorClass TransitionChainsWithCompatibleData { Structure { - Attribute caseId : int32 - Port p0 : TestProtocol + Attribute caseId: int32 + Port p0: TestProtocol } Behavior { StateMachine { @@ -165,9 +145,7 @@ RoomModel ContinuationTransitionTest { } } Transition continuationExit: exitPoint of substate -> endExit { - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, transitionData);" - } + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, transitionData);''' } Transition tr0: startEntry2 -> entryPoint of substate { triggers { @@ -178,9 +156,7 @@ RoomModel ContinuationTransitionTest { State substate { subgraph { Transition continuationEntry: my entryPoint -> cp choicePoint { - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, transitionData);" - } + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, transitionData);''' } Transition triggerExit: startExit1 -> my exitPoint { triggers { @@ -188,17 +164,11 @@ RoomModel ContinuationTransitionTest { } } Transition continuationCpElse: cp choicePoint -> startExit1 { - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, transitionData);" - } + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, transitionData);''' } Transition continuationCpCond: cp choicePoint -> startExit2 { - cond { - "true" - } - action { - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, transitionData);" - } + cond '''true''' + action '''EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, transitionData);''' } Transition triggerChoicePoint: my startChoicePoint -> cp choicePoint { triggers { @@ -223,19 +193,17 @@ RoomModel ContinuationTransitionTest { } } } - + ActorClass TransitionChainsWithInCompatibleData { Structure { - Attribute caseId : int32 - Port p0 : TestProtocol + Attribute caseId: int32 + Port p0: TestProtocol } Behavior { StateMachine { Transition init: initial -> startEntry2 Transition continuationExit: exitPoint of substate -> endExit { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition tr0: startEntry2 -> entryPoint of substate { triggers { @@ -251,9 +219,7 @@ RoomModel ContinuationTransitionTest { State substate { subgraph { Transition continuationEntry: my entryPoint -> cp choicePoint { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition triggerExit: startExit1 -> my exitPoint { triggers { @@ -261,17 +227,11 @@ RoomModel ContinuationTransitionTest { } } Transition continuationCpElse: cp choicePoint -> startExit1 { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition continuationCpCond: cp choicePoint -> startExit2 { - cond { - "caseId == 99" - } - action { - "int x = 0;" - } + cond '''caseId == 99''' + action '''int x = 0;''' } Transition triggerChoicePoint: my startChoicePoint -> cp choicePoint { triggers { @@ -296,10 +256,10 @@ RoomModel ContinuationTransitionTest { } } } - + abstract ActorClass TransitionChainWithData_Base { Structure { - Port p0 : TestProtocol + Port p0: TestProtocol } Behavior { StateMachine { @@ -310,17 +270,11 @@ RoomModel ContinuationTransitionTest { } } Transition tr1: cp cp0 -> state1 { - action { - "int x = transitionData;" - } + action '''int x = transitionData;''' } Transition tr2: cp cp0 -> state2 { - cond { - "true" - } - action { - "int x = transitionData;" - } + cond '''true''' + action '''int x = transitionData;''' } ChoicePoint cp0 State state0 @@ -329,7 +283,7 @@ RoomModel ContinuationTransitionTest { } } } - + // ActorClass TransitionChainWithData_Sub extends TransitionChainWithData_Base{ // Structure { } // Behavior { @@ -343,25 +297,18 @@ RoomModel ContinuationTransitionTest { // } // } // } - abstract ActorClass TransitionChainWithoutIfItem_Base { Structure { - Port p0 : TestProtocol + Port p0: TestProtocol } Behavior { StateMachine { Transition continuationChoicePointElse: cp cp0 -> endChoicePoint1 { - action { - "int x = 0;" - } + action '''int x = 0;''' } Transition continuationChoicePointCond: cp cp0 -> endChoicePoint2 { - cond { - "true" - } - action { - "int x = 0;" - } + cond '''true''' + action '''int x = 0;''' } Transition init: initial -> cp cp0 ChoicePoint cp0 @@ -370,9 +317,10 @@ RoomModel ContinuationTransitionTest { } } } - + ActorClass TransitionChainWithoutIfItem_Sub extends TransitionChainWithoutIfItem_Base { - Structure { } + Structure { + } Behavior { StateMachine { Transition triggerChoicePoint: startChoicePoint -> cp cp0 { @@ -384,14 +332,12 @@ RoomModel ContinuationTransitionTest { } } } - - - + ProtocolClass TestProtocol { incoming { - Message in1(data1 : int32) - Message in2(data2 : boolean) - Message in3(data3: int32) + Message in1(int32) + Message in2(boolean) + Message in3(int32) } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room index 92141b100..5b99bff1e 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -1,19 +1,20 @@ RoomModel DataDrivenTest { - - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" - - SubSystemClass SubSystem_DataDrivenTest { + + import room.basic.types.float32 + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService + import room.basic.test.TestInstance + + ActorClass DataDrivenTest_Top { @TestInstance - ActorRef appl: Appl - ActorRef timing: ATimingService - LayerConnection ref appl satisfied_by timing.timer - - // all unmapped instances are mapped to the default *physical* thread - //LogicalThread dflt_thread - //ActorInstanceMapping appl -> dflt_thread - //ActorInstanceMapping timing -> dflt_thread + Structure { + ActorRef appl: Appl + ActorRef timing: ATimingService + LayerConnection ref appl satisfied_by timing.timer + } } ActorClass Appl { @@ -22,8 +23,10 @@ RoomModel DataDrivenTest { ActorRef cli: Testee Binding srv.p0 and cli.p0 } - Behavior { } - } + Behavior { + } + } + async ActorClass Tester { Interface { conjugated Port p0: PC @@ -31,16 +34,15 @@ RoomModel DataDrivenTest { Structure { external Port p0 SAP timer: PTimer - + Attribute counter: int32 } Behavior { StateMachine { Transition init: initial -> Idle { - action { - "timer.startTimer(300);" - "counter = 0;" - } + action ''' + timer.startTimer(300); + counter = 0;''' } Transition tr0: Idle -> Idle { triggers { @@ -48,66 +50,56 @@ RoomModel DataDrivenTest { } } State Idle { - entry { - "p0.in1(counter++);" - } + entry '''p0.in1(counter++);''' } } } } + async ActorClass Testee { Interface { Port p0: PC } Structure { external Port p0 - + Attribute caseId: int32 Attribute counter: int32 - Attribute resultlist[10]: int16 = "{1,2,3,4,5,6,7,8,9,10}" + Attribute resultlist [10]: int16 = "{1,2,3,4,5,6,7,8,9,10}" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "DataDrivenTest", "org.eclipse.etrice.generator.common.tests.DataDrivenTest", "DataDrivenTest_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { Transition init: initial -> Idle { - action { - "counter = 0;" - } + action '''counter = 0;''' } Transition tr0: Idle -> Idle { - guard { - "p0.in1==counter" - } - action { - "if (p0.in1==1)" - " EXPECT_ORDER_START(caseId, resultlist, 10);" - "if (p0.in1<10)" - " EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", p0.in1);" - "else if (counter==10) {" - " EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 10);" - " etUnit_testFinished(caseId);" - "}" - "++counter;" - } + guard '''p0.in1==counter''' + action ''' + if (p0.in1==1) + EXPECT_ORDER_START(caseId, resultlist, 10); + if (p0.in1<10) + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", p0.in1); + else if (counter==10) { + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 10); + etUnit_testFinished(caseId); + } + ++counter;''' } State Idle } } } - + datadriven ProtocolClass PC { incoming { - Message in1(data: int32) - Message in2(data: int8) - Message in3(data: DC) + Message in1(int32) + Message in2(int8) + Message in3(DC) } } - + DataClass DC { Attribute x: float32 Attribute i: int32 diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionEnum.room b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionEnum.room index 7f32f9e4f..e44b02939 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionEnum.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionEnum.room @@ -1,6 +1,6 @@ RoomModel DetailExpressionEnum { - import DetailExpressionTypes.* from "DetailExpressionTypes.room" + import DetailExpressionTypes.ColorEnum Enumeration ProtocolEnum { RECV, ACK diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room index 3f9d1066d..8fa777157 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DetailExpressionTest.room @@ -1,8 +1,10 @@ -RoomModel DetailExpressionTestModel { +RoomModel DetailExpressionTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - import DetailExpressionEnum.* from "DetailExpressionEnum.room" + import room.basic.types.boolean + import room.basic.types.int32 + import room.basic.types.string + import room.basic.test.TestInstance + import DetailExpressionEnum.PEnumProtocol ActorClass DetailExpressionCompileTest { @TestInstance @@ -201,7 +203,7 @@ RoomModel DetailExpressionTestModel { ProtocolClass PEventdriven extends PEventdrivenBase { outgoing { - Message out1(accessibleMessageData: boolean) + Message out1(boolean) } regular PortClass { @@ -231,7 +233,7 @@ RoomModel DetailExpressionTestModel { datadriven ProtocolClass PDatadriven { incoming { - Message in1(data: int32) + Message in1(int32) } /* not supported yet * regular PortClass diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room index 97739a586..b3dd275fb 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room @@ -1,7 +1,8 @@ RoomModel EnumTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.test.TestInstance ActorClass EnumTest_Top { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys index da38a218e..27d2d5674 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys +++ b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys @@ -1,4 +1,4 @@ -PhysicalModel room.generic.physical { +PhysicalModel GenericPhysical { PhysicalSystem GenericPhysicalSystem { NodeRef node : GenericNodeClass diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room index a43e615f2..0aebcb9fd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room @@ -1,131 +1,93 @@ RoomModel HandlerTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.test.TestInstance ActorClass HandlerTest_Top { @TestInstance Structure { ActorRef tester: Tester ActorRef handlerUser: HandlerUser - + Binding tester.TestPort1 and handlerUser.TestPort1 } - Behavior { } + Behavior { + } } ActorClass HandlerUser { Interface { Port TestPort1: TestProtocol } - Structure { + Structure { external Port TestPort1 Attribute counter: int32 Attribute caseId: int32 - Attribute resultlist[44]: int16 = "{13,15,16,22,23,11,24,17,14,12,13,16,23,70,24,17,14,114,113,111,11,70,24,17,120,16,23,24,17,121,18,19,25,18,20,19,21,18,19,25,18,19,14,117}" + Attribute resultlist [44]: int16 = "{13,15,16,22,23,11,24,17,14,12,13,16,23,70,24,17,14,114,113,111,11,70,24,17,120,16,23,24,17,121,18,19,25,18,20,19,21,18,19,25,18,19,14,117}" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "HandlerTest", "org.eclipse.etrice.generator.common.tests.HandlerTest", "HandlerTest_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { Transition tr0: my tp0 -> my tp0 { triggers { } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 11);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 11);''' } Transition tr1: my tp1 -> my tp1 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 12);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 12);''' } Transition init: initial -> tp2 of state0 { - action { - "EXPECT_ORDER_START(caseId, resultlist, 44);" - } + action '''EXPECT_ORDER_START(caseId, resultlist, 44);''' } Transition tr9: state0 -> cp cp1 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 114);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 114);''' } Transition tr5: my tp1 -> my tp1 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 50);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 50);''' } Transition tr7: my tp0 -> state0 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 70);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 70);''' } Transition tr6: my tp0 -> my tp0 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 110);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 110);''' } Transition tr8: cp cp1 -> state1 { - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 113);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 113);''' } Transition tr10: cp cp1 -> state0 { - cond { - "transitionData!=4" - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 115);" - } + cond '''transitionData!=4''' + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 115);''' } Transition tr4: my tp1 -> testOk { triggers { } - action { - "EXPECT_ORDER_END(caseId, \"<|MODEL_LOCATION|>\", 117);" - } + action '''EXPECT_ORDER_END(caseId, "<|MODEL_LOCATION|>", 117);''' } ChoicePoint cp1 handler TransitionPoint tp0 TransitionPoint tp1 State state0 { - entry { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 13);" - } - exit { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 14);" - } + entry '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 13);''' + exit '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 14);''' subgraph { Transition tr0: state1 -> state2 { triggers { @@ -136,130 +98,82 @@ RoomModel HandlerTest { triggers { } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 20);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 20);''' } Transition tr2: my tp1 -> my tp1 { triggers { } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 21);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 21);''' } Transition tr3: state2 -> state2 { triggers { } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 25);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 25);''' } Transition tr4: my tp2 -> tp0 of state1 { - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 15);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 15);''' } Transition tr5: my tp0 -> my tp0 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 52);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 52);''' } Transition init: initial -> state2 { - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 53);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 53);''' } Transition tr6: state1 -> state1 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 54);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 54);''' } Transition tr7: my tp1 -> state1 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 120);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 120);''' } Transition tr8: my tp1 -> state2 { triggers { - - } - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 121);" + } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 121);''' } handler TransitionPoint tp0 TransitionPoint tp1 EntryPoint tp2 State state1 { - entry { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 16);" - } - exit { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 17);" - } + entry '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 16);''' + exit '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 17);''' subgraph { Transition tr0: my tp0 -> state7 { - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 22);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 22);''' } Transition init: initial -> state7 { - action { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 121);" - } + action '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 121);''' } EntryPoint tp0 State state7 { - entry { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 23);" - } - exit { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 24);" - } + entry '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 23);''' + exit '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 24);''' } } } State state2 { - entry { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 18);" - } - exit { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 19);" - } + entry '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 18);''' + exit '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 19);''' } } } State testOk { - entry { - "etUnit_testFinished(caseId);" - } + entry '''etUnit_testFinished(caseId);''' } State state1 { - entry { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 111);" - } - exit { - "EXPECT_ORDER(caseId, \"<|MODEL_LOCATION|>\", 112);" - } + entry '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 111);''' + exit '''EXPECT_ORDER(caseId, "<|MODEL_LOCATION|>", 112);''' } } } @@ -275,21 +189,20 @@ RoomModel HandlerTest { Behavior { StateMachine { Transition init: initial -> state0 { - action { - "TestPort1.msg1(2);" - "TestPort1.msg1(3);" - "TestPort1.msg1(7);" - "TestPort1.msg1(4);" - "TestPort1.msg1(5);" - "TestPort1.msg1(7);" - "TestPort1.msg2(5);" - "TestPort1.msg2(6);" - "TestPort1.msg1(5);" - "TestPort1.msg3();" - "TestPort1.msg4();" - "TestPort1.msg1(8);" - "TestPort1.msg6(12);" - } + action ''' + TestPort1.msg1(2); + TestPort1.msg1(3); + TestPort1.msg1(7); + TestPort1.msg1(4); + TestPort1.msg1(5); + TestPort1.msg1(7); + TestPort1.msg2(5); + TestPort1.msg2(6); + TestPort1.msg1(5); + TestPort1.msg3(); + TestPort1.msg4(); + TestPort1.msg1(8); + TestPort1.msg6(12);''' } State state0 } @@ -298,13 +211,12 @@ RoomModel HandlerTest { ProtocolClass TestProtocol { incoming { - Message msg1(p1:int32) - Message msg2(p1:int32) + Message msg1(int32) + Message msg2(int32) Message msg3() Message msg4() - Message msg5(p1:int32) - Message msg6(p1:int32) + Message msg5(int32) + Message msg6(int32) } } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room index f98190fcc..d8bc33ce1 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room @@ -1,7 +1,7 @@ RoomModel OperationInheritanceTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.types.int32 + import room.basic.test.TestInstance async ActorClass OperationInheritanceTest extends BaseActor { @TestInstance @@ -9,42 +9,36 @@ RoomModel OperationInheritanceTest { Attribute testDataClass: SubDataClass } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" - "ctorRefine = 2;" - } - dtor { - "// sub dtor" - "etUnit_closeAll(caseId);" - } - override Operation overriddenOperation() { - "valueSub = 2;" - } + ctor ''' + caseId = etUnit_openAll("log", "OperationInheritanceTest", "org.eclipse.etrice.generator.common.tests.OperationInheritanceTest", "OperationInheritanceTest_case"); + ctorRefine = 2;''' + dtor ''' + // sub dtor + etUnit_closeAll(caseId);''' + override Operation overriddenOperation() '''valueSub = 2;''' StateMachine { Transition init: initial -> finish { - action { - "baseOperation();" - "overriddenOperation();" - "// c: not supported yet" - "//testDataClass.baseOperation();" - "//testDataClass.overriddenOperation(caseId);" - "" - "// refine ctor, override operations" - "// -- ActorClass" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, ctorBase);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, ctorRefine);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, valueBase);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, valueSub);" - "" - "// -- DataClass" + action ''' + baseOperation(); + overriddenOperation(); // c: not supported yet - "//EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, testDataClass.ctorBase);" - "//EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, testDataClass.ctorRefine);" - "//EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, testDataClass.valueBase);" - "//EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, testDataClass.valueSub);" - "//EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, testDataClass.doNotCallOverride);" - "etUnit_testFinished(caseId);" - } + //testDataClass.baseOperation(); + //testDataClass.overriddenOperation(caseId); + + // refine ctor, override operations + // -- ActorClass + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, ctorBase); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, ctorRefine); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, valueBase); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, valueSub); + + // -- DataClass + //EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, testDataClass.ctorBase); + //EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, testDataClass.ctorRefine); + //EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, testDataClass.valueBase); + //EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, testDataClass.valueSub); + //EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 0, testDataClass.doNotCallOverride); + etUnit_testFinished(caseId);''' } State finish } @@ -53,43 +47,29 @@ RoomModel OperationInheritanceTest { abstract async ActorClass BaseActor { Structure { - Attribute caseId : int32 + Attribute caseId: int32 Attribute ctorBase: int32 = "0" Attribute ctorRefine: int32 = "0" Attribute valueBase: int32 = "0" Attribute valueSub: int32 = "0" } Behavior { - ctor { - "ctorBase = 1;" - "ctorRefine = 1;" - } - dtor { - "// base dtor" - } - Operation overriddenOperation() { - "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", true);" - } - Operation baseOperation() { - "valueBase = 1;" - } + ctor ''' + ctorBase = 1; + ctorRefine = 1;''' + dtor '''// base dtor''' + Operation overriddenOperation() '''EXPECT_FALSE(caseId, "<|MODEL_LOCATION|>", true);''' + Operation baseOperation() '''valueBase = 1;''' } } DataClass BaseDataClass { - Operation overriddenOperation() { - "doNotCallOverride = 1;" - } - Operation baseOperation() { - "valueBase = 1;" - } - ctor { - "ctorBase = 1;" - "ctorRefine = 1;" - } - dtor { - "// base dtor" - } + Operation overriddenOperation() '''doNotCallOverride = 1;''' + Operation baseOperation() '''valueBase = 1;''' + ctor ''' + ctorBase = 1; + ctorRefine = 1;''' + dtor '''// base dtor''' Attribute ctorBase: int32 = "0" Attribute ctorRefine: int32 = "0" Attribute valueBase: int32 = "0" @@ -98,15 +78,8 @@ RoomModel OperationInheritanceTest { } DataClass SubDataClass extends BaseDataClass { - override Operation overriddenOperation() { - "valueSub = 2;" - } - ctor { - "ctorRefine = 2;" - } - dtor { - "// sub dtor" - } + override Operation overriddenOperation() '''valueSub = 2;''' + ctor '''ctorRefine = 2;''' + dtor '''// sub dtor''' } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap index 9b8d078af..daebe5ab8 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap @@ -1,7 +1,7 @@ MappingModel PingPongThreadReplPortTest { - import PingPongThreadReplPortTest.* from "PingPongThreadReplPortTest.room" - import PingPongThread.* from "PingPongThread.etphys" + import PingPongThreadReplPortTest.System_PingPongReplPort + import PingPongThread.Sys Mapping System_PingPongReplPort -> Sys { SubSystemMapping main -> node1 { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room index f0e904bdb..062ded6cd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room @@ -1,17 +1,20 @@ RoomModel PingPongThreadReplPortTest { - import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService + - LogicalSystem System_PingPongReplPort{ - SubSystemRef main : SubSystem_PingPongReplPort + LogicalSystem System_PingPongReplPort { + SubSystemRef main: SubSystem_PingPongReplPort } - + SubSystemClass SubSystem_PingPongReplPort { ActorRef application: PingPongTop ActorRef services: ATimingService LayerConnection ref application satisfied_by services.timer - + LogicalThread mrPingThread LogicalThread mrPong1Thread LogicalThread mrPong2Thread @@ -34,89 +37,73 @@ RoomModel PingPongThreadReplPortTest { Binding MrPing.PingPongPort and MrPong2.PingPongPort Binding MrPing.PingPongPort3 and MrPong3.PingPongPort } - Behavior { } + Behavior { + } } ActorClass MrPingActor { Interface { conjugated Port PingPongPort [*]: PingPongProtocol - conjugated Port PingPongPort3 : PingPongProtocol + conjugated Port PingPongPort3: PingPongProtocol } Structure { external Port PingPongPort external Port PingPongPort3 SAP timer: PTimer - Attribute count : int32 - Attribute pongCount : int32 + Attribute count: int32 + Attribute pongCount: int32 Attribute caseId: int32 - Attribute resultlist[23]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - + Attribute resultlist [23]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "PingPongThreadReplPortTest", "org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort", "PingPongThreadTestReplPort_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { Transition tr0: initial -> waitForTimer { - action { - "count = 0;" - "timer.startTimeout(200);" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - } + action ''' + count = 0; + timer.startTimeout(200); + EXPECT_ORDER_START(caseId,resultlist,23); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1);''' } Transition tr1: waitForTimer -> waitForPong { triggers { } - action { - "PingPongPort[0].ping();" - "PingPongPort[1].ping();" - "pongCount = 0;" - } + action ''' + PingPongPort[0].ping(); + PingPongPort[1].ping(); + pongCount = 0;''' } Transition tr3: waitForPong -> cp cp0 { triggers { - - } - action { - "pongCount++;" + } + action '''pongCount++;''' } Transition tr5: cp cp0 -> cp cp1 { - action { - "//System.out.println(count);" - } + action '''//System.out.println(count);''' } Transition tr6: cp cp0 -> waitForPong { - cond { - "pongCount < 2" - } + cond '''pongCount < 2''' } Transition tr2: cp cp1 -> test_finished Transition tr4: cp cp1 -> waitForTimer { - cond { - "count<20" - } - action { - "timer.startTimeout(20);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", count+2);" - "count++;" - } + cond '''count<20''' + action ''' + timer.startTimeout(20); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", count+2); + count++;''' } ChoicePoint cp0 ChoicePoint cp1 State waitForTimer State waitForPong State test_finished { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 22); + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 23); + etUnit_testFinished(caseId);''' } } } @@ -131,20 +118,19 @@ RoomModel PingPongThreadReplPortTest { } Behavior { StateMachine { - Transition tr0: initial -> waitForPing { } + Transition tr0: initial -> waitForPing { + } Transition myTrigger: waitForPing -> waitForPing { triggers { } - action { - "PingPongPort.pong();" - } + action '''PingPongPort.pong();''' } State waitForPing } } } - + ProtocolClass PingPongProtocol { incoming { Message ping() @@ -153,5 +139,4 @@ RoomModel PingPongThreadReplPortTest { Message pong() } } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap index 4aa1aaaeb..b3798b5e5 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap @@ -1,8 +1,7 @@ MappingModel PingPongThreadTest { - import PingPongThreadTest.* from "PingPongThreadTest.room" - //import PingPongThreadTestReplPort.* from "PingPongThreadTestReplPort.room" - import PingPongThread.* from "PingPongThread.etphys" + import PingPongThreadTest.System_PingPong + import PingPongThread.Sys Mapping System_PingPong -> Sys { SubSystemMapping main -> node1 { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room index 8a4f147ab..116664d4c 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room @@ -1,17 +1,19 @@ RoomModel PingPongThreadTest { - import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService - LogicalSystem System_PingPong{ - SubSystemRef main : SubSystem_PingPong + LogicalSystem System_PingPong { + SubSystemRef main: SubSystem_PingPong } - + SubSystemClass SubSystem_PingPong { ActorRef application: PingPongTop ActorRef services: ATimingService LayerConnection ref application satisfied_by services.timer - + LogicalThread mrPingThread LogicalThread mrPong1Thread LogicalThread mrPong2Thread @@ -34,94 +36,75 @@ RoomModel PingPongThreadTest { Binding MrPing.PingPongPort2 and MrPong2.PingPongPort Binding MrPing.PingPongPort3 and MrPong3.PingPongPort } - Behavior { } + Behavior { + } } ActorClass MrPingActor { Interface { - conjugated Port PingPongPort : PingPongProtocol - conjugated Port PingPongPort2 : PingPongProtocol - conjugated Port PingPongPort3 : PingPongProtocol + conjugated Port PingPongPort: PingPongProtocol + conjugated Port PingPongPort2: PingPongProtocol + conjugated Port PingPongPort3: PingPongProtocol } Structure { - external Port PingPongPort + external Port PingPongPort external Port PingPongPort2 external Port PingPongPort3 SAP timer: PTimer - Attribute count : int32 - Attribute pongCount : int32 + Attribute count: int32 + Attribute pongCount: int32 Attribute caseId: int32 - Attribute resultlist[23]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - + Attribute resultlist [23]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "PingPongThreadTest", "org.eclipse.etrice.generator.common.tests.PingPongThreadTest", "PingPongThreadTest_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { Transition tr0: initial -> waitForTimer { - action { - "count = 0;" - "timer.startTimeout(10);" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - - } + action ''' + count = 0; + timer.startTimeout(10); + EXPECT_ORDER_START(caseId,resultlist,23); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1);''' } Transition tr1: waitForTimer -> waitForPong { triggers { } - action { - "PingPongPort.ping();" - "PingPongPort2.ping();" - "pongCount = 0;" - } + action ''' + PingPongPort.ping(); + PingPongPort2.ping(); + pongCount = 0;''' } Transition tr3: waitForPong -> cp cp0 { triggers { - - or - - } - action { - "pongCount++;" + or } + action '''pongCount++;''' } Transition tr5: cp cp0 -> cp cp1 { - action { - "//System.out.println(count);" - } + action '''//System.out.println(count);''' } Transition tr6: cp cp0 -> waitForPong { - cond { - "pongCount < 2" - } + cond '''pongCount < 2''' } Transition tr2: cp cp1 -> test_finished Transition tr4: cp cp1 -> waitForTimer { - cond { - "count<20" - } - action { - "timer.startTimeout(5);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", count+2);" - "count++;" - } + cond '''count<20''' + action ''' + timer.startTimeout(5); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", count+2); + count++;''' } ChoicePoint cp0 ChoicePoint cp1 State waitForTimer State waitForPong State test_finished { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 22); + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 23); + etUnit_testFinished(caseId);''' } } } @@ -136,20 +119,19 @@ RoomModel PingPongThreadTest { } Behavior { StateMachine { - Transition tr0: initial -> waitForPing { } + Transition tr0: initial -> waitForPing { + } Transition myTrigger: waitForPing -> waitForPing { triggers { } - action { - "PingPongPort.pong();" - } + action '''PingPongPort.pong();''' } State waitForPing } } } - + ProtocolClass PingPongProtocol { incoming { Message ping() @@ -158,5 +140,4 @@ RoomModel PingPongThreadTest { Message pong() } } - } diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room index 4a23a2d4c..e5fbbefb3 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceInheritedTest.room @@ -1,7 +1,11 @@ -RoomModel StatemachineInterfaceTestInheritedModel { - - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import StatemachineInterfaceTestModel.* from "StatemachineInterfaceTest.room" +RoomModel StatemachineInterfaceInheritedTest { + + import StatemachineInterfaceTest.AsyncApp + import StatemachineInterfaceTest.DataApp + import StatemachineInterfaceTest.EventApp + import StatemachineInterfaceTest.EmptyAsyncApp + import StatemachineInterfaceTest.EmptyDataApp + import StatemachineInterfaceTest.EmptyEventApp ActorClass StatemachineInterfaceInheritedTest { Structure { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room index c1e2e0b0f..f424be669 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/StatemachineInterfaceTest.room @@ -1,6 +1,6 @@ -RoomModel StatemachineInterfaceTestModel { +RoomModel StatemachineInterfaceTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" + import room.basic.types.boolean ActorClass StatemachineInterfaceTest { Structure { @@ -117,7 +117,7 @@ RoomModel StatemachineInterfaceTestModel { datadriven ProtocolClass DataProtocol { incoming { - Message in1(data: boolean) + Message in1(boolean) } } diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room index d93962daa..71ff99dd5 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room @@ -1,8 +1,7 @@ RoomModel SubSystemUserCodeTest { - import room.basic.annotations.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Annotations.room" - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room" + import room.basic.annotations.SubSystemUserCode + import room.basic.test.TestInstance ActorClass AGeneratedUserCode { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room index fedbbd653..12933cbce 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room @@ -1,7 +1,9 @@ RoomModel VarargsTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" - import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" + import room.basic.types.boolean + import room.basic.types.int32 + import room.basic.types.string + import room.basic.test.TestInstance ActorClass AVarargs { @TestInstance diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room deleted file mode 100644 index 67e47ef7e..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room +++ /dev/null @@ -1,605 +0,0 @@ -RoomModel SendingDataTestCpp { - - import room.basic.etunit.* from "../Tests.room" - import room.basic.types.* from "../Types.room" - import room.basic.language.* from "../Language.room" - - ActorClass SendingDataTop { - @TestInstance - Structure { - ActorRef mrPing: MrPing - ActorRef mrPong: MrPong - Binding mrPong.PingPongPort and mrPing.PingPongPort - } - Behavior { } - } - - ActorClass MrPong { - Interface { - Port PingPongPort: PingPongProtocol - Port extTest: PCExternal - } - Structure { - external Port PingPongPort - external Port extTest - } - Behavior { - StateMachine { - Transition tr0: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(transitionData);" - } - } - Transition tr1: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt8(transitionData);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt32(transitionData);" - } - } - Transition tr3: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat32(transitionData);" - } - } - Transition tr4: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat64(transitionData);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*transitionData)+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "(*transitionData)!=5" - } - action { - "PingPongPort.pongInt32(*transitionData);" - } - } - Transition tr9: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(transitionData);" - } - } - Transition tr11: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(*transitionData);" - } - } - Transition tr5: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt64(transitionData);" - } - } - Transition tr10: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(*transitionData);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(*transitionData);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(*transitionData);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "transitionData->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(*transitionData);" - } - } - Transition tr15: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplexDerived(transitionData);" - } - } - Transition tr16: my tp0 -> my tp0 { - triggers { - - } - } - ChoicePoint cp0 - ChoicePoint cp1 - TransitionPoint tp0 - State reply - } - } - } - - ActorClass MrPing { - Interface { - conjugated Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" - Attribute i32Val: int32 = "4711" - Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32 = "{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14f" - Attribute f64Val: float64="7.987654321" - Attribute data: PingPongData - Attribute dataD: PingPongDataDerived - Attribute counter:int32 - Attribute caseId: int32 - Attribute lang: languageIndicator - Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - } - Behavior { - StateMachine { - Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log/testlog\", \"SendingDataTestCpp\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "/* send the default values */" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - } - } - Transition tr0: tp1 of state0 -> tp0 of state1 - Transition tr1: tp1 of state1 -> test_finished - State state0 { - subgraph { - Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } - } - Transition tr1: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (transitionData==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (transitionData==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>3)&&(transitionData<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>7)&&(transitionData<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>13)&&(transitionData<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>28)&&(transitionData<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - - } - action { - "if (transitionData==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (transitionData==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (transitionData==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State receiveFirst7 - State receiveSecond7 - } - } - State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } - } - State state1 { - subgraph { - Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "/* send default values */" - "PingPongPort.pingComplex(data);" - "PingPongPort.pingComplexRef(&data);" - } - } - Transition tr1: state0 -> state1 { - triggers { - - } - action { - "counter=0;" - "if (transitionData.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.complexVal.i32Val2PPDD==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8ValPPD=11;" - "PingPongPort.pingComplexDerived(dataD);" - } - } - Transition tr2: state0 -> state0 { - triggers { - - } - action { - "counter++;" - "if (transitionData.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - - } - action { - "if (transitionData.i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.i32Val3PPDe==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State state0 - State state1 - } - } - } - } - } - - ProtocolClass PingPongProtocol { - incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) - } - outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) - } - } - - ProtocolClass PCExternal { - usercode1 { - "typedef int extMsg;" - } - incoming { - Message in1(can: DExtMsg) - } - } - - DataClass PingPongData { - Attribute i8ValPPD: int8 = "10" - Attribute i8ValRefPPD: int8 ref - Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRefPPD [ 2 ]: int8 ref - Attribute complexVal: PingPongDataDeep - } - - DataClass PingPongDataDeep { - Attribute i32Val1PPDD: int32 - Attribute i32Val2PPDD: int32 = "80" - } - - DataClass PingPongDataDerived extends PingPongData { - Attribute i32Val3PPDe: int32 = "150" - } - - ExternalType DExtMsg -> "extMsg" -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room deleted file mode 100644 index e71238b9b..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room +++ /dev/null @@ -1,586 +0,0 @@ -RoomModel SendingDataTestJava { - - import room.basic.etunit.* from "../Tests.room" - import room.basic.types.* from "../Types.room" - import room.basic.language.* from "../Language.room" - - ActorClass SendingDataTop { - @TestInstance - Structure { - ActorRef mrPing: MrPing - ActorRef mrPong: MrPong - Binding mrPong.PingPongPort and mrPing.PingPongPort - } - Behavior { } - } - - ActorClass MrPong { - Interface { - Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - } - Behavior { - StateMachine { - Transition tr0: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(transitionData);" - } - } - Transition tr1: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt8(transitionData);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt32(transitionData);" - } - } - Transition tr3: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat32(transitionData);" - } - } - Transition tr4: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongFloat64(transitionData);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32(transitionData+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "transitionData!=5" - } - action { - "PingPongPort.pongInt32(transitionData);" - } - } - Transition tr9: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(transitionData);" - } - } - Transition tr11: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplex(transitionData);" - } - } - Transition tr5: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt64(transitionData);" - } - } - Transition tr10: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongInt16(transitionData);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - - } - action { - "PingPongPort.pongComplex(transitionData);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(transitionData);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "transitionData.i8Val==7" - } - action { - "PingPongPort.pongComplex(transitionData);" - } - } - Transition tr15: reply -> reply { - triggers { - - } - action { - "PingPongPort.pongComplexDerived(transitionData);" - } - } - ChoicePoint cp0 - ChoicePoint cp1 - State reply - } - } - } - - ActorClass MrPing { - Interface { - conjugated Port PingPongPort: PingPongProtocol - } - Structure { - external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" - Attribute i32Val: int32 = "4711" - Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32="{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14" - Attribute f64Val: float64="7.987654321" - Attribute data: PingPongData - Attribute dataD: PingPongDataDerived - Attribute counter:int32 - Attribute caseId: int32 - Attribute lang: languageIndicator - Attribute resultlist [ 18 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" - } - Behavior { - StateMachine { - Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log/testlog\", \"SendingDataTestJava\", \"org.eclipse.etrice.generator.common.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "// send the default values" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(i16Val);" - "PingPongPort.pingInt32Ref(i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(i16Val);" - "PingPongPort.pingInt32Ref(i32Val);" - } - } - Transition tr0: tp1 of state0 -> tp0 of state1 - Transition tr1: tp1 of state1 -> test_finished - State state0 { - subgraph { - Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } - } - Transition tr1: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (transitionData==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (transitionData==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>3)&&(transitionData<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>7)&&(transitionData<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>13)&&(transitionData<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if ((transitionData>28)&&(transitionData<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - - } - action { - "if (transitionData==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (transitionData==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (transitionData==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - - } - action { - "counter++;" - "if (transitionData==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State receiveFirst7 - State receiveSecond7 - } - } - State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } - } - State state1 { - subgraph { - Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "// send default values" - "PingPongPort.pingComplex(data);" - "PingPongPort.pingComplexRef(data);" - } - } - Transition tr1: state0 -> state1 { - triggers { - - } - action { - "counter=0;" - "if (transitionData.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.complexVal.i32Val2==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8Val=11;" - "PingPongPort.pingComplexDerived(dataD);" - } - } - Transition tr2: state0 -> state0 { - triggers { - - } - action { - "counter++;" - "if (transitionData.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - - } - action { - "if (transitionData.i8Val==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.i32Val3==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - EntryPoint tp0 - ExitPoint tp1 - State state0 - State state1 - } - } - } - } - } - - ProtocolClass PingPongProtocol { - incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) - } - outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) - } - } - - DataClass PingPongData { - Attribute i8Val: int8 = "10" - Attribute i8ValRef: int8 ref - Attribute i32Array [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRef [ 2 ]: int8 ref - Attribute complexVal: PingPongDataDeep - } - - DataClass PingPongDataDeep { - Attribute i32Val1: int32 - Attribute i32Val2: int32 = "80" - } - - DataClass PingPongDataDerived extends PingPongData { - Attribute i32Val3: int32 = "150" - } -} diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle index d7796b293..0b0612eb3 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle @@ -2,6 +2,11 @@ apply plugin: 'cpp' apply from: "$rootDir/gradle/etTest.gradle" +dependencies { + modelpath_cpp project(path: ':runtime:org.eclipse.etrice.modellib.cpp', configuration: 'modelpath_cpp') + modelpath_cpp files('models') +} + def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' createTest('cpp', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/modelpath b/tests/org.eclipse.etrice.generator.cpp.tests/modelpath new file mode 100644 index 000000000..2d9129768 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/modelpath @@ -0,0 +1,2 @@ +srcDir models +project org.eclipse.etrice.modellib.cpp \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room index 7d1ccfb7f..dc3b671a8 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room @@ -1,88 +1,83 @@ RoomModel InitializationTest { - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Types.room" - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room" + import room.basic.types.boolean + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.test.TestInstance async ActorClass InitializationTest { @TestInstance Structure { - usercode1 { - "struct structType {" - " int32 number;" - " structType* refStruct;" - "} typedef structType;" - "" - "class ClassType {" - "public:" - " ClassType(bool boolAttr, int32 number) : boolAttr(boolAttr), number(number) {}" - "" - " bool boolAttr;" - " int32 number;" - "};" - } - Attribute caseId : int16 + usercode1 ''' + struct structType { + int32 number; + structType* refStruct; + } typedef structType; + + class ClassType { + public: + ClassType(bool boolAttr, int32 number) : boolAttr(boolAttr), number(number) {} + + bool boolAttr; + int32 number; + };''' + Attribute caseId: int16 // c/c++ struct Attribute structAttr1: structType Attribute structAttr2: structType = "{2, NULL}" - Attribute arrayStructAttr[2]: structType = "{{1, NULL}, {2, NULL}}" + Attribute arrayStructAttr [2]: structType = "{{1, NULL}, {2, NULL}}" // static array - Attribute arrayInt32Attr1[5]: int32 - Attribute arrayInt32Attr2[5]: int32 = "" - Attribute arrayInt32Attr3[5]: int32 = "1" - Attribute arrayInt32Attr4[5]: int32 = "{1, 2, 3, 4, 5}" + Attribute arrayInt32Attr1 [5]: int32 + Attribute arrayInt32Attr2 [5]: int32 = "" + Attribute arrayInt32Attr3 [5]: int32 = "1" + Attribute arrayInt32Attr4 [5]: int32 = "{1, 2, 3, 4, 5}" // data class - Attribute dataClassAttr1 : SubDataClass - Attribute dataClassAttr2 : SubDataClass = "true, 2" - // Attribute arrayDataClassAttr[2]: SubDataClass // = "..." init NOT possible + Attribute dataClassAttr1: SubDataClass + Attribute dataClassAttr2: SubDataClass = "true, 2" + // Attribute arrayDataClassAttr[2]: SubDataClass // = "..." init NOT possible // external class - Attribute extClassAttr1 : ClassType - Attribute extClassAttr2 : ClassType = "true, 2" - // Attribute arrayExtClassAttr[2] : ClassType // = "..." init NOT possible + Attribute extClassAttr1: ClassType + Attribute extClassAttr2: ClassType = "true, 2" + // Attribute arrayExtClassAttr[2] : ClassType // = "..." init NOT possible } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" - "testInitValues(caseId);" - } - dtor { - "etUnit_closeAll(caseId);" - } - Operation testInitValues(caseId : int16) { - "// c/c++ struct" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, structAttr1.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", structAttr1.refStruct == NULL);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, structAttr2.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", structAttr2.refStruct == NULL);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayStructAttr[0].number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", arrayStructAttr[0].refStruct == NULL);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, arrayStructAttr[1].number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", arrayStructAttr[1].refStruct == NULL);" - "// static array" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, arrayInt32Attr1[0]);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayInt32Attr3[0]);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 1, arrayInt32Attr4[0]);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 5, arrayInt32Attr4[4]);" - "// data class" - "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", dataClassAttr1.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, dataClassAttr1.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", dataClassAttr2.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, dataClassAttr2.number);" - "// external class" - "EXPECT_FALSE(caseId, \"<|MODEL_LOCATION|>\", extClassAttr1.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 0, extClassAttr1.number);" - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", extClassAttr2.boolAttr);" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, extClassAttr2.number);" - } + ctor ''' + caseId = etUnit_openAll("log", "InitializationTest", "org.eclipse.etrice.generator.cpp.tests.InitializationTest", "InitializationTest_case"); + testInitValues(caseId);''' + dtor '''etUnit_closeAll(caseId);''' + Operation testInitValues(caseId: int16) ''' + // c/c++ struct + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, structAttr1.number); + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", structAttr1.refStruct == NULL); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, structAttr2.number); + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", structAttr2.refStruct == NULL); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, arrayStructAttr[0].number); + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", arrayStructAttr[0].refStruct == NULL); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, arrayStructAttr[1].number); + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", arrayStructAttr[1].refStruct == NULL); + // static array + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 0, arrayInt32Attr1[0]); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, arrayInt32Attr3[0]); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 1, arrayInt32Attr4[0]); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 5, arrayInt32Attr4[4]); + // data class + EXPECT_FALSE(caseId, "<|MODEL_LOCATION|>", dataClassAttr1.boolAttr); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 0, dataClassAttr1.number); + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", dataClassAttr2.boolAttr); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, dataClassAttr2.number); + // external class + EXPECT_FALSE(caseId, "<|MODEL_LOCATION|>", extClassAttr1.boolAttr); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 0, extClassAttr1.number); + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", extClassAttr2.boolAttr); + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, extClassAttr2.number);''' - StateMachine { + StateMachine { State finish { - entry { - "etUnit_testFinished(caseId);" - } + entry '''etUnit_testFinished(caseId);''' } Transition init: initial -> finish } @@ -90,15 +85,13 @@ RoomModel InitializationTest { } DataClass BaseDataClass { - Attribute boolAttr : boolean + Attribute boolAttr: boolean } DataClass SubDataClass extends BaseDataClass { - Attribute number : int32 + Attribute number: int32 } ExternalType ClassType -> "ClassType" default "false, 0" ExternalType structType -> "structType" default "{1, NULL}" - - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room index 9f6d42b55..349fa45bd 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/SendingDataTest.room @@ -1,8 +1,13 @@ RoomModel SendingDataTest { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Types.room" - import room.basic.language.* from "../../../runtime/org.eclipse.etrice.modellib.cpp/model/Language.room" + + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.int64 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.test.TestInstance + import room.basic.language.languageIndicator ActorClass SendingDataTop { @TestInstance @@ -11,7 +16,8 @@ RoomModel SendingDataTest { ActorRef mrPong: MrPong Binding mrPong.PingPongPort and mrPing.PingPongPort } - Behavior { } + Behavior { + } } ActorClass MrPong { @@ -29,125 +35,88 @@ RoomModel SendingDataTest { triggers { } - action { - "PingPongPort.pongInt16(transitionData);" - } + action '''PingPongPort.pongInt16(transitionData);''' } Transition tr1: reply -> reply { triggers { } - action { - "PingPongPort.pongInt8(transitionData);" - } + action '''PingPongPort.pongInt8(transitionData);''' + } + Transition init: initial -> reply { } - Transition init: initial -> reply { } Transition tr2: reply -> reply { triggers { } - action { - "PingPongPort.pongInt32(transitionData);" - } + action '''PingPongPort.pongInt32(transitionData);''' } Transition tr3: reply -> reply { triggers { } - action { - "PingPongPort.pongFloat32(transitionData);" - } + action '''PingPongPort.pongFloat32(transitionData);''' } Transition tr4: reply -> reply { triggers { } - action { - "PingPongPort.pongFloat64(transitionData);" - } + action '''PingPongPort.pongFloat64(transitionData);''' } Transition tr7: reply -> cp cp0 { triggers { - + } } Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*transitionData)+10);" - } + action '''PingPongPort.pongInt32((*transitionData)+10);''' } Transition tr6: cp cp0 -> reply { - cond { - "(*transitionData)!=5" - } - action { - "PingPongPort.pongInt32(*transitionData);" - } + cond '''(*transitionData)!=5''' + action '''PingPongPort.pongInt32(*transitionData);''' } Transition tr9: reply -> reply { triggers { } - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr11: reply -> reply { triggers { } - action { - "PingPongPort.pongComplex(*transitionData);" - } + action '''PingPongPort.pongComplex(*transitionData);''' } Transition tr5: reply -> reply { triggers { } - action { - "PingPongPort.pongInt64(transitionData);" - } + action '''PingPongPort.pongInt64(transitionData);''' } Transition tr10: reply -> reply { triggers { } - action { - "PingPongPort.pongInt16(*transitionData);" - } + action '''PingPongPort.pongInt16(*transitionData);''' } Transition tr12: reply -> cp cp1 { triggers { - i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(*transitionData);" + i8ValPPD == 5'''> } + action '''PingPongPort.pongComplex(*transitionData);''' } Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(*transitionData);" - } + action '''PingPongPort.pongComplex(*transitionData);''' } Transition tr14: cp cp1 -> reply { - cond { - "transitionData->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(*transitionData);" - } + cond '''transitionData->i8ValPPD==7''' + action '''PingPongPort.pongComplex(*transitionData);''' } Transition tr15: reply -> reply { triggers { } - action { - "PingPongPort.pongComplexDerived(transitionData);" - } + action '''PingPongPort.pongComplexDerived(transitionData);''' } Transition tr16: my tp0 -> my tp0 { triggers { @@ -168,298 +137,271 @@ RoomModel SendingDataTest { } Structure { external Port PingPongPort - Attribute i8Val: int8="5" - Attribute i16Val:int16="19" + Attribute i8Val: int8 = "5" + Attribute i16Val: int16 = "19" Attribute i32Val: int32 = "4711" Attribute i64Val: int64 = "11470815" - Attribute i32Array [ 10 ]: int32 = "{0,1,2,3,4,5,6,7,8,9}" - Attribute f32Val: float32="3.14f" - Attribute f64Val: float64="7.987654321" + Attribute i32Array [10]: int32 = "{0,1,2,3,4,5,6,7,8,9}" + Attribute f32Val: float32 = "3.14f" + Attribute f64Val: float64 = "7.987654321" Attribute data: PingPongData Attribute dataD: PingPongDataDerived - Attribute counter:int32 + Attribute counter: int32 Attribute caseId: int32 Attribute lang: languageIndicator - Attribute resultlist [ 23 ]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" + Attribute resultlist [23]: int16 = "{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}" } Behavior { StateMachine { Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log\", \"SendingDataTest\", \"org.eclipse.etrice.generator.cpp.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "/* send the default values */" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(&i16Val);" - "PingPongPort.pingInt32Ref(&i32Val);" - } + action ''' + caseId = etUnit_openAll("log", "SendingDataTest", "org.eclipse.etrice.generator.cpp.tests.SendingDataTest", "SendingDataTest_case"); + EXPECT_ORDER_START(caseId,resultlist,23); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1); + /* send the default values */ + + PingPongPort.pingInt8(i8Val); + PingPongPort.pingInt16(i16Val); + PingPongPort.pingInt32(i32Val); + PingPongPort.pingInt64(i64Val); + PingPongPort.pingFloat32(f32Val); + PingPongPort.pingFloat64(f64Val); + PingPongPort.pingInt16Ref(&i16Val); + PingPongPort.pingInt32Ref(&i32Val); + i8Val++; + i16Val++; + i32Val++; + i64Val++; + f32Val+=10.1; + f64Val+=20.2; + PingPongPort.pingInt8(i8Val); + PingPongPort.pingInt16(i16Val); + PingPongPort.pingInt32(i32Val); + PingPongPort.pingInt64(i64Val); + PingPongPort.pingFloat32(f32Val); + PingPongPort.pingFloat64(f64Val); + PingPongPort.pingInt16Ref(&i16Val); + PingPongPort.pingInt32Ref(&i32Val);''' } Transition tr0: tp1 of state0 -> tp0 of state1 Transition tr1: tp1 of state1 -> test_finished State state0 { subgraph { Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } + action '''counter=0;''' } Transition tr1: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==5){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 2); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr2: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==19){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 3); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr3: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==4711){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 4); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr4: receiveFirst7 -> receiveSecond7 { triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (transitionData==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (transitionData==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } + + } + action ''' + counter=0; + if (lang == 1){ + /* Java cannot send references of primitive types */ + if (transitionData==4711){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + } + if (lang == 2){ + /* C */ + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + }''' } Transition tr6: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==11470815){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 5); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr5: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if ((transitionData>3)&&(transitionData<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>3)&&(transitionData<4)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 6); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr7: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if ((transitionData>7)&&(transitionData<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>7)&&(transitionData<8)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 7); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr8: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==6){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 10); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr9: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 11); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr10: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 12); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr11: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==11470816){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 13); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr12: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if ((transitionData>13)&&(transitionData<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>13)&&(transitionData<14)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 14); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr13: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if ((transitionData>28)&&(transitionData<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>28)&&(transitionData<29)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 15); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr14: receiveSecond7 -> my tp1 { triggers { - - } - action { - "if (transitionData==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + + } + action ''' + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 17); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr15: receiveFirst7 -> receiveFirst7 { triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (transitionData==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (transitionData==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } + + } + action ''' + counter++; + if (lang == 1){ + /* Java cannot send references of primitive types */ + if (transitionData==19){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + } + if (lang == 2){ + /* C */ + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + }''' } Transition tr16: receiveSecond7 -> receiveSecond7 { triggers { - - } - action { - "counter++;" - "if (transitionData==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + + } + action ''' + counter++; + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 16); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } EntryPoint tp0 ExitPoint tp1 @@ -468,76 +410,69 @@ RoomModel SendingDataTest { } } State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 23); + etUnit_closeAll(caseId); + etUnit_testFinished(caseId);''' } State state1 { subgraph { Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "/* send default values */" - "PingPongPort.pingComplex(data);" - "PingPongPort.pingComplexRef(&data);" - } + action ''' + counter=0; + /* send default values */ + PingPongPort.pingComplex(data); + PingPongPort.pingComplexRef(&data);''' } Transition tr1: state0 -> state1 { triggers { - - } - action { - "counter=0;" - "if (transitionData.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.complexVal.i32Val2PPDD==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8ValPPD=11;" - "PingPongPort.pingComplexDerived(dataD);" - } + + } + action ''' + counter=0; + if (transitionData.i8ValPPD==10){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 19); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + if (transitionData.complexVal.i32Val2PPDD==80){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 20); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + dataD.i8ValPPD=11; + PingPongPort.pingComplexDerived(dataD);''' } Transition tr2: state0 -> state0 { triggers { } - action { - "counter++;" - "if (transitionData.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData.i8ValPPD==10){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 18); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr3: state1 -> my tp1 { triggers { } - action { - "if (transitionData.i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.i32Val3PPDe==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + if (transitionData.i8ValPPD==11){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 21); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + if (transitionData.i32Val3PPDe==150){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 22); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } EntryPoint tp0 ExitPoint tp1 @@ -551,44 +486,42 @@ RoomModel SendingDataTest { ProtocolClass PingPongProtocol { incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) + Message pingInt8(int8) + Message pingInt16(int16) + Message pingInt32(int32) + Message pingInt64(int64) + Message pingFloat32(float32) + Message pingFloat64(float64) + Message pingInt16Ref(int16 ref) + Message pingInt32Ref(int32 ref) + Message pingComplex(PingPongData) + Message pingComplexRef(PingPongData ref) + Message pingComplexDerived(PingPongDataDerived) } outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) + Message pongInt8(int8) + Message pongInt16(int16) + Message pongInt32(int32) + Message pongInt64(int64) + Message pongFloat32(float32) + Message pongFloat64(float64) + Message pongComplex(PingPongData) + Message pongComplexDerived(PingPongDataDerived) } } ProtocolClass PCExternal { - usercode1 { - "typedef int extMsg;" - } + usercode1 '''typedef int extMsg;''' incoming { - Message in1(can: DExtMsg) + Message in1(DExtMsg) } } DataClass PingPongData { Attribute i8ValPPD: int8 = "10" Attribute i8ValRefPPD: int8 ref - Attribute i32ArrayPPD [ 3 ]: int32 = "{200,300,400}" - Attribute i8ArrayRefPPD [ 2 ]: int8 ref + Attribute i32ArrayPPD [3]: int32 = "{200,300,400}" + Attribute i8ArrayRefPPD [2]: int8 ref Attribute complexVal: PingPongDataDeep } diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch b/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch deleted file mode 100644 index dd7cac532..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/org.eclipse.etrice.generator.cpp.tests make.xml.launch +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.java.tests/.project b/tests/org.eclipse.etrice.generator.java.tests/.project index 8373cc3a2..036dfbcdb 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.project +++ b/tests/org.eclipse.etrice.generator.java.tests/.project @@ -5,6 +5,11 @@ + + org.eclipse.xtext.ui.shared.xtextBuilder + + + org.eclipse.jdt.core.javabuilder @@ -13,5 +18,6 @@ org.eclipse.jdt.core.javanature + org.eclipse.xtext.ui.shared.xtextNature diff --git a/tests/org.eclipse.etrice.generator.java.tests/build.gradle b/tests/org.eclipse.etrice.generator.java.tests/build.gradle index 5fe852151..4354ebc93 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.java.tests/build.gradle @@ -2,6 +2,11 @@ apply plugin: 'java-base' apply from: "$rootDir/gradle/etTest.gradle" +dependencies { + modelpath_java project(path: ':runtime:org.eclipse.etrice.modellib.java', configuration: 'modelpath_java') + modelpath_java files('models') +} + def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' createTest('java', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) diff --git a/tests/org.eclipse.etrice.generator.java.tests/make.xml b/tests/org.eclipse.etrice.generator.java.tests/make.xml deleted file mode 100644 index bb84b48e3..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/make.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - done with ${ant.project.name} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${toString:runnerFileSet} - - - - - - - - run @{testId} - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.java.tests/modelpath b/tests/org.eclipse.etrice.generator.java.tests/modelpath new file mode 100644 index 000000000..ba607c01f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.java.tests/modelpath @@ -0,0 +1,2 @@ +srcDir models +project org.eclipse.etrice.modellib.java \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap index 760374536..70952d30f 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap @@ -1,6 +1,7 @@ MappingModel DynamicActorTest1 { - import DynamicActorTest1.* from "DynamicActorTest1.room" - import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + import DynamicActorTest1.JavaGenTests + import room.generic.physical.GenericPhysicalSystem Mapping JavaGenTests -> GenericPhysicalSystem { SubSystemMapping da1Test -> node { diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room index 331261002..fa0c36d5a 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room @@ -1,118 +1,114 @@ RoomModel DynamicActorTest1 { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + import room.basic.types.int32 + import room.basic.types.string LogicalSystem JavaGenTests { - SubSystemRef da1Test : SubSystem_DynamicActorTest1 + SubSystemRef da1Test: SubSystem_DynamicActorTest1 } - + SubSystemClass SubSystem_DynamicActorTest1 { - ActorRef appl : Appl - + ActorRef appl: Appl + LogicalThread defaultThread } - + ActorClass Appl { Structure { ActorRef cont: Container } - Behavior { } + Behavior { + } } - + ActorClass Container { Structure { conjugated Port p0: PC Attribute caseId: int32 optional ActorRef opt: Optional - + Binding p0 and opt.p0 } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest1", "org.eclipse.etrice.generator.java.tests.DynamicActorTest1", "DynamicActorTest1_case");''' + dtor '''etUnit_closeAll(caseId);''' + StateMachine { - Transition init: initial -> CreateOptional2 { } + Transition init: initial -> CreateOptional2 { + } Transition tr0: CreateOptional2 -> CreateOptional1 { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da1Test/appl/cont/opt/sub2/deep_sub\"));" - "opt.destroyOptionalActor();" - } + action ''' + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC3:/JavaGenTests/da1Test/appl/cont/opt/sub2/deep_sub")); + opt.destroyOptionalActor();''' } Transition tr2: CreateOptional1 -> ReceivedHelloAgain { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC1:/JavaGenTests/da1Test/appl/cont/opt/sub1\"));" - "opt.destroyOptionalActor();" - } + action ''' + EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC1:/JavaGenTests/da1Test/appl/cont/opt/sub1")); + opt.destroyOptionalActor();''' } State CreateOptional2 { - entry { - "opt.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } + entry ''' + opt.createOptionalActor("Optional2", getThread()); + p0.sayHello();''' } State CreateOptional1 { - entry { - "opt.createOptionalActor(\"Optional1\", getThread());" - "p0.sayHello();" - } + entry ''' + opt.createOptionalActor("Optional1", getThread()); + p0.sayHello();''' } State ReceivedHelloAgain { - entry { - "IRTObject opt = getChild(\"opt\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" - "" - "etUnit_testFinished(caseId);" - } + entry ''' + IRTObject opt = getChild("opt"); + int size = opt.getChildren().size(); + + // we expect the RTSystemPort and the InterfaceItemBroker + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, size); + + etUnit_testFinished(caseId);''' } } } } - + // the class that is referenced as optional by the Container // since it is abstract it just serves as an interface abstract ActorClass Optional { Interface { Port p0: PC } - Structure { } - Behavior { } + Structure { + } + Behavior { + } } - + // a sub class of Optional which is valid as optional actor ActorClass Optional1 extends Optional { Structure { ActorRef sub1: AC1 Binding p0 and sub1.p0 } - Behavior { } + Behavior { + } } - + // a sub class of Optional which is valid as optional actor ActorClass Optional2 extends Optional { Structure { ActorRef sub2: AC2 Binding p0 and sub2.p0 } - Behavior { } + Behavior { + } } - + // the following actor classes are part of the possible optional instance sub trees - ActorClass AC1 { Interface { Port p0: PC @@ -122,20 +118,19 @@ RoomModel DynamicActorTest1 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "p0.hello(\"AC1:\"+getInstancePath());" - } + action '''p0.hello("AC1:"+getInstancePath());''' } State Ready } } } - + ActorClass AC2 { Interface { Port p0: PC @@ -144,9 +139,10 @@ RoomModel DynamicActorTest1 { ActorRef deep_sub: AC3 Binding p0 and deep_sub.p0 } - Behavior { } + Behavior { + } } - + ActorClass AC3 { Interface { Port p0: PC @@ -156,27 +152,26 @@ RoomModel DynamicActorTest1 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "p0.hello(\"AC3:\"+getInstancePath());" - } + action '''p0.hello("AC3:"+getInstancePath());''' } State Ready } } } - + // a simple protocol that is used to demonstrate that actors are connected ProtocolClass PC { incoming { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap index e13a69c66..af042ed33 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap @@ -1,6 +1,6 @@ MappingModel DynamicActorTest1 { - import DynamicActorTest2.* from "DynamicActorTest2.room" - import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + import DynamicActorTest2.JavaGenTests + import room.generic.physical.GenericPhysicalSystem Mapping JavaGenTests -> GenericPhysicalSystem { SubSystemMapping da2Test -> node { diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room index ed4439255..a11f065b0 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room @@ -1,172 +1,158 @@ RoomModel DynamicActorTest2 { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + + import room.basic.types.int32 + import room.basic.types.string LogicalSystem JavaGenTests { - SubSystemRef da2Test : SubSystem_DynamicActorTest2 + SubSystemRef da2Test: SubSystem_DynamicActorTest2 } - + SubSystemClass SubSystem_DynamicActorTest2 { - ActorRef appl : Appl - + ActorRef appl: Appl + LogicalThread defaultThread } - + ActorClass Appl { Structure { ActorRef cont: Container } - Behavior { } + Behavior { + } } - + ActorClass Container { Structure { conjugated Port p0[*]: PC Attribute caseId: int32 optional ActorRef optarray[*]: Optional - + Binding p0 and optarray.p0 } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest2", "org.eclipse.etrice.generator.java.tests.DynamicActorTest2", "DynamicActorTest2_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { - Transition init: initial -> CreateOptional2 { } + Transition init: initial -> CreateOptional2 { + } Transition tr0: CreateOptional2 -> CreateOptional1 { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" - } + action '''EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub"));''' } Transition tr2: CreateOptional1 -> ReceivedHelloAgain { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" - } + action '''EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub"));''' } Transition tr1: ReceivedHelloAgain -> Destroy0 { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" - } + action '''EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1"));''' } Transition tr3: Destroy0 -> Destroy1Create2 { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" - } + action '''EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1"));''' } Transition tr4: Destroy1Create2 -> Done { triggers { } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" - } + action '''EXPECT_TRUE(caseId, "<|MODEL_LOCATION|>", transitionData.equals("AC3:/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub"));''' } State CreateOptional2 { - entry { - "optarray.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } + entry ''' + optarray.createOptionalActor("Optional2", getThread()); + p0.sayHello();''' } State CreateOptional1 { - entry { - "optarray.createOptionalActor(\"Optional1\", getThread());" - "p0.sayHello();" - } + entry ''' + optarray.createOptionalActor("Optional1", getThread()); + p0.sayHello();''' } State ReceivedHelloAgain State Destroy0 { - entry { - "optarray.destroyOptionalActor(0);" - "p0.sayHello();" - } + entry ''' + optarray.destroyOptionalActor(0); + p0.sayHello();''' } State Destroy1Create2 { - entry { - "optarray.destroyOptionalActor(1);" - "" - "IRTObject opt = getChild(\"optarray\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" - "" - "optarray.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } + entry ''' + optarray.destroyOptionalActor(1); + + IRTObject opt = getChild("optarray"); + int size = opt.getChildren().size(); + + // we expect the RTSystemPort and the InterfaceItemBroker + EXPECT_EQUAL_INT32(caseId, "<|MODEL_LOCATION|>", 2, size); + + optarray.createOptionalActor("Optional2", getThread()); + p0.sayHello();''' } State Done { - entry { - "IRTObject opt = getChild(\"optarray\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "// plus an instance of Optional2" - "// plus 3 sub ports of RTSystemPort" - "EXPECT_EQUAL_INT32(caseId, \"\", 6, size);" - "" - "// we grab the leaf actor of the optional sub tree" - "IRTObject leafActor = getObject(\"/JavaGenTests/da2Test/appl/cont/optarray/optarray:1/sub2/deep_sub\");" - "size = leafActor.getChildren().size();" - "" - "// we expect an RTSystemPort and p0" - "EXPECT_EQUAL_INT32(caseId, \"\", 2, size);" - "" - "EXPECT_TRUE(caseId, \"\", leafActor.getInstancePath().equals(\"/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" - "" - "etUnit_testFinished(caseId);" - } + entry ''' + IRTObject opt = getChild("optarray"); + int size = opt.getChildren().size(); + + // we expect the RTSystemPort and the InterfaceItemBroker + // plus an instance of Optional2 + // plus 3 sub ports of RTSystemPort + EXPECT_EQUAL_INT32(caseId, "", 6, size); + + // we grab the leaf actor of the optional sub tree + IRTObject leafActor = getObject("/JavaGenTests/da2Test/appl/cont/optarray/optarray:1/sub2/deep_sub"); + size = leafActor.getChildren().size(); + + // we expect an RTSystemPort and p0 + EXPECT_EQUAL_INT32(caseId, "", 2, size); + + EXPECT_TRUE(caseId, "", leafActor.getInstancePath().equals("/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub")); + + etUnit_testFinished(caseId);''' } } } } - + // the class that is referenced as optional by the Container // since it is abstract it just serves as an interface abstract ActorClass Optional { Interface { Port p0: PC } - Structure { } - Behavior { } + Structure { + } + Behavior { + } } - + // a sub class of Optional which is valid as optional actor ActorClass Optional1 extends Optional { Structure { ActorRef sub1: AC1 Binding p0 and sub1.p0 } - Behavior { } + Behavior { + } } - + // a sub class of Optional which is valid as optional actor ActorClass Optional2 extends Optional { Structure { ActorRef sub2: AC2 Binding p0 and sub2.p0 } - Behavior { } + Behavior { + } } - + // the following actor classes are part of the possible optional instance sub trees - ActorClass AC1 { Interface { Port p0: PC @@ -176,20 +162,19 @@ RoomModel DynamicActorTest2 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "p0.hello(\"AC1:\"+getInstancePath());" - } + action '''p0.hello("AC1:"+getInstancePath());''' } State Ready } } } - + ActorClass AC2 { Interface { Port p0: PC @@ -198,9 +183,10 @@ RoomModel DynamicActorTest2 { ActorRef deep_sub: AC3 Binding p0 and deep_sub.p0 } - Behavior { } + Behavior { + } } - + ActorClass AC3 { Interface { Port p0: PC @@ -210,27 +196,26 @@ RoomModel DynamicActorTest2 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "p0.hello(\"AC3:\"+getInstancePath());" - } + action '''p0.hello("AC3:"+getInstancePath());''' } State Ready } } } - + // a simple protocol that is used to demonstrate that actors are connected ProtocolClass PC { incoming { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room index 892a80686..1c39154ca 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room @@ -1,16 +1,18 @@ RoomModel DynamicActorTest3 { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - + + import room.basic.types.int32 + import room.basic.types.string + import room.basic.test.TestInstance + ActorClass Appl { @TestInstance Structure { ActorRef cont: Controller } - Behavior { } + Behavior { + } } - + ActorClass Controller { Structure { conjugated Port pwrk: PWorker @@ -21,14 +23,11 @@ RoomModel DynamicActorTest3 { Binding opt and worker.opt } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest3", "org.eclipse.etrice.generator.java.tests.DynamicActorTest3", "DynamicActorTest3_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { - Transition init: initial -> createOpt1 { } + Transition init: initial -> createOpt1 { + } Transition tr0: createOpt1 -> SendHello { triggers { @@ -38,9 +37,7 @@ RoomModel DynamicActorTest3 { triggers { } - action { - "System.out.println(\"controller received \"+transitionData);" - } + action '''System.out.println("controller received "+transitionData);''' } Transition tr2: createOpt1 -> UnexpectedError { triggers { @@ -53,30 +50,22 @@ RoomModel DynamicActorTest3 { } } State createOpt1 { - entry { - "pwrk.create(\"Optional1\");" - } + entry '''pwrk.create("Optional1");''' } State SendHello { - entry { - "opt.sayHello();" - } + entry '''opt.sayHello();''' } State TryCreateInvalid { - entry { - "pwrk.create(\"Optional\");" - } + entry '''pwrk.create("Optional");''' } State UnexpectedError State ExpectedError { - entry { - "etUnit_testFinished(caseId);" - } + entry '''etUnit_testFinished(caseId);''' } } } } - + ActorClass Worker { Interface { Port fct: PWorker @@ -88,60 +77,63 @@ RoomModel DynamicActorTest3 { Binding opt and optRef.p0 } Behavior { + // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - + Operation dumpTree(msg: string) ''' + System.out.println(msg); + System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());''' + StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "if (optRef.createOptionalActor(transitionData, getThread()))" - "\tfct.ok();" - "else" - "\tfct.error();" - } + action ''' + if (optRef.createOptionalActor(transitionData, getThread())) + fct.ok(); + else + fct.error();''' } State Ready } } } - + // the class that is referenced as optional by the Worker // since it is abstract it just serves as an interface abstract ActorClass Optional { Interface { Port p0: PC } - Structure { } - Behavior { } + Structure { + } + Behavior { + } } - + // a sub class of Optional which is valid as optional actor ActorClass Optional1 extends Optional { Structure { ActorRef sub1: AC1 Binding p0 and sub1.p0 } - Behavior { } + Behavior { + } } - + // a sub class of Optional which is valid as optional actor ActorClass Optional2 extends Optional { Structure { ActorRef sub2: AC2 Binding p0 and sub2.p0 } - Behavior { } + Behavior { + } } - + // the following actor classes are part of the possible optional instance sub trees - ActorClass AC1 { Interface { Port p0: PC @@ -154,7 +146,8 @@ RoomModel DynamicActorTest3 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> AskHelper { triggers { @@ -164,21 +157,18 @@ RoomModel DynamicActorTest3 { triggers { } - action { - "System.out.println(\"helper said \"+transitionData);" - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } + action ''' + System.out.println("helper said "+transitionData); + p0.hello("this is AC1, instance "+getInstancePath());''' } State Ready State AskHelper { - entry { - "hlp.sayHello();" - } + entry '''hlp.sayHello();''' } } } } - + ActorClass AC2 { Interface { Port p0: PC @@ -187,9 +177,10 @@ RoomModel DynamicActorTest3 { ActorRef deep_sub: AC3 Binding p0 and deep_sub.p0 } - Behavior { } + Behavior { + } } - + ActorClass AC3 { Interface { Port p0: PC @@ -199,33 +190,32 @@ RoomModel DynamicActorTest3 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "p0.hello(\"this is AC3, instance \"+getInstancePath());" - } + action '''p0.hello("this is AC3, instance "+getInstancePath());''' } State Ready } } } - + // a simple protocol that is used to demonstrate that actors are connected ProtocolClass PC { incoming { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } - + ProtocolClass PWorker { incoming { - Message create(ac: string) + Message create(string) } outgoing { Message ok() diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room index 14de05c25..9f05cef55 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room @@ -1,65 +1,59 @@ RoomModel DynamicActorTest4 { - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - + import room.basic.types.int32 + import room.basic.types.string + import room.basic.test.TestInstance + ActorClass Appl { @TestInstance Structure { ActorRef cont: Container } - Behavior { } + Behavior { + } } - + ActorClass Container { Structure { conjugated Port p0: PC Attribute caseId: int32 optional ActorRef opt: Optional - + Binding p0 and opt.p0 } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest4", "org.eclipse.etrice.generator.java.tests.DynamicActorTest4", "DynamicActorTest4_case");''' + dtor '''etUnit_closeAll(caseId);''' + // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - + Operation dumpTree(msg: string) ''' + System.out.println(msg); + System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());''' + StateMachine { - Transition init: initial -> CreateOptional { } + Transition init: initial -> CreateOptional { + } Transition tr0: CreateOptional -> Done { triggers { } - action { - "System.out.println(transitionData+\"\\n\");" - "opt.destroyOptionalActor();" - "dumpTree(\"after deletion of Optional2\");" - } + action ''' + System.out.println(transitionData+"\n"); + opt.destroyOptionalActor(); + dumpTree("after deletion of Optional2");''' } State CreateOptional { - entry { - "opt.createOptionalActor(\"Optional\", getThread());" - "p0.sayHello();" - } + entry ''' + opt.createOptionalActor("Optional", getThread()); + p0.sayHello();''' } State Done { - entry { - "etUnit_testFinished(caseId);" - } + entry '''etUnit_testFinished(caseId);''' } } } } - + // the class that is referenced as optional by the Container // It has an external end port and implements the behavior itself ActorClass Optional { @@ -71,27 +65,26 @@ RoomModel DynamicActorTest4 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } + action '''p0.hello("this is AC1, instance "+getInstancePath());''' } State Ready } } } - + // a simple protocol that is used to demonstrate that actors are connected ProtocolClass PC { incoming { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room index c2680d7d0..0c642c800 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room @@ -1,68 +1,64 @@ RoomModel DynamicActorTest5 { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - + + import room.basic.types.int32 + import room.basic.types.string + import room.basic.test.TestInstance + ActorClass Appl { @TestInstance Structure { ActorRef cont: Container } - Behavior { } + Behavior { + } } - + ActorClass Container { Structure { conjugated Port p0: PC Attribute caseId: int32 optional ActorRef opt: Optional2 - + Binding p0 and opt.p0 } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest5", "org.eclipse.etrice.generator.java.tests.DynamicActorTest5", "DynamicActorTest5_case");''' + dtor '''etUnit_closeAll(caseId);''' + // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - + Operation dumpTree(msg: string) ''' + System.out.println(msg); + System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());''' + StateMachine { - Transition init: initial -> CreateOptional2 { } + Transition init: initial -> CreateOptional2 { + } Transition tr0: CreateOptional2 -> Done { triggers { } - action { - "dumpTree(\"after received hello\");" - "" - "System.out.println(\"received \"+transitionData);" - "" - "etUnit_testFinished(caseId);" - } + action ''' + dumpTree("after received hello"); + + System.out.println("received "+transitionData); + + etUnit_testFinished(caseId);''' } State CreateOptional2 { - entry { - "opt.createOptionalActor(\"Optional2\", getThread());" - "dumpTree(\"after creation of Optional2\");" - "" - "// at this point the port isn\'t connected since" - "// the init message isn\'t processed yet" - "// - so no peer port exists" - "p0.sayHello();" - } + entry ''' + opt.createOptionalActor("Optional2", getThread()); + dumpTree("after creation of Optional2"); + + // at this point the port isn't connected since + // the init message isn't processed yet + // - so no peer port exists + p0.sayHello();''' } State Done } } } - + ActorClass Optional1 { Interface { Port p0: PC @@ -71,9 +67,10 @@ RoomModel DynamicActorTest5 { ActorRef sub1: AC1 Binding p0 and sub1.p0 } - Behavior { } + Behavior { + } } - + ActorClass Optional2 { Interface { Port p0: PC @@ -82,11 +79,11 @@ RoomModel DynamicActorTest5 { ActorRef sub2: AC2 Binding p0 and sub2.p0 } - Behavior { } + Behavior { + } } - + // the following actor classes are part of the possible optional instance sub trees - ActorClass AC1 { Interface { Port p0: PC @@ -96,16 +93,15 @@ RoomModel DynamicActorTest5 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } State Ready { - entry { - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } + entry '''p0.hello("this is AC1, instance "+getInstancePath());''' } } } } - + ActorClass AC2 { Interface { Port p0: PC @@ -114,9 +110,10 @@ RoomModel DynamicActorTest5 { ActorRef deep_sub: AC3 Binding p0 and deep_sub.p0 } - Behavior { } + Behavior { + } } - + ActorClass AC3 { Interface { Port p0: PC @@ -127,23 +124,22 @@ RoomModel DynamicActorTest5 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } State Ready { - entry { - "nestedOpt.createOptionalActor(\"Optional1\", getThread());" - } + entry '''nestedOpt.createOptionalActor("Optional1", getThread());''' } } } } - + // a simple protocol that is used to demonstrate that actors are connected ProtocolClass PC { incoming { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room index d1b69ba3a..3a10ce5a4 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room @@ -1,16 +1,18 @@ RoomModel DynamicActorTest6 { - - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - + + import room.basic.types.int32 + import room.basic.types.string + import room.basic.test.TestInstance + ActorClass Appl { @TestInstance Structure { ActorRef ctrl: Controller } - Behavior { } + Behavior { + } } - + ActorClass Controller { Structure { conjugated Port pcont: PCtrl @@ -23,14 +25,11 @@ RoomModel DynamicActorTest6 { Binding pin and cont.pout } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest6", "org.eclipse.etrice.generator.java.tests.DynamicActorTest6", "DynamicActorTest6_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { - Transition init: initial -> CreateOptionals { } + Transition init: initial -> CreateOptionals { + } Transition tr0: CreateOptionals -> Sending { triggers { @@ -40,9 +39,7 @@ RoomModel DynamicActorTest6 { triggers { } - action { - "System.out.println(\"Controller received: \"+transitionData);" - } + action '''System.out.println("Controller received: "+transitionData);''' } Transition tr2: Destroy -> CreateAgain { triggers { @@ -58,44 +55,30 @@ RoomModel DynamicActorTest6 { triggers { } - action { - "System.out.println(\"Controller received: \"+transitionData);" - } + action '''System.out.println("Controller received: "+transitionData);''' } State CreateOptionals { - entry { - "pcont.createOpts();" - } + entry '''pcont.createOpts();''' } State Sending { - entry { - "pout.sayHello();" - } + entry '''pout.sayHello();''' } State Done { - entry { - "etUnit_testFinished(caseId);" - } + entry '''etUnit_testFinished(caseId);''' } State Destroy { - entry { - "pcont.destroyOpts();" - } + entry '''pcont.destroyOpts();''' } State CreateAgain { - entry { - "pcont.createOpts();" - } + entry '''pcont.createOpts();''' } State SendAgain { - entry { - "pout.sayHello();" - } + entry '''pout.sayHello();''' } } } } - + ActorClass Container { Interface { Port fct: PCtrl @@ -111,39 +94,38 @@ RoomModel DynamicActorTest6 { Binding pout and opt2.pout } Behavior { + // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } + Operation dumpTree(msg: string) ''' + System.out.println(msg); + System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());''' StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "opt1.createOptionalActor(\"Optional1\", getThread());" - "opt2.createOptionalActor(\"Optional2\", getThread());" - "dumpTree(\"after creation of op1 and opt2\");" - "fct.done();" - } + action ''' + opt1.createOptionalActor("Optional1", getThread()); + opt2.createOptionalActor("Optional2", getThread()); + dumpTree("after creation of op1 and opt2"); + fct.done();''' } Transition tr1: Ready -> Ready { triggers { } - action { - "opt1.destroyOptionalActor();" - "opt2.destroyOptionalActor();" - "fct.done();" - } + action ''' + opt1.destroyOptionalActor(); + opt2.destroyOptionalActor(); + fct.done();''' } State Ready } } } - + ActorClass Optional1 { Interface { Port pout: PC @@ -154,9 +136,10 @@ RoomModel DynamicActorTest6 { Binding pin and sub1.pin Binding pout and sub1.pout } - Behavior { } + Behavior { + } } - + ActorClass Optional2 { Interface { Port pout: PC @@ -167,9 +150,10 @@ RoomModel DynamicActorTest6 { Binding pout and sub2.pout Binding pin and sub2.pin } - Behavior { } + Behavior { + } } - + ActorClass AC1 { Interface { Port pout: PC @@ -181,20 +165,19 @@ RoomModel DynamicActorTest6 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "pout.hello(\"this is AC1, instance \"+getInstancePath());" - } + action '''pout.hello("this is AC1, instance "+getInstancePath());''' } State Ready } } } - + ActorClass AC2 { Interface { Port pout: PC @@ -206,28 +189,28 @@ RoomModel DynamicActorTest6 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { } - action { - "System.out.println(\"AC2 received \"+transitionData);" - "" - "pout.hello(\"AC2: forwarding \"+transitionData);" - } + action ''' + System.out.println("AC2 received "+transitionData); + + pout.hello("AC2: forwarding "+transitionData);''' } State Ready } } } - + ProtocolClass PC { incoming { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap index 4bd054cd2..a2738a1ea 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap @@ -1,6 +1,7 @@ MappingModel DynamicActorTest1 { - import DynamicActorTest7.* from "DynamicActorTest7.room" - import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + + import DynamicActorTest7.JavaGenTests + import room.generic.physical.GenericPhysicalSystem Mapping JavaGenTests -> GenericPhysicalSystem { SubSystemMapping da7Test -> node { diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room index 99755e2cf..f57cde472 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room @@ -1,15 +1,21 @@ RoomModel DynamicActorTest7 { - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" + import room.basic.types.boolean + import room.basic.types.char + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.types.string LogicalSystem JavaGenTests { - SubSystemRef da7Test : SubSystem_DynamicActorTest7 + SubSystemRef da7Test: SubSystem_DynamicActorTest7 } - + SubSystemClass SubSystem_DynamicActorTest7 { - ActorRef main : Appl - + ActorRef main: Appl + LogicalThread defaultThread } @@ -17,131 +23,110 @@ RoomModel DynamicActorTest7 { Structure { ActorRef cont: Container } - Behavior { } + Behavior { + } } ActorClass Container { Structure { - usercode1 { - "import java.io.File;" - } - usercode2 { - "private static final String FIRST_OPT_OBJ = \"firstOpt.obj\";" - "private static final String SECOND_OPT_OBJ = \"secondOpt.obj\";" - } + usercode1 '''import java.io.File;''' + usercode2 ''' + private static final String FIRST_OPT_OBJ = "firstOpt.obj"; + private static final String SECOND_OPT_OBJ = "secondOpt.obj";''' conjugated Port op: PStep conjugated Port opa [*]: PStep - + Attribute caseId: int32 - + optional ActorRef opt: Optional optional ActorRef optarr [*]: Optional - + Binding op and opt.fct Binding opa and optarr.fct } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.java.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - Operation clean() { - "File f = new File(FIRST_OPT_OBJ);" - "if (f.exists())" - "\tf.delete();" - } + ctor '''caseId = etUnit_openAll("log", "DynamicActorTest7", "org.eclipse.etrice.generator.java.tests.DynamicActorTest7", "DynamicActorTest7_case");''' + dtor '''etUnit_closeAll(caseId);''' + Operation clean() ''' + File f = new File(FIRST_OPT_OBJ); + if (f.exists()) + f.delete();''' StateMachine { - Transition init: initial -> Init { } + Transition init: initial -> Init { + } Transition tr0: Init -> DestroyAndCreate { triggers { } - action { - "System.out.println(\"received \"+transitionData);" - } + action '''System.out.println("received "+transitionData);''' } Transition tr1: DestroyAndCreate -> DestroyAndRestore { triggers { } - action { - "System.out.println(\"received \"+transitionData);" - } + action '''System.out.println("received "+transitionData);''' } Transition tr2: DestroyAndRestore -> LoadInArray { triggers { } - action { - "System.out.println(\"received \"+transitionData);" - } + action '''System.out.println("received "+transitionData);''' } Transition tr3: LoadInArray -> ReceivedHello { triggers { } - action { - "System.out.println(\"received \"+transitionData);" - } + action '''System.out.println("received "+transitionData);''' } Transition tr4: ReceivedHello -> Done { triggers { } - action { - "System.out.println(\"received \"+transitionData);" - } + action '''System.out.println("received "+transitionData);''' } State Init { - entry { - "clean();" - "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "op.step();" - "op.step();" - "op.sayHello();" - } + entry ''' + clean(); + FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, "Optional1"); + op.step(); + op.step(); + op.sayHello();''' } State DestroyAndCreate { - entry { - "FilePersistor.saveAndDestroy(opt, FIRST_OPT_OBJ);" - "FilePersistor.createAndLoad(opt, getThread(), SECOND_OPT_OBJ, \"Optional2\");" - "op.step();" - "op.step();" - "op.sayHello();" - } + entry ''' + FilePersistor.saveAndDestroy(opt, FIRST_OPT_OBJ); + FilePersistor.createAndLoad(opt, getThread(), SECOND_OPT_OBJ, "Optional2"); + op.step(); + op.step(); + op.sayHello();''' } State DestroyAndRestore { - entry { - "FilePersistor.saveAndDestroy(opt, SECOND_OPT_OBJ);" - "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "op.sayHello();" - } + entry ''' + FilePersistor.saveAndDestroy(opt, SECOND_OPT_OBJ); + FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, "Optional1"); + op.sayHello();''' } State Done { - entry { - "IRTObject object = getObject(\"/JavaGenTests/da7Test/main/cont/optarr/optarr:0/sub\");" - "EXPECT_TRUE(caseId, \"object 0 of optarr is an instance of actor class Sub1\", object instanceof Sub1);" - "" - "Sub1 inst = (Sub1) object;" - "EXPECT_EQUAL_INT32(caseId, \"state\", Sub1.STATE_Step3_StepA, inst.getState());" - "EXPECT_EQUAL_INT32(caseId, \"current value of ival\", 123, inst.getIval());" - "EXPECT_EQUAL_INT16(caseId, \"current value of sval\", (short)456, inst.getSval());" - "EXPECT_EQUAL_INT8(caseId, \"current value of bval\", (byte)3, inst.getBval());" - "EXPECT_TRUE(caseId, \"changed string\", \"changed\".equals(inst.getSome()[1].getStr()));" - "EXPECT_EQUAL_FLOAT32(caseId, \"current vaue of\", 3.14159f, inst.getDerived().getSome().getFval()[2], 0.001f);" - "EXPECT_EQUAL_UINT8(caseId, \"current value of cval\", 'x', inst.getCval());" - "" - "etUnit_testFinished(caseId);" - } + entry ''' + IRTObject object = getObject("/JavaGenTests/da7Test/main/cont/optarr/optarr:0/sub"); + EXPECT_TRUE(caseId, "object 0 of optarr is an instance of actor class Sub1", object instanceof Sub1); + + Sub1 inst = (Sub1) object; + EXPECT_EQUAL_INT32(caseId, "state", Sub1.STATE_Step3_StepA, inst.getState()); + EXPECT_EQUAL_INT32(caseId, "current value of ival", 123, inst.getIval()); + EXPECT_EQUAL_INT16(caseId, "current value of sval", (short)456, inst.getSval()); + EXPECT_EQUAL_INT8(caseId, "current value of bval", (byte)3, inst.getBval()); + EXPECT_TRUE(caseId, "changed string", "changed".equals(inst.getSome()[1].getStr())); + EXPECT_EQUAL_FLOAT32(caseId, "current vaue of", 3.14159f, inst.getDerived().getSome().getFval()[2], 0.001f); + EXPECT_EQUAL_UINT8(caseId, "current value of cval", 'x', inst.getCval()); + + etUnit_testFinished(caseId);''' } State LoadInArray { - entry { - "FilePersistor.createAndLoad(optarr, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "FilePersistor.createAndLoad(optarr, getThread(), SECOND_OPT_OBJ, \"Optional2\");" - "opa.sayHello();" - } + entry ''' + FilePersistor.createAndLoad(optarr, getThread(), FIRST_OPT_OBJ, "Optional1"); + FilePersistor.createAndLoad(optarr, getThread(), SECOND_OPT_OBJ, "Optional2"); + opa.sayHello();''' } State ReceivedHello } @@ -152,8 +137,10 @@ RoomModel DynamicActorTest7 { Interface { Port fct: PStep } - Structure { } - Behavior { } + Structure { + } + Behavior { + } } ActorClass Optional1 extends Optional { @@ -161,7 +148,8 @@ RoomModel DynamicActorTest7 { ActorRef ^sub: Sub1 Binding fct and ^sub.fct } - Behavior { } + Behavior { + } } ActorClass Optional2 extends Optional { @@ -169,7 +157,8 @@ RoomModel DynamicActorTest7 { ActorRef ^sub: Sub2 Binding fct and ^sub.fct } - Behavior { } + Behavior { + } } ActorClass Sub1Base { @@ -177,7 +166,7 @@ RoomModel DynamicActorTest7 { Attribute cval: char } } - + ActorClass Sub1 extends Sub1Base { Interface { Port fct: PStep @@ -185,88 +174,74 @@ RoomModel DynamicActorTest7 { Structure { external Port fct conjugated Port dp: PStep - + Attribute ival: int32 Attribute sval: int16 Attribute bval: int8 - Attribute some[3]: SomeData + Attribute some [3]: SomeData Attribute other: OtherData Attribute derived: DerivedData - + ActorRef deep: DeepSub1 Binding dp and deep.fct } Behavior { StateMachine { - Transition init: initial -> Step1 { } + Transition init: initial -> Step1 { + } Transition tr0: Step1 -> Step2 { triggers { } - action { - "dp.step();" - } + action '''dp.step();''' } Transition tr1: Step2 -> Step3 { triggers { } - action { - "dp.step();" - } + action '''dp.step();''' } Transition tr2: my tp0 -> my tp0 { triggers { } - action { - "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" - } + action '''fct.hello(getClassName()+", state="+stateStrings[getState()]+", path= "+getInstancePath());''' } handler TransitionPoint tp0 State Step1 { - entry { - "ival = 1;" - "sval = 2;" - "bval = 3;" - "cval = 'x';" - } + entry ''' + ival = 1; + sval = 2; + bval = 3; + cval = 'x';''' } State Step2 { - entry { - "ival = 123;" - "some[1].str = \"changed\";" - "derived.some.fval[2] = 3.14159f;" - } + entry ''' + ival = 123; + some[1].str = "changed"; + derived.some.fval[2] = 3.14159f;''' } State Step3 { subgraph { - Transition init: initial -> StepA { } + Transition init: initial -> StepA { + } Transition tr0: StepA -> StepB { triggers { } - action { - "dp.step();" - } + action '''dp.step();''' } Transition tr1: StepB -> StepC { triggers { } - action { - "dp.step();" - } + action '''dp.step();''' } State StepA { - entry { - "sval = 456;" - } + entry '''sval = 456;''' } State StepB { - entry { - "bval = 13;" - } + entry '''bval = 13;''' } State StepC } @@ -284,7 +259,8 @@ RoomModel DynamicActorTest7 { } Behavior { StateMachine { - Transition init: initial -> Step1 { } + Transition init: initial -> Step1 { + } Transition tr0: Step1 -> Step2 { triggers { @@ -329,7 +305,8 @@ RoomModel DynamicActorTest7 { } Behavior { StateMachine { - Transition init: initial -> Ready { } + Transition init: initial -> Ready { + } Transition tr0: Ready -> Ready { triggers { @@ -339,9 +316,7 @@ RoomModel DynamicActorTest7 { triggers { } - action { - "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" - } + action '''fct.hello(getClassName()+", state="+stateStrings[getState()]+", path= "+getInstancePath());''' } State Ready } @@ -354,22 +329,22 @@ RoomModel DynamicActorTest7 { Message sayHello() } outgoing { - Message hello(txt: string) + Message hello(string) } } DataClass SomeData { - Attribute fval[3]: float32 = "1.0" + Attribute fval [3]: float32 = "1.0" Attribute dval: float64 = "123.4" Attribute str: string = "\"Text\"" } - + DataClass OtherData { Attribute some: SomeData Attribute bval: boolean = "false" } - + DataClass DerivedData extends OtherData { - Attribute cval[3]: char = "{'a', 'b', 'c'}" + Attribute cval [3]: char = "{'a', 'b', 'c'}" } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config index 13fd8a62b..4dbe9ff45 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config @@ -1,7 +1,7 @@ ConfigModel DynamicConfigTest { - import DynamicConfigTest.* from "DynamicConfigTest.room" - + import DynamicConfigTest.System_DynamicConfigTest + import DynamicConfigTest.Testee_ac SubSystemConfig System_DynamicConfigTest / main { dynamic configuration { diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap index 6cb2c523e..c6423cad5 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap @@ -1,9 +1,11 @@ MappingModel DynamicConfigTest { - import DynamicConfigTest.* from "DynamicConfigTest.room" - import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + import DynamicConfigTest.System_DynamicConfigTest + import room.generic.physical.GenericPhysicalSystem Mapping System_DynamicConfigTest -> GenericPhysicalSystem { - SubSystemMapping main -> node {} + SubSystemMapping main -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room index 9835b42af..9fe63210a 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room @@ -1,25 +1,35 @@ RoomModel DynamicConfigTest { - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - import room.basic.service.timing.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/TimingService.room" + import room.basic.types.char + import room.basic.types.boolean + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.int64 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.types.string + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService - LogicalSystem System_DynamicConfigTest{ - SubSystemRef main : SubSystem_DynamicConfigTest + LogicalSystem System_DynamicConfigTest { + SubSystemRef main: SubSystem_DynamicConfigTest } - + SubSystemClass SubSystem_DynamicConfigTest { ActorRef testee: Testee_ac ActorRef timingService: ATimingService LayerConnection ref testee satisfied_by timingService.timer + + LogicalThread defaultThread } ActorClass Testee_ac { Structure { - usercode1 { - "import java.util.HashMap;" - "import java.util.Map;" - "import org.eclipse.etrice.runtime.java.config.IConfigSource;" - } + usercode1 ''' + import java.util.HashMap; + import java.util.Map; + import org.eclipse.etrice.runtime.java.config.IConfigSource;''' SAP timer: PTimer Attribute caseId: int32 Attribute testId: int32 = "1" @@ -37,166 +47,147 @@ RoomModel DynamicConfigTest { Attribute aFloat64: float64 Attribute aChar: char Attribute aString: string - Attribute aInt8_array [ 2 ]: int8 - Attribute aInt16_array [ 2 ]: int16 - Attribute aInt32_array [ 2 ]: int32 - Attribute aInt64_array [ 2 ]: int64 - Attribute aBool_array [ 2 ]: boolean - Attribute aFloat32_array [ 2 ]: float32 - Attribute aFloat64_array [ 2 ]: float64 - Attribute aChar_array [ 2 ]: char + Attribute aInt8_array [2]: int8 + Attribute aInt16_array [2]: int16 + Attribute aInt32_array [2]: int32 + Attribute aInt64_array [2]: int64 + Attribute aBool_array [2]: boolean + Attribute aFloat32_array [2]: float32 + Attribute aFloat64_array [2]: float64 + Attribute aChar_array [2]: char Attribute dc: Data_dc } Behavior { - ctor { - "etUnit_open(\"log\", \"DynamicConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.java.tests.DynamicConfigTest\");" - "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");" - } - dtor { - "etUnit_closeTestCase(caseId);" - "etUnit_closeTestSuite();" - "etUnit_close();" - } + ctor ''' + etUnit_open("log", "DynamicConfigTest"); + etUnit_openTestSuite("org.eclipse.etrice.generator.java.tests.DynamicConfigTest"); + caseId = etUnit_openTestCase("DynamicConfigTest_case_Testee_ac");''' + dtor ''' + etUnit_closeTestCase(caseId); + etUnit_closeTestSuite(); + etUnit_close();''' StateMachine { - Transition t0: initial -> ChangeConfigValid { } + Transition t0: initial -> ChangeConfigValid { + } Transition t1: ChangeConfigValid -> Test { triggers { } - action { - "testId++;" - } + action '''testId++;''' } Transition t2: Test -> ChangeConfigInvalid { triggers { - + } } Transition t3: ChangeConfigInvalid -> Test { triggers { } - action { - "testId++;" - } + action '''testId++;''' } Transition t4: Test -> Done { triggers { - + } } Transition tr0: Test -> ChangeConfigValid { triggers { - + } } State ChangeConfigValid { - entry { - "IConfigSource source = ConfigSourceTestInstance.getInstance();" - "String path = this.getInstancePath();" - "Map testValues = new HashMap();" - "testValues.put(path+\"/aInt8\", 50);" - "testValues.put(path+\"/aInt16\", 51);" - "testValues.put(path+\"/aInt32\", 52);" - "testValues.put(path+\"/aInt64\", 53);" - "testValues.put(path+\"/aFloat32\", 5.4f);" - "testValues.put(path+\"/aFloat64\", 5.5);" - "testValues.put(path+\"/aChar\", 'B');" - "testValues.put(path+\"/aString\", \"Do-NOT-UPDATE-me\");" - "testValues.put(path+\"/aBool\", true);" - "testValues.put(path+\"/dc/nested/aInt32\", 56);" - "testValues.put(path+\"/dc/aString\", \"Okay\");" - "testValues.put(path+\"/aInt8_array\", new Byte[]{50,40});" - "testValues.put(path+\"/aInt16_array\", new Short[]{51,41});" - "testValues.put(path+\"/aInt32_array\", new Integer[]{52,42});" - "testValues.put(path+\"/aInt64_array\", new Long[]{53L,43L});" - "testValues.put(path+\"/aFloat32_array\", new Float[]{5.4f, 4.4f});" - "testValues.put(path+\"/aFloat64_array\", new Double[]{5.5, 4.5});" - "testValues.put(path+\"/aChar_array\", \"BB\");" - "testValues.put(path+\"/aBool_array\", new Boolean[]{true, false});" - "source.writeValues(testValues);" - "timer.startTimer(400);" - } + entry ''' + IConfigSource source = ConfigSourceTestInstance.getInstance(); + String path = this.getInstancePath(); + Map testValues = new HashMap(); + testValues.put(path+"/aInt8", 50); + testValues.put(path+"/aInt16", 51); + testValues.put(path+"/aInt32", 52); + testValues.put(path+"/aInt64", 53); + testValues.put(path+"/aFloat32", 5.4f); + testValues.put(path+"/aFloat64", 5.5); + testValues.put(path+"/aChar", 'B'); + testValues.put(path+"/aString", "Do-NOT-UPDATE-me"); + testValues.put(path+"/aBool", true); + testValues.put(path+"/dc/nested/aInt32", 56); + testValues.put(path+"/dc/aString", "Okay"); + testValues.put(path+"/aInt8_array", new Byte[]{50,40}); + testValues.put(path+"/aInt16_array", new Short[]{51,41}); + testValues.put(path+"/aInt32_array", new Integer[]{52,42}); + testValues.put(path+"/aInt64_array", new Long[]{53L,43L}); + testValues.put(path+"/aFloat32_array", new Float[]{5.4f, 4.4f}); + testValues.put(path+"/aFloat64_array", new Double[]{5.5, 4.5}); + testValues.put(path+"/aChar_array", "BB"); + testValues.put(path+"/aBool_array", new Boolean[]{true, false}); + source.writeValues(testValues); + timer.startTimer(400);''' } State ChangeConfigInvalid { - entry { - // do not update aString - "getAStringLock().forbidUpdate();" - - "IConfigSource source = ConfigSourceTestInstance.getInstance();" - "String path = this.getInstancePath();" - "Map testValues = new HashMap();" - "testValues.put(path+\"/aInt8\", 128);" - "testValues.put(path+\"/aInt16\", 61);" - "testValues.put(path+\"/aInt32\", -2);" - "testValues.put(path+\"/aInt64\", Long.MAX_VALUE);" - "testValues.put(path+\"/aFloat32\", -100f);" - "testValues.put(path+\"/aFloat64\", 100d);" - "testValues.put(path+\"/aChar\", \"string\");" - "testValues.put(path+\"/aString\", \"VALID-String\");" - "testValues.put(path+\"/aBool\", \"true\");" - "testValues.put(path+\"/dc/aString\", 0.89898);" - "testValues.put(path+\"/dc/nested/aInt32\", 62);" - "testValues.put(path+\"/aInt8_array\", 128);" - "testValues.put(path+\"/aInt16_array\", new Short[]{-1,-2});" - "testValues.put(path+\"/aInt32_array\", new Integer[]{60,59});" - "testValues.put(path+\"/aInt64_array\", new Long[]{60000L,60000L});" - "testValues.put(path+\"/aFloat32_array\", new Float[]{0f, -2f});" - "testValues.put(path+\"/aFloat64_array\", \"string\");" - "testValues.put(path+\"/aChar_array\", \"BBB\");" - "testValues.put(path+\"/aBool_array\", 500);" - "source.writeValues(testValues);" - "timer.startTimer(400);" - } + entry ''' + getAStringLock().forbidUpdate(); + IConfigSource source = ConfigSourceTestInstance.getInstance(); + String path = this.getInstancePath(); + Map testValues = new HashMap(); + testValues.put(path+"/aInt8", 128); + testValues.put(path+"/aInt16", 61); + testValues.put(path+"/aInt32", -2); + testValues.put(path+"/aInt64", Long.MAX_VALUE); + testValues.put(path+"/aFloat32", -100f); + testValues.put(path+"/aFloat64", 100d); + testValues.put(path+"/aChar", "string"); + testValues.put(path+"/aString", "VALID-String"); + testValues.put(path+"/aBool", "true"); + testValues.put(path+"/dc/aString", 0.89898); + testValues.put(path+"/dc/nested/aInt32", 62); + testValues.put(path+"/aInt8_array", 128); + testValues.put(path+"/aInt16_array", new Short[]{-1,-2}); + testValues.put(path+"/aInt32_array", new Integer[]{60,59}); + testValues.put(path+"/aInt64_array", new Long[]{60000L,60000L}); + testValues.put(path+"/aFloat32_array", new Float[]{0f, -2f}); + testValues.put(path+"/aFloat64_array", "string"); + testValues.put(path+"/aChar_array", "BBB"); + testValues.put(path+"/aBool_array", 500); + source.writeValues(testValues); + timer.startTimer(400);''' } State Test { - entry { - "EXPECT_EQUAL_INT8(caseId, \"1:Testee_ac\", (byte)50, getAInt8());" - "EXPECT_EQUAL_INT16(caseId, \"2:Testee_ac\", (short)51, getAInt16());" - "EXPECT_EQUAL_INT32(caseId, \"3:Testee_ac\", 52, getAInt32());" - "EXPECT_TRUE(caseId, \"4:Testee_ac\", getAInt64() == 53L);" - "EXPECT_EQUAL_FLOAT32(caseId, \"5:Testee_ac\", 5.4f, getAFloat32(), 0.1f);" - "EXPECT_TRUE(caseId, \"6:Testee_ac\", getAFloat64() == 5.5);" - "EXPECT_TRUE(caseId, \"7:Testee_ac\", getAChar() == 'B');" - "EXPECT_TRUE(caseId, \"8:Testee_ac\", \"Do-NOT-UPDATE-me\".equals(getAString()));" - "EXPECT_TRUE(caseId, \"9:Testee_ac\", getABool() == true);" - "EXPECT_TRUE(caseId, \"10:Testee_ac\", getAInt8_array()[0] == 50 && getAInt8_array()[1] == 40);" - "EXPECT_TRUE(caseId, \"11:Testee_ac\", getAInt16_array()[0] == 51 && getAInt16_array()[1] == 41);" - "EXPECT_TRUE(caseId, \"12:Testee_ac\", getAInt32_array()[0] == 52 && getAInt32_array()[1] == 42);" - "EXPECT_TRUE(caseId, \"13:Testee_ac\", getAInt64_array()[0] == 53L && getAInt64_array()[1] == 43L);" - "EXPECT_EQUAL_FLOAT32(caseId, \"14.1:Testee_ac\", 5.4f, getAFloat32_array()[0], 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId, \"14.2:Testee_ac\", 4.4f, getAFloat32_array()[1], 0.1f);" - "EXPECT_TRUE(caseId, \"15:Testee_ac\", getAFloat64_array()[0] == 5.5 && getAFloat64_array()[1] == 4.5);" - "EXPECT_TRUE(caseId, \"16:Testee_ac\", String.valueOf(getAChar_array()).equals(\"BB\"));" - "EXPECT_TRUE(caseId, \"18:Testee_ac\", getABool_array()[0] == true && getABool_array()[1] == false);" - "EXPECT_TRUE(caseId, \"19:Testee_ac\", \"Okay\".equals(getDc().getAString()));" - "EXPECT_TRUE(caseId, \"20:Testee_ac\", getDc().getNested().getAInt32() == 56);" - "timer.startTimer(1);" - } + entry ''' + EXPECT_EQUAL_INT8(caseId, "1:Testee_ac", (byte)50, getAInt8()); + EXPECT_EQUAL_INT16(caseId, "2:Testee_ac", (short)51, getAInt16()); + EXPECT_EQUAL_INT32(caseId, "3:Testee_ac", 52, getAInt32()); + EXPECT_TRUE(caseId, "4:Testee_ac", getAInt64() == 53L); + EXPECT_EQUAL_FLOAT32(caseId, "5:Testee_ac", 5.4f, getAFloat32(), 0.1f); + EXPECT_TRUE(caseId, "6:Testee_ac", getAFloat64() == 5.5); + EXPECT_TRUE(caseId, "7:Testee_ac", getAChar() == 'B'); + EXPECT_TRUE(caseId, "8:Testee_ac", "Do-NOT-UPDATE-me".equals(getAString())); + EXPECT_TRUE(caseId, "9:Testee_ac", getABool() == true); + EXPECT_TRUE(caseId, "10:Testee_ac", getAInt8_array()[0] == 50 && getAInt8_array()[1] == 40); + EXPECT_TRUE(caseId, "11:Testee_ac", getAInt16_array()[0] == 51 && getAInt16_array()[1] == 41); + EXPECT_TRUE(caseId, "12:Testee_ac", getAInt32_array()[0] == 52 && getAInt32_array()[1] == 42); + EXPECT_TRUE(caseId, "13:Testee_ac", getAInt64_array()[0] == 53L && getAInt64_array()[1] == 43L); + EXPECT_EQUAL_FLOAT32(caseId, "14.1:Testee_ac", 5.4f, getAFloat32_array()[0], 0.1f); + EXPECT_EQUAL_FLOAT32(caseId, "14.2:Testee_ac", 4.4f, getAFloat32_array()[1], 0.1f); + EXPECT_TRUE(caseId, "15:Testee_ac", getAFloat64_array()[0] == 5.5 && getAFloat64_array()[1] == 4.5); + EXPECT_TRUE(caseId, "16:Testee_ac", String.valueOf(getAChar_array()).equals("BB")); + EXPECT_TRUE(caseId, "18:Testee_ac", getABool_array()[0] == true && getABool_array()[1] == false); + EXPECT_TRUE(caseId, "19:Testee_ac", "Okay".equals(getDc().getAString())); + EXPECT_TRUE(caseId, "20:Testee_ac", getDc().getNested().getAInt32() == 56); + timer.startTimer(1);''' } State Done { - entry { - "\tetUnit_testFinished(caseId);" - } + entry ''' etUnit_testFinished(caseId);''' } } } } DataClass Data_dc { - Attribute aString:string + Attribute aString: string Attribute nested: Data_nested_dc } DataClass Data_nested_dc { Attribute aInt32: int32 } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room index 42f0554ac..0e8f5f734 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/SendingDataTest.room @@ -1,8 +1,13 @@ RoomModel SendingDataTest { - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - import room.basic.language.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Language.room" + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.int64 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.test.TestInstance + import room.basic.language.languageIndicator ActorClass SendingDataTop { @TestInstance @@ -27,125 +32,87 @@ RoomModel SendingDataTest { triggers { } - action { - "PingPongPort.pongInt16(transitionData);" - } + action '''PingPongPort.pongInt16(transitionData);''' } Transition tr1: reply -> reply { triggers { } - action { - "PingPongPort.pongInt8(transitionData);" - } + action '''PingPongPort.pongInt8(transitionData);''' } Transition init: initial -> reply { } Transition tr2: reply -> reply { triggers { } - action { - "PingPongPort.pongInt32(transitionData);" - } + action '''PingPongPort.pongInt32(transitionData);''' } Transition tr3: reply -> reply { triggers { } - action { - "PingPongPort.pongFloat32(transitionData);" - } + action '''PingPongPort.pongFloat32(transitionData);''' } Transition tr4: reply -> reply { triggers { } - action { - "PingPongPort.pongFloat64(transitionData);" - } + action '''PingPongPort.pongFloat64(transitionData);''' } Transition tr7: reply -> cp cp0 { triggers { - + } } Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32(transitionData+10);" - } + action '''PingPongPort.pongInt32(transitionData+10);''' } Transition tr6: cp cp0 -> reply { - cond { - "transitionData!=5" - } - action { - "PingPongPort.pongInt32(transitionData);" - } + cond '''transitionData!=5''' + action '''PingPongPort.pongInt32(transitionData);''' } Transition tr9: reply -> reply { triggers { } - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr11: reply -> reply { triggers { } - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr5: reply -> reply { triggers { } - action { - "PingPongPort.pongInt64(transitionData);" - } + action '''PingPongPort.pongInt64(transitionData);''' } Transition tr10: reply -> reply { triggers { } - action { - "PingPongPort.pongInt16(transitionData);" - } + action '''PingPongPort.pongInt16(transitionData);''' } Transition tr12: reply -> cp cp1 { triggers { - - } - action { - "PingPongPort.pongComplex(transitionData);" + } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(transitionData);" - } + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr14: cp cp1 -> reply { - cond { - "transitionData.i8Val==7" - } - action { - "PingPongPort.pongComplex(transitionData);" - } + cond '''transitionData.i8Val==7''' + action '''PingPongPort.pongComplex(transitionData);''' } Transition tr15: reply -> reply { triggers { } - action { - "PingPongPort.pongComplexDerived(transitionData);" - } + action '''PingPongPort.pongComplexDerived(transitionData);''' } ChoicePoint cp0 ChoicePoint cp1 @@ -177,281 +144,254 @@ RoomModel SendingDataTest { Behavior { StateMachine { Transition init: initial -> tp0 of state0 { - action { - "caseId = etUnit_openAll(\"log\", \"SendingDataTest\", \"org.eclipse.etrice.generator.java.tests.SendingDataTest\", \"SendingDataTest_case\");" - "EXPECT_ORDER_START(caseId,resultlist,23);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "// send the default values" - "" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(i16Val);" - "PingPongPort.pingInt32Ref(i32Val);" - "i8Val++;" - "i16Val++;" - "i32Val++;" - "i64Val++;" - "f32Val+=10.1;" - "f64Val+=20.2;" - "PingPongPort.pingInt8(i8Val);" - "PingPongPort.pingInt16(i16Val);" - "PingPongPort.pingInt32(i32Val);" - "PingPongPort.pingInt64(i64Val);" - "PingPongPort.pingFloat32(f32Val);" - "PingPongPort.pingFloat64(f64Val);" - "PingPongPort.pingInt16Ref(i16Val);" - "PingPongPort.pingInt32Ref(i32Val);" - } + action ''' + caseId = etUnit_openAll("log", "SendingDataTest", "org.eclipse.etrice.generator.java.tests.SendingDataTest", "SendingDataTest_case"); + EXPECT_ORDER_START(caseId,resultlist,23); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1); + // send the default values + + PingPongPort.pingInt8(i8Val); + PingPongPort.pingInt16(i16Val); + PingPongPort.pingInt32(i32Val); + PingPongPort.pingInt64(i64Val); + PingPongPort.pingFloat32(f32Val); + PingPongPort.pingFloat64(f64Val); + PingPongPort.pingInt16Ref(i16Val); + PingPongPort.pingInt32Ref(i32Val); + i8Val++; + i16Val++; + i32Val++; + i64Val++; + f32Val+=10.1; + f64Val+=20.2; + PingPongPort.pingInt8(i8Val); + PingPongPort.pingInt16(i16Val); + PingPongPort.pingInt32(i32Val); + PingPongPort.pingInt64(i64Val); + PingPongPort.pingFloat32(f32Val); + PingPongPort.pingFloat64(f64Val); + PingPongPort.pingInt16Ref(i16Val); + PingPongPort.pingInt32Ref(i32Val);''' } Transition tr0: tp1 of state0 -> tp0 of state1 Transition tr1: tp1 of state1 -> test_finished State state0 { subgraph { Transition tr0: my tp0 -> receiveFirst7 { - action { - "counter=0;" - } + action '''counter=0;''' } Transition tr1: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==5){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 2); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr2: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==19){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 3); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr3: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==4711){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 4); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr4: receiveFirst7 -> receiveSecond7 { triggers { - - } - action { - "counter=0;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (transitionData==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (transitionData==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } + + } + action ''' + counter=0; + if (lang == 1){ + // Java cannot send references of primitive types + if (transitionData==4711){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + } + if (lang == 2){ + // C + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 9); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + }''' } Transition tr6: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if (transitionData==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==11470815){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 5); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr5: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if ((transitionData>3)&&(transitionData<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>3)&&(transitionData<4)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 6); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr7: receiveFirst7 -> receiveFirst7 { triggers { } - action { - "counter++;" - "if ((transitionData>7)&&(transitionData<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>7)&&(transitionData<8)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 7); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr8: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==6){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 10); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr9: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 11); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr10: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 12); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr11: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if (transitionData==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData==11470816){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 13); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr12: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if ((transitionData>13)&&(transitionData<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>13)&&(transitionData<14)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 14); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr13: receiveSecond7 -> receiveSecond7 { triggers { } - action { - "counter++;" - "if ((transitionData>28)&&(transitionData<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if ((transitionData>28)&&(transitionData<29)){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 15); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr14: receiveSecond7 -> my tp1 { triggers { - - } - action { - "if (transitionData==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + + } + action ''' + if (transitionData==4712){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 17); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr15: receiveFirst7 -> receiveFirst7 { triggers { - - } - action { - "counter++;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (transitionData==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (transitionData==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } + + } + action ''' + counter++; + if (lang == 1){ + // Java cannot send references of primitive types + if (transitionData==19){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + } + if (lang == 2){ + // C + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 8); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + }''' } Transition tr16: receiveSecond7 -> receiveSecond7 { triggers { - - } - action { - "counter++;" - "if (transitionData==20){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 16);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + + } + action ''' + counter++; + if (transitionData==20){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 16); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } EntryPoint tp0 ExitPoint tp1 @@ -460,76 +400,69 @@ RoomModel SendingDataTest { } } State test_finished { - entry { - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 23);" - "etUnit_closeAll(caseId);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 23); + etUnit_closeAll(caseId); + etUnit_testFinished(caseId);''' } State state1 { subgraph { Transition tr0: my tp0 -> state0 { - action { - "counter=0;" - "// send default values" - "PingPongPort.pingComplex(data);" - "PingPongPort.pingComplexRef(data);" - } + action ''' + counter=0; + // send default values + PingPongPort.pingComplex(data); + PingPongPort.pingComplexRef(data);''' } Transition tr1: state0 -> state1 { triggers { - - } - action { - "counter=0;" - "if (transitionData.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.complexVal.i32Val2==80){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 20);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "dataD.i8Val=11;" - "PingPongPort.pingComplexDerived(dataD);" - } + + } + action ''' + counter=0; + if (transitionData.i8Val==10){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 19); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + if (transitionData.complexVal.i32Val2==80){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 20); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + dataD.i8Val=11; + PingPongPort.pingComplexDerived(dataD);''' } Transition tr2: state0 -> state0 { triggers { } - action { - "counter++;" - "if (transitionData.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + counter++; + if (transitionData.i8Val==10){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 18); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } Transition tr3: state1 -> my tp1 { triggers { } - action { - "if (transitionData.i8Val==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (transitionData.i32Val3==150){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 22);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } + action ''' + if (transitionData.i8Val==11){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 21); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + } + + if (transitionData.i32Val3==150){ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 22); + }else{ + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + }''' } EntryPoint tp0 ExitPoint tp1 @@ -543,27 +476,27 @@ RoomModel SendingDataTest { ProtocolClass PingPongProtocol { incoming { - Message pingInt8(d: int8) - Message pingInt16(d: int16) - Message pingInt32(d: int32) - Message pingInt64(d: int64) - Message pingFloat32(d: float32) - Message pingFloat64(d: float64) - Message pingInt16Ref(d: int16 ref) - Message pingInt32Ref(d: int32 ref) - Message pingComplex(d: PingPongData) - Message pingComplexRef(d: PingPongData ref) - Message pingComplexDerived(d:PingPongDataDerived) + Message pingInt8(int8) + Message pingInt16(int16) + Message pingInt32(int32) + Message pingInt64(int64) + Message pingFloat32(float32) + Message pingFloat64(float64) + Message pingInt16Ref(int16 ref) + Message pingInt32Ref(int32 ref) + Message pingComplex(PingPongData) + Message pingComplexRef(PingPongData ref) + Message pingComplexDerived(PingPongDataDerived) } outgoing { - Message pongInt8(d: int8) - Message pongInt16(d: int16) - Message pongInt32(d: int32) - Message pongInt64(d:int64) - Message pongFloat32(d: float32) - Message pongFloat64(d: float64) - Message pongComplex(d: PingPongData) - Message pongComplexDerived(d: PingPongDataDerived) + Message pongInt8(int8) + Message pongInt16(int16) + Message pongInt32(int32) + Message pongInt64(int64) + Message pongFloat32(float32) + Message pongFloat64(float64) + Message pongComplex(PingPongData) + Message pongComplexDerived(PingPongDataDerived) } } diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config index 426adc5e6..8ce007ba5 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.config @@ -1,6 +1,12 @@ ConfigModel StaticTestConfig { - import StaticConfigTest.* from "StaticConfigTest.room" + import StaticConfigTest.Tester_ac + import StaticConfigTest.Testee_1_ac + import StaticConfigTest.Testee_Super2_ac + import StaticConfigTest.Testee_2_ac + import StaticConfigTest.TestProtocolAttributes + import StaticConfigTest.TestProtocolWithDataClass + import StaticConfigTest.System_StaticConfigTest ActorClassConfig Tester_ac { // nothing diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap index c0f26f88d..2fd5a28df 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.etmap @@ -1,10 +1,12 @@ MappingModel StaticConfigTest { - import StaticConfigTest.* from "StaticConfigTest.room" - import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" + import StaticConfigTest.System_StaticConfigTest + import room.generic.physical.GenericPhysicalSystem Mapping System_StaticConfigTest -> GenericPhysicalSystem { - SubSystemMapping main -> node {} + SubSystemMapping main -> node { + ThreadMapping defaultThread -> DefaultPhysicalThread + } } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room index b6242c9a1..a23ad8535 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StaticConfigTest.room @@ -1,16 +1,27 @@ RoomModel StaticConfigTest { - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - import room.basic.service.timing.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/TimingService.room" + import room.basic.types.boolean + import room.basic.types.char + import room.basic.types.int8 + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.types.int64 + import room.basic.types.float32 + import room.basic.types.float64 + import room.basic.types.string + import room.basic.service.timing.PTimer + import room.basic.service.timing.ATimingService LogicalSystem System_StaticConfigTest { - SubSystemRef main : SubSystem_StaticConfigTest + SubSystemRef main: SubSystem_StaticConfigTest } - + SubSystemClass SubSystem_StaticConfigTest { LayerConnection ref top satisfied_by timer.timer ActorRef top: Top_ac - ActorRef timer : ATimingService + ActorRef timer: ATimingService + + LogicalThread defaultThread } ActorClass Top_ac { @@ -18,30 +29,24 @@ RoomModel StaticConfigTest { LayerConnection ref testee_1 satisfied_by tester.spp ActorRef testee_1: Testee_1_ac ActorRef tester: Tester_ac - SAP timer : PTimer + SAP timer: PTimer } Behavior { - ctor { - "etUnit_open(\"log\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.java.tests.StaticConfigTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } + ctor ''' + etUnit_open("log", "StaticConfigTest"); + etUnit_openTestSuite("org.eclipse.etrice.generator.java.tests.StaticConfigTest");''' + dtor ''' + etUnit_closeTestSuite(); + etUnit_close();''' StateMachine { Transition init: initial -> state0 { - action { - "timer.startTimeout(1000);" - } + action '''timer.startTimeout(1000);''' } Transition tr0: state0 -> state0 { triggers { } - action { - "etUnit_testFinished(-1);" - } + action '''etUnit_testFinished(-1);''' } State state0 } @@ -64,20 +69,19 @@ RoomModel StaticConfigTest { StateMachine { Transition init: initial -> s1 State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" - "data_3.varCheck3(caseId);" - "SubSystemClassBase subSystem = (SubSystemClassBase) RTServices.getInstance().getSubSystem();" - "Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance(\"/System_StaticConfigTest/main/top/tester/testee_super2\");" - "int caseId_2 = etUnit_openTestCase(\"AttrConfigTest_case_Testee_Super2_ac\");" - "testee_super2.getReg_port().varCheck(caseId_2);" - "EXPECT_TRUE(caseId_2, \"Tester_ac:1\", testee_super2.getFloat64_super_r() == 1.1);" - "EXPECT_TRUE(caseId_2, \"Tester_ac:2\", testee_super2.getFloat64_super_c() == 2.2);" - "EXPECT_TRUE(caseId_2, \"Tester_ac:3\", testee_super2.getFloat64_super_i() == 3.3);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Tester_ac:4\", 25.f, testee_super2.getReg_port().getFloat_i(), 0.1f);" - "etUnit_closeTestCase(caseId);" - "etUnit_closeTestCase(caseId_2);" - } + entry ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Tester_ac"); + data_3.varCheck3(caseId); + SubSystemClassBase subSystem = (SubSystemClassBase) RTServices.getInstance().getSubSystem(); + Testee_Super2_ac testee_super2 = (Testee_Super2_ac) subSystem.getInstance("/System_StaticConfigTest/main/top/tester/testee_super2"); + int caseId_2 = etUnit_openTestCase("AttrConfigTest_case_Testee_Super2_ac"); + testee_super2.getReg_port().varCheck(caseId_2); + EXPECT_TRUE(caseId_2, "Tester_ac:1", testee_super2.getFloat64_super_r() == 1.1); + EXPECT_TRUE(caseId_2, "Tester_ac:2", testee_super2.getFloat64_super_c() == 2.2); + EXPECT_TRUE(caseId_2, "Tester_ac:3", testee_super2.getFloat64_super_i() == 3.3); + EXPECT_EQUAL_FLOAT32(caseId,"Tester_ac:4", 25.f, testee_super2.getReg_port().getFloat_i(), 0.1f); + etUnit_closeTestCase(caseId); + etUnit_closeTestCase(caseId_2);''' } } } @@ -99,54 +103,49 @@ RoomModel StaticConfigTest { StateMachine { Transition init: initial -> s1 State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_1_ac\");" - "conj_port.varCheck();" - "data_1.varCheck1(caseId);" - "EXPECT_FALSE(caseId,\"testee_1:data_1:1\", getData_1().getBool_c());" - "EXPECT_TRUE(caseId,\"testee_1:data_1:2\", getData_1().getInt8_c() == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:3\", getData_1().getInt16_c() == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:4\", getData_1().getInt32_c() == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:5\", getData_1().getInt64_c() == 192);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:6\", 9.6f, getData_1().getFloat32_c(), 0.1f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:7\", getData_1().getFloat64_c() == 19.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:8\", getData_1().getChar_c() == \'C\');" - "EXPECT_TRUE(caseId,\"testee_1:data_1:9\", getData_1().getString_c().equals(\":)\"));" - "EXPECT_TRUE(caseId,\"testee_1:data_1:10\", getData_1().getBool_i());" - "EXPECT_TRUE(caseId,\"testee_1:data_1:11\", getData_1().getInt8_i() == 2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:12\", getData_1().getInt16_i() == 4);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:13\", getData_1().getInt32_i() == 8);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:14\", getData_1().getInt64_i() == 16);" - "EXPECT_EQUAL_FLOAT32(caseId,\"testee_1:data_1:15\", 1.6f, getData_1().getFloat32_i(), 0.1f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:16\", getData_1().getFloat64_i() == 3.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:17\", getData_1().getChar_i() == \'I\');" - "EXPECT_TRUE(caseId,\"testee_1:data_1:18\", getData_1().getString_i().equals(\":]\"));" - - // Array - "EXPECT_TRUE(caseId,\"testee_1:data_1:19\", getData_1().getBool_array_c()[0] == true && getData_1().getBool_array_c()[1] == false);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:20\", getData_1().getInt8_array_c()[0] == 24 && getData_1().getInt8_array_c()[1] == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:21\", getData_1().getInt16_array_c()[0] == 48 && getData_1().getInt16_array_c()[1] == 96);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:22\", getData_1().getInt32_array_c()[0] == 96 && getData_1().getInt32_array_c()[1] == 192);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:23\", getData_1().getInt64_array_c()[0] == 192 && getData_1().getInt64_array_c()[1] == 384);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:24\", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 9.6f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:25\", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 19.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:26\", String.valueOf(getData_1().getChar_array_c()).equals(\"Claz\"));" - "EXPECT_TRUE(caseId,\"testee_1:data_1:27\", getData_1().getBool_array_i()[0] == true && getData_1().getBool_array_i()[1] == true);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:28\", getData_1().getInt8_array_i()[0] == 2 && getData_1().getInt8_array_i()[1] == 6);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:29\", getData_1().getInt16_array_i()[0] == 4 && getData_1().getInt16_array_i()[1] == 12);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:30\", getData_1().getInt32_array_i()[0] == 8 && getData_1().getInt32_array_i()[1] == 24);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:31\", getData_1().getInt64_array_i()[0] == 16 && getData_1().getInt64_array_i()[1] == 48);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:32\", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 1.6f);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:33\", getData_1().getFloat64_array_i()[0] == 3.2 && getData_1().getFloat64_array_i()[1] == 3.2);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:34\", String.valueOf(getData_1().getChar_array_i()).equals(\"Inst\"));" - "EXPECT_TRUE(caseId,\"testee_1:data_1:35\", getData_1().getData_2().getInt32_c() == 42);" - "EXPECT_TRUE(caseId,\"testee_1:data_1:36\", getData_1().getData_2().getInt32_i() == 43);" - - // enums - "EXPECT_TRUE(caseId,\"testee_1:enumval1\", getEnumval1() == Enum_1.two);" - "EXPECT_TRUE(caseId,\"testee_1:enumval2\", getEnumval2() == Enum_2.three);" - "etUnit_closeTestCase(caseId);" - } + entry ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Testee_1_ac"); + conj_port.varCheck(); + data_1.varCheck1(caseId); + EXPECT_FALSE(caseId,"testee_1:data_1:1", getData_1().getBool_c()); + EXPECT_TRUE(caseId,"testee_1:data_1:2", getData_1().getInt8_c() == 24); + EXPECT_TRUE(caseId,"testee_1:data_1:3", getData_1().getInt16_c() == 48); + EXPECT_TRUE(caseId,"testee_1:data_1:4", getData_1().getInt32_c() == 96); + EXPECT_TRUE(caseId,"testee_1:data_1:5", getData_1().getInt64_c() == 192); + EXPECT_EQUAL_FLOAT32(caseId,"testee_1:data_1:6", 9.6f, getData_1().getFloat32_c(), 0.1f); + EXPECT_TRUE(caseId,"testee_1:data_1:7", getData_1().getFloat64_c() == 19.2); + EXPECT_TRUE(caseId,"testee_1:data_1:8", getData_1().getChar_c() == 'C'); + EXPECT_TRUE(caseId,"testee_1:data_1:9", getData_1().getString_c().equals(":)")); + EXPECT_TRUE(caseId,"testee_1:data_1:10", getData_1().getBool_i()); + EXPECT_TRUE(caseId,"testee_1:data_1:11", getData_1().getInt8_i() == 2); + EXPECT_TRUE(caseId,"testee_1:data_1:12", getData_1().getInt16_i() == 4); + EXPECT_TRUE(caseId,"testee_1:data_1:13", getData_1().getInt32_i() == 8); + EXPECT_TRUE(caseId,"testee_1:data_1:14", getData_1().getInt64_i() == 16); + EXPECT_EQUAL_FLOAT32(caseId,"testee_1:data_1:15", 1.6f, getData_1().getFloat32_i(), 0.1f); + EXPECT_TRUE(caseId,"testee_1:data_1:16", getData_1().getFloat64_i() == 3.2); + EXPECT_TRUE(caseId,"testee_1:data_1:17", getData_1().getChar_i() == 'I'); + EXPECT_TRUE(caseId,"testee_1:data_1:18", getData_1().getString_i().equals(":]")); + EXPECT_TRUE(caseId,"testee_1:data_1:19", getData_1().getBool_array_c()[0] == true && getData_1().getBool_array_c()[1] == false); + EXPECT_TRUE(caseId,"testee_1:data_1:20", getData_1().getInt8_array_c()[0] == 24 && getData_1().getInt8_array_c()[1] == 48); + EXPECT_TRUE(caseId,"testee_1:data_1:21", getData_1().getInt16_array_c()[0] == 48 && getData_1().getInt16_array_c()[1] == 96); + EXPECT_TRUE(caseId,"testee_1:data_1:22", getData_1().getInt32_array_c()[0] == 96 && getData_1().getInt32_array_c()[1] == 192); + EXPECT_TRUE(caseId,"testee_1:data_1:23", getData_1().getInt64_array_c()[0] == 192 && getData_1().getInt64_array_c()[1] == 384); + EXPECT_TRUE(caseId,"testee_1:data_1:24", getData_1().getFloat32_array_c()[0] == 9.6f && getData_1().getFloat32_array_c()[1] == 9.6f); + EXPECT_TRUE(caseId,"testee_1:data_1:25", getData_1().getFloat64_array_c()[0] == 19.2 && getData_1().getFloat64_array_c()[1] == 19.2); + EXPECT_TRUE(caseId,"testee_1:data_1:26", String.valueOf(getData_1().getChar_array_c()).equals("Claz")); + EXPECT_TRUE(caseId,"testee_1:data_1:27", getData_1().getBool_array_i()[0] == true && getData_1().getBool_array_i()[1] == true); + EXPECT_TRUE(caseId,"testee_1:data_1:28", getData_1().getInt8_array_i()[0] == 2 && getData_1().getInt8_array_i()[1] == 6); + EXPECT_TRUE(caseId,"testee_1:data_1:29", getData_1().getInt16_array_i()[0] == 4 && getData_1().getInt16_array_i()[1] == 12); + EXPECT_TRUE(caseId,"testee_1:data_1:30", getData_1().getInt32_array_i()[0] == 8 && getData_1().getInt32_array_i()[1] == 24); + EXPECT_TRUE(caseId,"testee_1:data_1:31", getData_1().getInt64_array_i()[0] == 16 && getData_1().getInt64_array_i()[1] == 48); + EXPECT_TRUE(caseId,"testee_1:data_1:32", getData_1().getFloat32_array_i()[0] == 1.6f && getData_1().getFloat32_array_i()[1] == 1.6f); + EXPECT_TRUE(caseId,"testee_1:data_1:33", getData_1().getFloat64_array_i()[0] == 3.2 && getData_1().getFloat64_array_i()[1] == 3.2); + EXPECT_TRUE(caseId,"testee_1:data_1:34", String.valueOf(getData_1().getChar_array_i()).equals("Inst")); + EXPECT_TRUE(caseId,"testee_1:data_1:35", getData_1().getData_2().getInt32_c() == 42); + EXPECT_TRUE(caseId,"testee_1:data_1:36", getData_1().getData_2().getInt32_i() == 43); + EXPECT_TRUE(caseId,"testee_1:enumval1", getEnumval1() == Enum_1.two); + EXPECT_TRUE(caseId,"testee_1:enumval2", getEnumval2() == Enum_2.three); + etUnit_closeTestCase(caseId);''' } } } @@ -179,18 +178,17 @@ RoomModel StaticConfigTest { StateMachine { Transition init: initial -> s1 State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Testee_2_ac\");" - "sap.varCheck(caseId);" - "reg_port.varCheck(caseId);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:1\", float64_super_c == 2.2);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:2\", float64_super_i == 4.4);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:3\", int32_own_r == 11);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:4\", int32_own_c == 12);" - "EXPECT_TRUE(caseId, \"Testee_2_ac:5\", int32_own_i == 13);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Testee_2_ac:reg_port:6\", 50.f, reg_port.getFloat_i(), 0.1f);" - "etUnit_closeTestCase(caseId);" - } + entry ''' + caseId = etUnit_openTestCase("AttrConfigTest_case_Testee_2_ac"); + sap.varCheck(caseId); + reg_port.varCheck(caseId); + EXPECT_TRUE(caseId, "Testee_2_ac:1", float64_super_c == 2.2); + EXPECT_TRUE(caseId, "Testee_2_ac:2", float64_super_i == 4.4); + EXPECT_TRUE(caseId, "Testee_2_ac:3", int32_own_r == 11); + EXPECT_TRUE(caseId, "Testee_2_ac:4", int32_own_c == 12); + EXPECT_TRUE(caseId, "Testee_2_ac:5", int32_own_i == 13); + EXPECT_EQUAL_FLOAT32(caseId,"Testee_2_ac:reg_port:6", 50.f, reg_port.getFloat_i(), 0.1f); + etUnit_closeTestCase(caseId);''' } } } @@ -202,29 +200,27 @@ RoomModel StaticConfigTest { } regular PortClass { - Operation varCheck(caseId: int32) { - "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:1\", 4.f, float_r, 0.1f);" - "EXPECT_EQUAL_FLOAT32(caseId,\"TestProtocolAttributes:2\", 3.f, float_c, 0.1f);" - } + Operation varCheck(caseId: int32) ''' + EXPECT_EQUAL_FLOAT32(caseId,"TestProtocolAttributes:1", 4.f, float_r, 0.1f); + EXPECT_EQUAL_FLOAT32(caseId,"TestProtocolAttributes:2", 3.f, float_c, 0.1f);''' Attribute float_r: float32 = "4" Attribute float_c: float32 = "16" Attribute float_i: float32 = "256" } conjugated PortClass { - Operation varCheck() { - "int caseId = etUnit_openTestCase(\"ConfigTest_case_PortProtocol_conjugated\");" - "EXPECT_TRUE(caseId,\"array2_r[0]: <|MODEL_LOCATION|>\", array2_r[0] == 11);" - "EXPECT_TRUE(caseId,\"array2_r[1]: <|MODEL_LOCATION|>\", array2_r[1] == 22);" - "EXPECT_TRUE(caseId,\"array2_c[0]: <|MODEL_LOCATION|>\", array2_c[0] == 16);" - "EXPECT_TRUE(caseId,\"array2_c[1]: <|MODEL_LOCATION|>\", array2_c[1] == 32);" - "EXPECT_TRUE(caseId,\"array2_i[0]: <|MODEL_LOCATION|>\", array2_i[0] == 1);" - "EXPECT_TRUE(caseId,\"array2_i[1]: <|MODEL_LOCATION|>\", array2_i[1] == 2);" - "etUnit_closeTestCase(caseId);" - } - Attribute array2_r [ 2 ]: int64 = "{11,22}" - Attribute array2_c [ 2 ]: int64 = "{0,0}" - Attribute array2_i [ 2 ]: int64 = "{0,0}" + Operation varCheck() ''' + int caseId = etUnit_openTestCase("ConfigTest_case_PortProtocol_conjugated"); + EXPECT_TRUE(caseId,"array2_r[0]: <|MODEL_LOCATION|>", array2_r[0] == 11); + EXPECT_TRUE(caseId,"array2_r[1]: <|MODEL_LOCATION|>", array2_r[1] == 22); + EXPECT_TRUE(caseId,"array2_c[0]: <|MODEL_LOCATION|>", array2_c[0] == 16); + EXPECT_TRUE(caseId,"array2_c[1]: <|MODEL_LOCATION|>", array2_c[1] == 32); + EXPECT_TRUE(caseId,"array2_i[0]: <|MODEL_LOCATION|>", array2_i[0] == 1); + EXPECT_TRUE(caseId,"array2_i[1]: <|MODEL_LOCATION|>", array2_i[1] == 2); + etUnit_closeTestCase(caseId);''' + Attribute array2_r [2]: int64 = "{11,22}" + Attribute array2_c [2]: int64 = "{0,0}" + Attribute array2_i [2]: int64 = "{0,0}" } } @@ -233,15 +229,14 @@ RoomModel StaticConfigTest { Message dummy() } - //SAP + // SAP conjugated PortClass { - Operation varCheck(caseId: int32) { - "sap_data_2.varCheck2(caseId);" - "sap_data_3.varCheck3(caseId);" - "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_c() == 2);" - "EXPECT_TRUE(caseId, \"TestProtocolWithDataClass:1\", getSap_data_2().getInt32_i() == 3);" - } + Operation varCheck(caseId: int32) ''' + sap_data_2.varCheck2(caseId); + sap_data_3.varCheck3(caseId); + EXPECT_TRUE(caseId, "TestProtocolWithDataClass:1", getSap_data_2().getInt32_c() == 2); + EXPECT_TRUE(caseId, "TestProtocolWithDataClass:1", getSap_data_2().getInt32_i() == 3);''' Attribute sap_data_2: Data_2_dc // none config test @@ -251,7 +246,7 @@ RoomModel StaticConfigTest { DataClass Data_Super1_dc { - // PrimitiveType + // PrimitiveType Attribute bool_r: boolean = "false" Attribute bool_c: boolean = "false" Attribute bool_i: boolean = "false" @@ -260,39 +255,34 @@ RoomModel StaticConfigTest { Attribute int8_i: int8 = "8" // Array - Attribute bool_array_r [ 2 ]: boolean = "{ FALSE, false }" - Attribute bool_array_c [ 2 ]: boolean = "{ false, false }" - Attribute bool_array_i [ 2 ]: boolean = "{ false, false }" - Attribute int8_array_r [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_c [ 2 ]: int8 = "{ 8, 16 }" - Attribute int8_array_i [ 2 ]: int8 = "{ 8, 16 }" + Attribute bool_array_r [2]: boolean = "{ FALSE, false }" + Attribute bool_array_c [2]: boolean = "{ false, false }" + Attribute bool_array_i [2]: boolean = "{ false, false }" + Attribute int8_array_r [2]: int8 = "{ 8, 16 }" + Attribute int8_array_c [2]: int8 = "{ 8, 16 }" + Attribute int8_array_i [2]: int8 = "{ 8, 16 }" } DataClass Data_1_dc extends Data_Super1_dc { - Operation varCheck1(caseId: int32) { - "data_2.varCheck2(caseId);" - - // PrimitiveType - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:1\", bool_r == false);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:2\", int8_r == 8);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:3\", int16_r == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:4\", int32_r == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:5\", int64_r == 64);" - "EXPECT_EQUAL_FLOAT32(caseId,\"Data_1_dc:varCheck:6\", 3.2f, float32_r, 0.1f);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:7\", float64_r == 6.4);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:8\", char_r == \'R\');" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:9\", string_r.equals(\":/\"));" - - // Array - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:10\", bool_array_r[0] == false && bool_array_r[1] == false);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:11\", int8_array_r[0] == 8 && int8_array_r[1] == 16);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:12\", int16_array_r[0] == 16 && int16_array_r[1] == 32);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:13\", int32_array_r[0] == 32 && int32_array_r[1] == 64);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:24\", int64_array_r[0] == 64 && int64_array_r[1] == 128);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:25\", float32_array_r[0] == 3.2f && float32_array_r[1] == 6.4f);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:26\", float64_array_r[0] == 6.4 && float64_array_r[1] == 12.8);" - "EXPECT_TRUE(caseId,\"Data_1_dc:varCheck:27\", String.valueOf(char_array_r).equals(\"ROOM\"));" - } + Operation varCheck1(caseId: int32) ''' + data_2.varCheck2(caseId); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:1", bool_r == false); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:2", int8_r == 8); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:3", int16_r == 16); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:4", int32_r == 32); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:5", int64_r == 64); + EXPECT_EQUAL_FLOAT32(caseId,"Data_1_dc:varCheck:6", 3.2f, float32_r, 0.1f); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:7", float64_r == 6.4); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:8", char_r == 'R'); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:9", string_r.equals(":/")); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:10", bool_array_r[0] == false && bool_array_r[1] == false); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:11", int8_array_r[0] == 8 && int8_array_r[1] == 16); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:12", int16_array_r[0] == 16 && int16_array_r[1] == 32); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:13", int32_array_r[0] == 32 && int32_array_r[1] == 64); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:24", int64_array_r[0] == 64 && int64_array_r[1] == 128); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:25", float32_array_r[0] == 3.2f && float32_array_r[1] == 6.4f); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:26", float64_array_r[0] == 6.4 && float64_array_r[1] == 12.8); + EXPECT_TRUE(caseId,"Data_1_dc:varCheck:27", String.valueOf(char_array_r).equals("ROOM"));''' Attribute int16_r: int16 = "16" Attribute int16_c: int16 = "16" Attribute int16_i: int16 = "16" @@ -316,60 +306,58 @@ RoomModel StaticConfigTest { Attribute string_i: string = ":/" // Array - Attribute int16_array_r [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_c [ 2 ]: int16 = "{ 16, 32 }" - Attribute int16_array_i [ 2 ]: int16 = "{ 16, 32 }" - Attribute int32_array_r [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_c [ 2 ]: int32 = "{ 32, 64 }" - Attribute int32_array_i [ 2 ]: int32 = "{ 32, 64 }" - Attribute int64_array_r [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_c [ 2 ]: int64 = "{ 64, 128 }" - Attribute int64_array_i [ 2 ]: int64 = "{ 64, 128 }" - Attribute float32_array_r [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_c [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float32_array_i [ 2 ]: float32 = "{ 3.2, 6.4 }" - Attribute float64_array_r [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_c [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute float64_array_i [ 2 ]: float64 = "{ 6.4, 12.8 }" - Attribute char_array_r [ 5 ]: char = "ROOM" - Attribute char_array_c [ 5 ]: char = "ROOM" - Attribute char_array_i [ 5 ]: char = "ROOM" + Attribute int16_array_r [2]: int16 = "{ 16, 32 }" + Attribute int16_array_c [2]: int16 = "{ 16, 32 }" + Attribute int16_array_i [2]: int16 = "{ 16, 32 }" + Attribute int32_array_r [2]: int32 = "{ 32, 64 }" + Attribute int32_array_c [2]: int32 = "{ 32, 64 }" + Attribute int32_array_i [2]: int32 = "{ 32, 64 }" + Attribute int64_array_r [2]: int64 = "{ 64, 128 }" + Attribute int64_array_c [2]: int64 = "{ 64, 128 }" + Attribute int64_array_i [2]: int64 = "{ 64, 128 }" + Attribute float32_array_r [2]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_c [2]: float32 = "{ 3.2, 6.4 }" + Attribute float32_array_i [2]: float32 = "{ 3.2, 6.4 }" + Attribute float64_array_r [2]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_c [2]: float64 = "{ 6.4, 12.8 }" + Attribute float64_array_i [2]: float64 = "{ 6.4, 12.8 }" + Attribute char_array_r [5]: char = "ROOM" + Attribute char_array_c [5]: char = "ROOM" + Attribute char_array_i [5]: char = "ROOM" // ComplexType Attribute data_2: Data_2_dc } DataClass Data_2_dc { - Operation varCheck2(caseId: int32) { - "EXPECT_TRUE(caseId, \"Data_2_dc:1\", int32_r == 1);" - } + Operation varCheck2(caseId: int32) '''EXPECT_TRUE(caseId, "Data_2_dc:1", int32_r == 1);''' Attribute int32_r: int32 = "1" Attribute int32_c: int32 = "1" Attribute int32_i: int32 = "1" } DataClass Data_3_dc { - Operation varCheck3(caseId: int32) { - "EXPECT_TRUE(caseId, \"Data_3_dc:1\", dataClass_ref == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:2\", dataClass_array[0].getInt32_r() == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:3\", dataClass_array[1].getInt32_c() == 1);" - "EXPECT_TRUE(caseId, \"Data_3_dc:4\", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:5\", ext_type instanceof External_Type_Test);" - "EXPECT_TRUE(caseId, \"Data_3_dc:6\", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test);" - "EXPECT_TRUE(caseId, \"Data_3_dc:7\", ext_type_ref == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:8\", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null);" - "EXPECT_TRUE(caseId, \"Data_3_dc:9\", primitive_array_ref instanceof byte[]);" - "EXPECT_TRUE(caseId, \"Data_3_dc:10\", string_ref == null);" - } + Operation varCheck3(caseId: int32) ''' + EXPECT_TRUE(caseId, "Data_3_dc:1", dataClass_ref == null); + EXPECT_TRUE(caseId, "Data_3_dc:2", dataClass_array[0].getInt32_r() == 1); + EXPECT_TRUE(caseId, "Data_3_dc:3", dataClass_array[1].getInt32_c() == 1); + EXPECT_TRUE(caseId, "Data_3_dc:4", dataClass_ref_array[0] == null && dataClass_ref_array[1] == null); + EXPECT_TRUE(caseId, "Data_3_dc:5", ext_type instanceof External_Type_Test); + EXPECT_TRUE(caseId, "Data_3_dc:6", ext_type_array[0] instanceof External_Type_Test && ext_type_array[1] instanceof External_Type_Test); + EXPECT_TRUE(caseId, "Data_3_dc:7", ext_type_ref == null); + EXPECT_TRUE(caseId, "Data_3_dc:8", ext_type_ref_array[0] == null && ext_type_ref_array[1] == null); + EXPECT_TRUE(caseId, "Data_3_dc:9", primitive_array_ref instanceof byte[]); + EXPECT_TRUE(caseId, "Data_3_dc:10", string_ref == null);''' + // none config test - Attribute dataClass_array [ 2 ]: Data_2_dc + Attribute dataClass_array [2]: Data_2_dc Attribute dataClass_ref: Data_2_dc ref - Attribute dataClass_ref_array [ 2 ]: Data_2_dc ref + Attribute dataClass_ref_array [2]: Data_2_dc ref Attribute ext_type: extType - Attribute ext_type_array [ 2 ]: extType + Attribute ext_type_array [2]: extType Attribute ext_type_ref: extType ref - Attribute ext_type_ref_array [ 2 ]: extType ref - Attribute primitive_array_ref [ 2 ]: int8 ref + Attribute ext_type_ref_array [2]: extType ref + Attribute primitive_array_ref [2]: int8 ref Attribute string_ref: string ref // no check at all @@ -384,10 +372,9 @@ RoomModel StaticConfigTest { one, two } - + Enumeration Enum_2 of int16 { - three=3, + three = 3, four } - } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room index 300e23378..e2b90eea7 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room @@ -1,7 +1,7 @@ RoomModel StoreRestoreTest { - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - + import room.basic.test.TestInstance + ActorClass StoreRestore_Top { @TestInstance Structure { @@ -9,7 +9,8 @@ RoomModel StoreRestoreTest { ActorRef testee: Testee Binding tester.prt and testee.prt } - Behavior { } + Behavior { + } } ActorClass Testee { @@ -17,35 +18,34 @@ RoomModel StoreRestoreTest { Port prt: PC } Structure { - usercode1 { "import StoreRestoreTest.ObjectHolder;" } - + usercode1 '''import StoreRestoreTest.ObjectHolder;''' + external Port prt - + Attribute ival: int16 - Attribute iarr [ 3 ]: int32 + Attribute iarr [3]: int32 Attribute sdval: SomeData - Attribute sdarr [ 5 ]: SomeData + Attribute sdarr [5]: SomeData Attribute cdval: ComplexData } Behavior { - Operation doStore() { - "System.out.println(\"doStore()\");" - "IActorClassDataObject dataObject = newDataObject();" - "store(dataObject);" - "ObjectHolder.setObject(dataObject);" - } - Operation doRestore() { - "System.out.println(\"doRestore()\");" - "IActorClassDataObject dataObject = ObjectHolder.getObject();" - "restore(dataObject);" - } + Operation doStore() ''' + System.out.println("doStore()"); + IActorClassDataObject dataObject = newDataObject(); + store(dataObject); + ObjectHolder.setObject(dataObject);''' + Operation doRestore() ''' + System.out.println("doRestore()"); + IActorClassDataObject dataObject = ObjectHolder.getObject(); + restore(dataObject);''' StateMachine { Transition tr0: my tp0 -> Restore { triggers { } } - Transition init: initial -> Begin { } + Transition init: initial -> Begin { + } Transition tr1: Begin -> Store { triggers { @@ -63,68 +63,59 @@ RoomModel StoreRestoreTest { } TransitionPoint tp0 State Begin { - entry { - "ival = 3;" - } + entry '''ival = 3;''' } State Store { - entry { - "System.out.println(\"<|MODEL_LOCATION|>\");" - "setFinalAction(new SingleFinalAction() {" - "\tpublic void run() {" - "\t\tdoStore();" - "\t}" - "});" - } + entry ''' + System.out.println("<|MODEL_LOCATION|>"); + setFinalAction(new SingleFinalAction() { + public void run() { + doStore(); + } + });''' } State state2 { - entry { - "prt.valueIs(ival);" - "" - "ival = 123;" - } + entry ''' + prt.valueIs(ival); + + ival = 123;''' } State Restore { - entry { - "System.out.println(\"<|MODEL_LOCATION|>\");" - "setFinalAction(new SingleFinalAction() {" - "\tpublic void run() {" - "\t\tdoRestore();" - "\t}" - "});" - } + entry ''' + System.out.println("<|MODEL_LOCATION|>"); + setFinalAction(new SingleFinalAction() { + public void run() { + doRestore(); + } + });''' } State state3 { - entry { - "ival = 456;" - "" - "prt.answer();" - } + entry ''' + ival = 456; + + prt.answer();''' } } } } - + ActorClass Tester { Interface { conjugated Port prt: PC } Structure { external Port prt - + Attribute caseId: int32 Attribute counter: int32 = "0" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.java.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - + ctor '''caseId = etUnit_openAll("log", "StoreRestoreTest", "org.eclipse.etrice.generator.java.tests.StoreRestoreTest", "StoreRestoreTest_case");''' + dtor '''etUnit_closeAll(caseId);''' + StateMachine { - Transition init: initial -> Prepare { } + Transition init: initial -> Prepare { + } Transition tr1: Loop2 -> cp cp0 { triggers { @@ -132,17 +123,13 @@ RoomModel StoreRestoreTest { } Transition tr2: cp cp0 -> Done Transition tr3: cp cp0 -> Loop { - cond { - "++counter<10" - } + cond '''++counter<10''' } Transition tr0: Prepare -> Prepare2 { triggers { } - action { - "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, transitionData);" - } + action '''EXPECT_EQUAL_INT16(caseId, "check old value <|MODEL_LOCATION|>", (short)3, transitionData);''' } Transition tr4: Prepare2 -> Loop { triggers { @@ -153,39 +140,29 @@ RoomModel StoreRestoreTest { triggers { } - action { - "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, transitionData);" - } + action '''EXPECT_EQUAL_INT16(caseId, "check old value <|MODEL_LOCATION|>", (short)3, transitionData);''' } ChoicePoint cp0 State Prepare { - entry { - "prt.step();" - "prt.step();" - } + entry ''' + prt.step(); + prt.step();''' } State Loop { - entry { - "prt.restore();" - "" - "prt.step();" - "prt.step();" - } + entry ''' + prt.restore(); + + prt.step(); + prt.step();''' } State Done { - entry { - "etUnit_testFinished(caseId);" - } + entry '''etUnit_testFinished(caseId);''' } State Prepare2 { - entry { - "prt.step();" - } + entry '''prt.step();''' } State Loop2 { - entry { - "prt.step();" - } + entry '''prt.step();''' } } } @@ -198,18 +175,18 @@ RoomModel StoreRestoreTest { } outgoing { Message answer() - Message valueIs(val: int16) + Message valueIs(int16) } } DataClass SomeData { Attribute ival: int16 - Attribute iarr [ 3 ]: int32 + Attribute iarr [3]: int32 } DataClass ComplexData { Attribute sdval: SomeData - Attribute sdarr [ 5 ]: SomeData + Attribute sdarr [5]: SomeData } PrimitiveType int16: ptInteger -> 'short' (Short) default '0' diff --git a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room index 456827558..fa510c573 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room @@ -1,9 +1,15 @@ RoomModel TCPTest { - import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" - import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Types.room" - import room.basic.service.tcp.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/TcpService.room" - + import room.basic.types.int16 + import room.basic.types.int32 + import room.basic.service.tcp.DTcpPayload + import room.basic.service.tcp.DTcpControl + import room.basic.service.tcp.PTcpPayload + import room.basic.service.tcp.PTcpControl + import room.basic.service.tcp.ATcpClient + import room.basic.service.tcp.ATcpServer + import room.basic.test.TestInstance + ActorClass TCPTestTop { @TestInstance Structure { @@ -15,7 +21,8 @@ RoomModel TCPTest { Binding ref2.p2 and ref1.ControlPort Binding ref2.p3 and ref1.PayloadPort } - Behavior { } + Behavior { + } } ActorClass Tester { @@ -30,109 +37,89 @@ RoomModel TCPTest { external Port p1 external Port p2 external Port p3 - Attribute controlData:DTcpControl - Attribute testData:DTcpPayload - Attribute counter:int32 - Attribute resultPattern:int32 - Attribute pattern:int32 + Attribute controlData: DTcpControl + Attribute testData: DTcpPayload + Attribute counter: int32 + Attribute resultPattern: int32 + Attribute pattern: int32 Attribute caseId: int32 - Attribute resultlist[3]: int16 = "{1,2,3}" - + Attribute resultlist [3]: int16 = "{1,2,3}" } Behavior { - ctor { - "caseId = etUnit_openAll(\"log\", \"TCPTest\", \"org.eclipse.etrice.generator.java.tests.TCPTest\", \"TCPTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } + ctor '''caseId = etUnit_openAll("log", "TCPTest", "org.eclipse.etrice.generator.java.tests.TCPTest", "TCPTest_case");''' + dtor '''etUnit_closeAll(caseId);''' StateMachine { Transition init: initial -> state0 { - action { - "EXPECT_ORDER_START(caseId,resultlist,3);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "// open Server" - "controlData.setIPAddr(\"127.0.0.1\");" - "controlData.setTcpPort(4711);" - "p0.open(controlData);" - } + action ''' + EXPECT_ORDER_START(caseId,resultlist,3); + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 1); + // open Server + controlData.setIPAddr("127.0.0.1"); + controlData.setTcpPort(4711); + p0.open(controlData);''' } Transition tr0: state0 -> state1 { triggers { } - action { - "// open 5 clients" - "for (int i=0;i cp cp0 { triggers { } - action { - "counter++;" - } + action '''counter++;''' } Transition tr4: cp cp0 -> state1 Transition tr5: cp cp0 -> state2 { - cond { - "counter>=p2.getReplication()" - } - action { - "String s=new String (\"Test!\");" - "testData.setData(s.getBytes());" - "testData.setLength(s.length());" - "testData.setConnectionId(0);" - "for (int i=0; i=p2.getReplication()''' + action ''' + String s=new String ("Test!"); + testData.setData(s.getBytes()); + testData.setLength(s.length()); + testData.setConnectionId(0); + for (int i=0; i cp cp2 { triggers { } - action { - "resultPattern+=p3.getIndexOf(ifitem);" - "//System.out.printf(\"c:%d, Idx:%d!\\n\", counter,p3.getIndexOf(ifitem));" - "counter++;" - } + action ''' + resultPattern+=p3.getIndexOf(ifitem); + //System.out.printf("c:%d, Idx:%d!\n", counter,p3.getIndexOf(ifitem)); + counter++;''' } Transition tr9: cp cp2 -> state2 Transition tr10: cp cp2 -> cp cp1 { - cond { - "counter>=p2.getReplication()" - } - action { - "int i;" - "p0.close();" - "// close all clients" - "p2.close();" - "pattern=0;" - "for (i=0;i=p2.getReplication()''' + action ''' + int i; + p0.close(); + // close all clients + p2.close(); + pattern=0; + for (i=0;i state2 { triggers { } - action { - "p1.send(transitionData);" - } + action '''p1.send(transitionData);''' } Transition tr2: cp cp1 -> test_failed Transition tr6: cp cp1 -> test_ok { - cond { - "pattern==resultPattern" - } + cond '''pattern==resultPattern''' } ChoicePoint cp0 ChoicePoint cp2 @@ -141,20 +128,18 @@ RoomModel TCPTest { State state1 State state2 State test_ok { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 2); + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 3); + etUnit_testFinished(caseId);''' } State test_failed { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" - "etUnit_testFinished(caseId);" - } + entry ''' + EXPECT_ORDER(caseId,"<|MODEL_LOCATION|>", 0xFF); + EXPECT_ORDER_END(caseId,"<|MODEL_LOCATION|>", 3); + etUnit_testFinished(caseId);''' } } } - } + } } \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch b/tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch deleted file mode 100644 index b6e1066d7..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/org.eclipse.etrice.generator.java.tests make.xml.launch +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room deleted file mode 100644 index eef0c5cdc..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room +++ /dev/null @@ -1,182 +0,0 @@ -RoomModel DynamicActorTest1 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - LogicalSystem JavaGenTests { - SubSystemRef da1Test : SubSystem_DynamicActorTest1 - } - - SubSystemClass SubSystem_DynamicActorTest1 { - ActorRef appl : Appl - - LogicalThread defaultThread - } - - ActorClass Appl { - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0: PC - Attribute caseId: int32 - optional ActorRef opt: Optional - - Binding p0 and opt.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - StateMachine { - Transition init: initial -> CreateOptional2 { } - Transition tr0: CreateOptional2 -> CreateOptional1 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da1Test/appl/cont/opt/sub2/deep_sub\"));" - "opt.destroyOptionalActor();" - } - } - Transition tr2: CreateOptional1 -> ReceivedHelloAgain { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC1:/JavaGenTests/da1Test/appl/cont/opt/sub1\"));" - "opt.destroyOptionalActor();" - } - } - State CreateOptional2 { - entry { - "opt.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } - } - State CreateOptional1 { - entry { - "opt.createOptionalActor(\"Optional1\", getThread());" - "p0.sayHello();" - } - } - State ReceivedHelloAgain { - entry { - "IRTObject opt = getChild(\"opt\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" - "" - "etUnit_testFinished(caseId);" - } - } - } - } - } - - // the class that is referenced as optional by the Container - // since it is abstract it just serves as an interface - abstract ActorClass Optional { - Interface { - Port p0: PC - } - Structure { } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional1 extends Optional { - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional2 extends Optional { - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC1:\"+getInstancePath());" - } - } - State Ready - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC3:\"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room deleted file mode 100644 index 5e646ac99..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room +++ /dev/null @@ -1,236 +0,0 @@ -RoomModel DynamicActorTest2 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - LogicalSystem JavaGenTests { - SubSystemRef da2Test : SubSystem_DynamicActorTest2 - } - - SubSystemClass SubSystem_DynamicActorTest2 { - ActorRef appl : Appl - - LogicalThread defaultThread - } - - ActorClass Appl { - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0[*]: PC - Attribute caseId: int32 - optional ActorRef optarray[*]: Optional - - Binding p0 and optarray.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - StateMachine { - Transition init: initial -> CreateOptional2 { } - Transition tr0: CreateOptional2 -> CreateOptional1 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" - } - } - Transition tr2: CreateOptional1 -> ReceivedHelloAgain { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:0/sub2/deep_sub\"));" - } - } - Transition tr1: ReceivedHelloAgain -> Destroy0 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" - } - } - Transition tr3: Destroy0 -> Destroy1Create2 { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC1:/JavaGenTests/da2Test/appl/cont/optarray:1/sub1\"));" - } - } - Transition tr4: Destroy1Create2 -> Done { - triggers { - - } - action { - "EXPECT_TRUE(caseId, \"<|MODEL_LOCATION|>\", transitionData.equals(\"AC3:/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" - } - } - State CreateOptional2 { - entry { - "optarray.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } - } - State CreateOptional1 { - entry { - "optarray.createOptionalActor(\"Optional1\", getThread());" - "p0.sayHello();" - } - } - State ReceivedHelloAgain - State Destroy0 { - entry { - "optarray.destroyOptionalActor(0);" - "p0.sayHello();" - } - } - State Destroy1Create2 { - entry { - "optarray.destroyOptionalActor(1);" - "" - "IRTObject opt = getChild(\"optarray\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "EXPECT_EQUAL_INT32(caseId, \"<|MODEL_LOCATION|>\", 2, size);" - "" - "optarray.createOptionalActor(\"Optional2\", getThread());" - "p0.sayHello();" - } - } - State Done { - entry { - "IRTObject opt = getChild(\"optarray\");" - "int size = opt.getChildren().size();" - "" - "// we expect the RTSystemPort and the InterfaceItemBroker" - "// plus an instance of Optional2" - "// plus 3 sub ports of RTSystemPort" - "EXPECT_EQUAL_INT32(caseId, \"\", 6, size);" - "" - "// we grab the leaf actor of the optional sub tree" - "IRTObject leafActor = getObject(\"/JavaGenTests/da2Test/appl/cont/optarray/optarray:1/sub2/deep_sub\");" - "size = leafActor.getChildren().size();" - "" - "// we expect an RTSystemPort and p0" - "EXPECT_EQUAL_INT32(caseId, \"\", 2, size);" - "" - "EXPECT_TRUE(caseId, \"\", leafActor.getInstancePath().equals(\"/JavaGenTests/da2Test/appl/cont/optarray:1/sub2/deep_sub\"));" - "" - "etUnit_testFinished(caseId);" - } - } - } - } - } - - // the class that is referenced as optional by the Container - // since it is abstract it just serves as an interface - abstract ActorClass Optional { - Interface { - Port p0: PC - } - Structure { } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional1 extends Optional { - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional2 extends Optional { - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC1:\"+getInstancePath());" - } - } - State Ready - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"AC3:\"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room deleted file mode 100644 index c6244399a..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room +++ /dev/null @@ -1,235 +0,0 @@ -RoomModel DynamicActorTest3 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef cont: Controller - } - Behavior { } - } - - ActorClass Controller { - Structure { - conjugated Port pwrk: PWorker - conjugated Port opt: PC - Attribute caseId: int32 - ActorRef worker: Worker - Binding pwrk and worker.fct - Binding opt and worker.opt - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> createOpt1 { } - Transition tr0: createOpt1 -> SendHello { - triggers { - - } - } - Transition tr1: SendHello -> TryCreateInvalid { - triggers { - - } - action { - "System.out.println(\"controller received \"+transitionData);" - } - } - Transition tr2: createOpt1 -> UnexpectedError { - triggers { - - } - } - Transition tr3: TryCreateInvalid -> ExpectedError { - triggers { - - } - } - State createOpt1 { - entry { - "pwrk.create(\"Optional1\");" - } - } - State SendHello { - entry { - "opt.sayHello();" - } - } - State TryCreateInvalid { - entry { - "pwrk.create(\"Optional\");" - } - } - State UnexpectedError - State ExpectedError { - entry { - "etUnit_testFinished(caseId);" - } - } - } - } - } - - ActorClass Worker { - Interface { - Port fct: PWorker - Port opt: PC - } - Structure { - external Port fct - optional ActorRef optRef: Optional - Binding opt and optRef.p0 - } - Behavior { - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "if (optRef.createOptionalActor(transitionData, getThread()))" - "\tfct.ok();" - "else" - "\tfct.error();" - } - } - State Ready - } - } - } - - // the class that is referenced as optional by the Worker - // since it is abstract it just serves as an interface - abstract ActorClass Optional { - Interface { - Port p0: PC - } - Structure { } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional1 extends Optional { - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - // a sub class of Optional which is valid as optional actor - ActorClass Optional2 extends Optional { - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - conjugated Port hlp: PC - ActorRef helper: AC3 - Binding hlp and helper.p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> AskHelper { - triggers { - - } - } - Transition tr1: AskHelper -> Ready { - triggers { - - } - action { - "System.out.println(\"helper said \"+transitionData);" - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - State Ready - State AskHelper { - entry { - "hlp.sayHello();" - } - } - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"this is AC3, instance \"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } - - ProtocolClass PWorker { - incoming { - Message create(ac: string) - } - outgoing { - Message ok() - Message error() - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room deleted file mode 100644 index 7affbda90..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room +++ /dev/null @@ -1,97 +0,0 @@ -RoomModel DynamicActorTest4 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0: PC - Attribute caseId: int32 - optional ActorRef opt: Optional - - Binding p0 and opt.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - - StateMachine { - Transition init: initial -> CreateOptional { } - Transition tr0: CreateOptional -> Done { - triggers { - - } - action { - "System.out.println(transitionData+\"\\n\");" - "opt.destroyOptionalActor();" - "dumpTree(\"after deletion of Optional2\");" - } - } - State CreateOptional { - entry { - "opt.createOptionalActor(\"Optional\", getThread());" - "p0.sayHello();" - } - } - State Done { - entry { - "etUnit_testFinished(caseId);" - } - } - } - } - } - - // the class that is referenced as optional by the Container - // It has an external end port and implements the behavior itself - ActorClass Optional { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - State Ready - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room deleted file mode 100644 index 795306dc0..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room +++ /dev/null @@ -1,149 +0,0 @@ -RoomModel DynamicActorTest5 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - conjugated Port p0: PC - Attribute caseId: int32 - optional ActorRef opt: Optional2 - - Binding p0 and opt.p0 - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - - StateMachine { - Transition init: initial -> CreateOptional2 { } - Transition tr0: CreateOptional2 -> Done { - triggers { - - } - action { - "dumpTree(\"after received hello\");" - "" - "System.out.println(\"received \"+transitionData);" - "" - "etUnit_testFinished(caseId);" - } - } - State CreateOptional2 { - entry { - "opt.createOptionalActor(\"Optional2\", getThread());" - "dumpTree(\"after creation of Optional2\");" - "" - "// at this point the port isn\'t connected since" - "// the init message isn\'t processed yet" - "// - so no peer port exists" - "p0.sayHello();" - } - } - State Done - } - } - } - - ActorClass Optional1 { - Interface { - Port p0: PC - } - Structure { - ActorRef sub1: AC1 - Binding p0 and sub1.p0 - } - Behavior { } - } - - ActorClass Optional2 { - Interface { - Port p0: PC - } - Structure { - ActorRef sub2: AC2 - Binding p0 and sub2.p0 - } - Behavior { } - } - - // the following actor classes are part of the possible optional instance sub trees - - ActorClass AC1 { - Interface { - Port p0: PC - } - Structure { - external Port p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - State Ready { - entry { - "p0.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - } - } - } - - ActorClass AC2 { - Interface { - Port p0: PC - } - Structure { - ActorRef deep_sub: AC3 - Binding p0 and deep_sub.p0 - } - Behavior { } - } - - ActorClass AC3 { - Interface { - Port p0: PC - } - Structure { - optional ActorRef nestedOpt: Optional1 - Binding p0 and nestedOpt.p0 - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - State Ready { - entry { - "nestedOpt.createOptionalActor(\"Optional1\", getThread());" - } - } - } - } - } - - // a simple protocol that is used to demonstrate that actors are connected - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room deleted file mode 100644 index 502efa7b0..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room +++ /dev/null @@ -1,243 +0,0 @@ -RoomModel DynamicActorTest6 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - ActorClass Appl { - @TestInstance - Structure { - ActorRef ctrl: Controller - } - Behavior { } - } - - ActorClass Controller { - Structure { - conjugated Port pcont: PCtrl - conjugated Port pout: PC - conjugated Port pin: PC - Attribute caseId: int32 - ActorRef cont: Container - Binding pcont and cont.fct - Binding pout and cont.pin - Binding pin and cont.pout - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> CreateOptionals { } - Transition tr0: CreateOptionals -> Sending { - triggers { - - } - } - Transition tr1: Sending -> Destroy { - triggers { - - } - action { - "System.out.println(\"Controller received: \"+transitionData);" - } - } - Transition tr2: Destroy -> CreateAgain { - triggers { - - } - } - Transition tr3: CreateAgain -> SendAgain { - triggers { - - } - } - Transition tr4: SendAgain -> Done { - triggers { - - } - action { - "System.out.println(\"Controller received: \"+transitionData);" - } - } - State CreateOptionals { - entry { - "pcont.createOpts();" - } - } - State Sending { - entry { - "pout.sayHello();" - } - } - State Done { - entry { - "etUnit_testFinished(caseId);" - } - } - State Destroy { - entry { - "pcont.destroyOpts();" - } - } - State CreateAgain { - entry { - "pcont.createOpts();" - } - } - State SendAgain { - entry { - "pout.sayHello();" - } - } - } - } - } - - ActorClass Container { - Interface { - Port fct: PCtrl - Port pout: PC - Port pin: PC - } - Structure { - external Port fct - optional ActorRef opt1: Optional1 - optional ActorRef opt2: Optional2 - Binding opt1.pout and opt2.pin - Binding pin and opt1.pin - Binding pout and opt2.pout - } - Behavior { - // this method prints the passed message and then dumps the object tree consisting of actors and ports - Operation dumpTree(msg: string) { - "System.out.println(msg);" - "System.out.println(((org.eclipse.etrice.runtime.java.messaging.RTObject)getRoot()).toStringRecursive());" - } - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "opt1.createOptionalActor(\"Optional1\", getThread());" - "opt2.createOptionalActor(\"Optional2\", getThread());" - "dumpTree(\"after creation of op1 and opt2\");" - "fct.done();" - } - } - Transition tr1: Ready -> Ready { - triggers { - - } - action { - "opt1.destroyOptionalActor();" - "opt2.destroyOptionalActor();" - "fct.done();" - } - } - State Ready - } - } - } - - ActorClass Optional1 { - Interface { - Port pout: PC - Port pin: PC - } - Structure { - ActorRef sub1: AC1 - Binding pin and sub1.pin - Binding pout and sub1.pout - } - Behavior { } - } - - ActorClass Optional2 { - Interface { - Port pout: PC - conjugated Port pin: PC - } - Structure { - ActorRef sub2: AC2 - Binding pout and sub2.pout - Binding pin and sub2.pin - } - Behavior { } - } - - ActorClass AC1 { - Interface { - Port pout: PC - Port pin: PC - } - Structure { - external Port pout - external Port pin - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "pout.hello(\"this is AC1, instance \"+getInstancePath());" - } - } - State Ready - } - } - } - - ActorClass AC2 { - Interface { - Port pout: PC - conjugated Port pin: PC - } - Structure { - external Port pout - external Port pin - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - action { - "System.out.println(\"AC2 received \"+transitionData);" - "" - "pout.hello(\"AC2: forwarding \"+transitionData);" - } - } - State Ready - } - } - } - - ProtocolClass PC { - incoming { - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } - - ProtocolClass PCtrl { - incoming { - Message createOpts() - Message destroyOpts() - } - outgoing { - Message done() - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room deleted file mode 100644 index 84cf22e12..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room +++ /dev/null @@ -1,375 +0,0 @@ -RoomModel DynamicActorTest7 { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - - LogicalSystem JavaGenTests { - SubSystemRef da7Test : SubSystem_DynamicActorTest7 - } - - SubSystemClass SubSystem_DynamicActorTest7 { - ActorRef main : Appl - - LogicalThread defaultThread - } - - ActorClass Appl { - Structure { - ActorRef cont: Container - } - Behavior { } - } - - ActorClass Container { - Structure { - usercode1 { - "import java.io.File;" - } - usercode2 { - "private static final String FIRST_OPT_OBJ = \"firstOpt.obj\";" - "private static final String SECOND_OPT_OBJ = \"secondOpt.obj\";" - } - conjugated Port op: PStep - conjugated Port opa [*]: PStep - - Attribute caseId: int32 - - optional ActorRef opt: Optional - optional ActorRef optarr [*]: Optional - - Binding op and opt.fct - Binding opa and optarr.fct - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - Operation clean() { - "File f = new File(FIRST_OPT_OBJ);" - "if (f.exists())" - "\tf.delete();" - } - StateMachine { - Transition init: initial -> Init { } - Transition tr0: Init -> DestroyAndCreate { - triggers { - - } - action { - "System.out.println(\"received \"+transitionData);" - } - } - Transition tr1: DestroyAndCreate -> DestroyAndRestore { - triggers { - - } - action { - "System.out.println(\"received \"+transitionData);" - } - } - Transition tr2: DestroyAndRestore -> LoadInArray { - triggers { - - } - action { - "System.out.println(\"received \"+transitionData);" - } - } - Transition tr3: LoadInArray -> ReceivedHello { - triggers { - - } - action { - "System.out.println(\"received \"+transitionData);" - } - } - Transition tr4: ReceivedHello -> Done { - triggers { - - } - action { - "System.out.println(\"received \"+transitionData);" - } - } - State Init { - entry { - "clean();" - "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "op.step();" - "op.step();" - "op.sayHello();" - } - } - State DestroyAndCreate { - entry { - "FilePersistor.saveAndDestroy(opt, FIRST_OPT_OBJ);" - "FilePersistor.createAndLoad(opt, getThread(), SECOND_OPT_OBJ, \"Optional2\");" - "op.step();" - "op.step();" - "op.sayHello();" - } - } - State DestroyAndRestore { - entry { - "FilePersistor.saveAndDestroy(opt, SECOND_OPT_OBJ);" - "FilePersistor.createAndLoad(opt, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "op.sayHello();" - } - } - State Done { - entry { - "IRTObject object = getObject(\"/JavaGenTests/da7Test/main/cont/optarr/optarr:0/sub\");" - "EXPECT_TRUE(caseId, \"object 0 of optarr is an instance of actor class Sub1\", object instanceof Sub1);" - "" - "Sub1 inst = (Sub1) object;" - "EXPECT_EQUAL_INT32(caseId, \"state\", Sub1.STATE_Step3_StepA, inst.getState());" - "EXPECT_EQUAL_INT32(caseId, \"current value of ival\", 123, inst.getIval());" - "EXPECT_EQUAL_INT16(caseId, \"current value of sval\", (short)456, inst.getSval());" - "EXPECT_EQUAL_INT8(caseId, \"current value of bval\", (byte)3, inst.getBval());" - "EXPECT_TRUE(caseId, \"changed string\", \"changed\".equals(inst.getSome()[1].getStr()));" - "EXPECT_EQUAL_FLOAT32(caseId, \"current vaue of\", 3.14159f, inst.getDerived().getSome().getFval()[2], 0.001f);" - "EXPECT_EQUAL_UINT8(caseId, \"current value of cval\", 'x', inst.getCval());" - "" - "etUnit_testFinished(caseId);" - } - } - State LoadInArray { - entry { - "FilePersistor.createAndLoad(optarr, getThread(), FIRST_OPT_OBJ, \"Optional1\");" - "FilePersistor.createAndLoad(optarr, getThread(), SECOND_OPT_OBJ, \"Optional2\");" - "opa.sayHello();" - } - } - State ReceivedHello - } - } - } - - abstract ActorClass Optional { - Interface { - Port fct: PStep - } - Structure { } - Behavior { } - } - - ActorClass Optional1 extends Optional { - Structure { - ActorRef ^sub: Sub1 - Binding fct and ^sub.fct - } - Behavior { } - } - - ActorClass Optional2 extends Optional { - Structure { - ActorRef ^sub: Sub2 - Binding fct and ^sub.fct - } - Behavior { } - } - - ActorClass Sub1Base { - Structure { - Attribute cval: char - } - } - - ActorClass Sub1 extends Sub1Base { - Interface { - Port fct: PStep - } - Structure { - external Port fct - conjugated Port dp: PStep - - Attribute ival: int32 - Attribute sval: int16 - Attribute bval: int8 - Attribute some[3]: SomeData - Attribute other: OtherData - Attribute derived: DerivedData - - ActorRef deep: DeepSub1 - Binding dp and deep.fct - } - Behavior { - StateMachine { - Transition init: initial -> Step1 { } - Transition tr0: Step1 -> Step2 { - triggers { - - } - action { - "dp.step();" - } - } - Transition tr1: Step2 -> Step3 { - triggers { - - } - action { - "dp.step();" - } - } - Transition tr2: my tp0 -> my tp0 { - triggers { - - } - action { - "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" - } - } - handler TransitionPoint tp0 - State Step1 { - entry { - "ival = 1;" - "sval = 2;" - "bval = 3;" - "cval = 'x';" - } - } - State Step2 { - entry { - "ival = 123;" - "some[1].str = \"changed\";" - "derived.some.fval[2] = 3.14159f;" - } - } - State Step3 { - subgraph { - Transition init: initial -> StepA { } - Transition tr0: StepA -> StepB { - triggers { - - } - action { - "dp.step();" - } - } - Transition tr1: StepB -> StepC { - triggers { - - } - action { - "dp.step();" - } - } - State StepA { - entry { - "sval = 456;" - } - } - State StepB { - entry { - "bval = 13;" - } - } - State StepC - } - } - } - } - } - - ActorClass DeepSub1 { - Interface { - Port fct: PStep - } - Structure { - external Port fct - } - Behavior { - StateMachine { - Transition init: initial -> Step1 { } - Transition tr0: Step1 -> Step2 { - triggers { - - } - } - Transition tr1: Step2 -> Step3 { - triggers { - - } - } - Transition tr2: Step3 -> Step5 { - triggers { - - } - } - Transition tr3: Step5 -> Step6 { - triggers { - - } - } - Transition tr4: Step6 -> Step7 { - triggers { - - } - } - State Step1 - State Step2 - State Step3 - State Step5 - State Step6 - State Step7 - } - } - } - - ActorClass Sub2 { - Interface { - Port fct: PStep - } - Structure { - external Port fct - } - Behavior { - StateMachine { - Transition init: initial -> Ready { } - Transition tr0: Ready -> Ready { - triggers { - - } - } - Transition tr1: Ready -> Ready { - triggers { - - } - action { - "fct.hello(getClassName()+\", state=\"+stateStrings[getState()]+\", path= \"+getInstancePath());" - } - } - State Ready - } - } - } - - ProtocolClass PStep { - incoming { - Message step() - Message sayHello() - } - outgoing { - Message hello(txt: string) - } - } - - DataClass SomeData { - Attribute fval[3]: float32 = "1.0" - Attribute dval: float64 = "123.4" - Attribute str: string = "\"Text\"" - } - - DataClass OtherData { - Attribute some: SomeData - Attribute bval: boolean = "false" - } - - DataClass DerivedData extends OtherData { - Attribute cval[3]: char = "{'a', 'b', 'c'}" - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room deleted file mode 100644 index c8e56b9a9..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room +++ /dev/null @@ -1,217 +0,0 @@ -RoomModel StoreRestore { - - import room.basic.etunit.* from "Tests.room" - - ActorClass StoreRestore_Top { - @TestInstance - Structure { - ActorRef tester: Tester - ActorRef testee: Testee - Binding tester.prt and testee.prt - } - Behavior { } - } - - ActorClass Testee { - Interface { - Port prt: PC - } - Structure { - usercode1 { "import StoreRestore.ObjectHolder;" } - - external Port prt - - Attribute ival: int16 - Attribute iarr [ 3 ]: int32 - Attribute sdval: SomeData - Attribute sdarr [ 5 ]: SomeData - Attribute cdval: ComplexData - } - Behavior { - Operation doStore() { - "System.out.println(\"doStore()\");" - "IActorClassDataObject dataObject = newDataObject();" - "store(dataObject);" - "ObjectHolder.setObject(dataObject);" - } - Operation doRestore() { - "System.out.println(\"doRestore()\");" - "IActorClassDataObject dataObject = ObjectHolder.getObject();" - "restore(dataObject);" - } - StateMachine { - Transition tr0: my tp0 -> Restore { - triggers { - - } - } - Transition init: initial -> Begin { } - Transition tr1: Begin -> Store { - triggers { - - } - } - Transition tr2: Store -> state2 { - triggers { - - } - } - Transition tr3: state2 -> state3 { - triggers { - - } - } - TransitionPoint tp0 - State Begin { - entry { - "ival = 3;" - } - } - State Store { - entry { - "System.out.println(\"<|MODEL_LOCATION|>\");" - "setFinalAction(new SingleFinalAction() {" - "\tpublic void run() {" - "\t\tdoStore();" - "\t}" - "});" - } - } - State state2 { - entry { - "prt.valueIs(ival);" - "" - "ival = 123;" - } - } - State Restore { - entry { - "System.out.println(\"<|MODEL_LOCATION|>\");" - "setFinalAction(new SingleFinalAction() {" - "\tpublic void run() {" - "\t\tdoRestore();" - "\t}" - "});" - } - } - State state3 { - entry { - "ival = 456;" - "" - "prt.answer();" - } - } - } - } - } - - ActorClass Tester { - Interface { - conjugated Port prt: PC - } - Structure { - external Port prt - - Attribute caseId: int32 - Attribute counter: int32 = "0" - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"StoreRestore\", \"org.eclipse.etrice.generator.common.tests.StoreRestore\", \"StoreRestore_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - - StateMachine { - Transition init: initial -> Prepare { } - Transition tr1: Loop2 -> cp cp0 { - triggers { - - } - } - Transition tr2: cp cp0 -> Done - Transition tr3: cp cp0 -> Loop { - cond { - "++counter<10" - } - } - Transition tr0: Prepare -> Prepare2 { - triggers { - - } - action { - "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, transitionData);" - } - } - Transition tr4: Prepare2 -> Loop { - triggers { - - } - } - Transition tr5: Loop -> Loop2 { - triggers { - - } - action { - "EXPECT_EQUAL_INT16(caseId, \"check old value <|MODEL_LOCATION|>\", (short)3, transitionData);" - } - } - ChoicePoint cp0 - State Prepare { - entry { - "prt.step();" - "prt.step();" - } - } - State Loop { - entry { - "prt.restore();" - "" - "prt.step();" - "prt.step();" - } - } - State Done { - entry { - "etUnit_testFinished(caseId);" - } - } - State Prepare2 { - entry { - "prt.step();" - } - } - State Loop2 { - entry { - "prt.step();" - } - } - } - } - } - - ProtocolClass PC { - incoming { - Message step() - Message restore() - } - outgoing { - Message answer() - Message valueIs(val: int16) - } - } - - DataClass SomeData { - Attribute ival: int16 - Attribute iarr [ 3 ]: int32 - } - - DataClass ComplexData { - Attribute sdval: SomeData - Attribute sdarr [ 5 ]: SomeData - } - - PrimitiveType int16: ptInteger -> 'short' (Short) default '0' - PrimitiveType int32: ptInteger -> 'int' (Integer) default '0' -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room deleted file mode 100644 index b337eb919..000000000 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room +++ /dev/null @@ -1,160 +0,0 @@ -RoomModel TCPTest { - - import room.basic.etunit.* from "Tests.room" - import room.basic.types.* from "Types.room" - import room.basic.service.tcp.* from "TcpService.room" - - ActorClass TCPTestTop { - @TestInstance - Structure { - ActorRef ref0: ATcpServer - ActorRef ref1 [ 5 ]: ATcpClient - ActorRef ref2: Tester - Binding ref2.p1 and ref0.PayloadPort - Binding ref2.p0 and ref0.ControlPort - Binding ref2.p2 and ref1.ControlPort - Binding ref2.p3 and ref1.PayloadPort - } - Behavior { } - } - - ActorClass Tester { - Interface { - conjugated Port p0: PTcpControl - conjugated Port p1: PTcpPayload - conjugated Port p2 [*]: PTcpControl - conjugated Port p3 [5]: PTcpPayload - } - Structure { - external Port p0 - external Port p1 - external Port p2 - external Port p3 - Attribute controlData:DTcpControl - Attribute testData:DTcpPayload - Attribute counter:int32 - Attribute resultPattern:int32 - Attribute pattern:int32 - Attribute caseId: int32 - Attribute resultlist[3]: int16 = "{1,2,3}" - - } - Behavior { - ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"TCPTest\", \"org.eclipse.etrice.generator.common.tests.TCPTest\", \"TCPTest_case\");" - } - dtor { - "etUnit_closeAll(caseId);" - } - StateMachine { - Transition init: initial -> state0 { - action { - "EXPECT_ORDER_START(caseId,resultlist,3);" - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 1);" - "// open Server" - "controlData.setIPAddr(\"127.0.0.1\");" - "controlData.setTcpPort(4711);" - "p0.open(controlData);" - } - } - Transition tr0: state0 -> state1 { - triggers { - - } - action { - "// open 5 clients" - "for (int i=0;i cp cp0 { - triggers { - - } - action { - "counter++;" - } - } - Transition tr4: cp cp0 -> state1 - Transition tr5: cp cp0 -> state2 { - cond { - "counter>=p2.getReplication()" - } - action { - "String s=new String (\"Test!\");" - "testData.setData(s.getBytes());" - "testData.setLength(s.length());" - "testData.setConnectionId(0);" - "for (int i=0; i cp cp2 { - triggers { - - } - action { - "resultPattern+=p3.getIndexOf(ifitem);" - "//System.out.printf(\"c:%d, Idx:%d!\\n\", counter,p3.getIndexOf(ifitem));" - "counter++;" - } - } - Transition tr9: cp cp2 -> state2 - Transition tr10: cp cp2 -> cp cp1 { - cond { - "counter>=p2.getReplication()" - } - action { - "int i;" - "p0.close();" - "// close all clients" - "p2.close();" - "pattern=0;" - "for (i=0;i state2 { - triggers { - - } - action { - "p1.send(transitionData);" - } - } - Transition tr2: cp cp1 -> test_failed - Transition tr6: cp cp1 -> test_ok { - cond { - "pattern==resultPattern" - } - } - ChoicePoint cp0 - ChoicePoint cp2 - ChoicePoint cp1 - State state0 - State state1 - State state2 - State test_ok { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" - "etUnit_testFinished(caseId);" - } - } - State test_failed { - entry { - "EXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "EXPECT_ORDER_END(caseId,\"<|MODEL_LOCATION|>\", 3);" - "etUnit_testFinished(caseId);" - } - } - } - } - } -} \ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle index b6ae64f85..0d42b7a34 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -34,10 +34,7 @@ def etuFileEtUnitTest = 'log/TestEtUnitSpecial.etu' clean.delete 'log' task run(type: Exec, dependsOn: assemble, group: 'verification') { - commandLine exeFile - inputs.file exeFile - outputs.files etuFileRuntimeTest, etuFileEtUnitTest - + executable exeFile doFirst { file('log').mkdirs() } } diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle index 717da9ee7..e05a5bac0 100644 --- a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -34,10 +34,7 @@ def etuFile = 'log/TestCppRuntime.etu' clean.delete 'log' task run(type: Exec, dependsOn: assemble, group: 'verification') { - commandLine exeFile - inputs.file exeFile - outputs.files etuFile - + executable exeFile doFirst { file('log').mkdirs() } } -- cgit v1.2.3