diff options
author | Jan Belle | 2017-09-13 14:46:38 +0000 |
---|---|---|
committer | Jan Belle | 2017-09-13 14:46:38 +0000 |
commit | 845441c200d2780920d2e1769e7a8758e2846c76 (patch) | |
tree | 7dc4b8f77ffe32bba94a4f9290bed34b79d45be4 | |
parent | 9e42fbde145d3de9dabbb4ee88d100ce6d5efcb7 (diff) | |
download | org.eclipse.etrice-845441c200d2780920d2e1769e7a8758e2846c76.tar.gz org.eclipse.etrice-845441c200d2780920d2e1769e7a8758e2846c76.tar.xz org.eclipse.etrice-845441c200d2780920d2e1769e7a8758e2846c76.zip |
[tests] gradle build for runtime and generator tests
74 files changed, 586 insertions, 3200 deletions
diff --git a/build.gradle b/build.gradle index e69de29bb..59f1e8142 100644 --- a/build.gradle +++ b/build.gradle @@ -0,0 +1,10 @@ +ext { + xtext_version = '+' + emf_version = '+' + core_version = '+' + commons_io_version = '+' + + etUnitConverter = "$rootDir/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle" + etriceGenerator = "$rootDir/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle" + etriceTest = "$rootDir/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle" +}
\ No newline at end of file diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 640d2835c..000000000 --- a/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -xtext_version = + -emf_version = + -core_version = + -commons_io_version = +
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle new file mode 100644 index 000000000..59b455535 --- /dev/null +++ b/plugins/org.eclipse.etrice.etunit.converter/etUnitConverter.gradle @@ -0,0 +1,22 @@ + +def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' +evaluationDependsOn(etUnitConverter) + +/** + * Creates a tasks that converts etu files to xml files + * @param name: The name of the new task + * @param etuProducerTask: The task that produces the etu files + */ +ext.createEtUnitConverterTask = { name, etuProducerTask -> + def etuFiles = etuProducerTask.outputs.getFiles().collect { it.path } + def xmlFiles = etuFiles.collect { it.replace('.etu', '.xml') } + + return tasks.create(name: name, type: JavaExec, dependsOn: "$etUnitConverter:classes") { + dependsOn etuProducerTask + main = project(etUnitConverter).mainClassName + classpath = project(etUnitConverter).sourceSets.main.runtimeClasspath + args etuFiles + inputs.files etuProducerTask.outputs + outputs.files xmlFiles + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.c/build.gradle b/plugins/org.eclipse.etrice.generator.c/build.gradle index 77476ec8d..c25ee5832 100644 --- a/plugins/org.eclipse.etrice.generator.c/build.gradle +++ b/plugins/org.eclipse.etrice.generator.c/build.gradle @@ -25,8 +25,6 @@ sourceSets { } } -ext.classpath = sourceSets.main.runtimeClasspath - mainClassName = 'org.eclipse.etrice.generator.c.Main' distTar.enabled = false
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.cpp/build.gradle b/plugins/org.eclipse.etrice.generator.cpp/build.gradle index 01a614f7a..e3c8f948f 100644 --- a/plugins/org.eclipse.etrice.generator.cpp/build.gradle +++ b/plugins/org.eclipse.etrice.generator.cpp/build.gradle @@ -24,8 +24,6 @@ sourceSets { } } -ext.classpath = sourceSets.main.runtimeClasspath - mainClassName = 'org.eclipse.etrice.generator.cpp.Main' distTar.enabled = false
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator.java/build.gradle b/plugins/org.eclipse.etrice.generator.java/build.gradle index ab1d86cba..161180d1d 100644 --- a/plugins/org.eclipse.etrice.generator.java/build.gradle +++ b/plugins/org.eclipse.etrice.generator.java/build.gradle @@ -24,8 +24,6 @@ sourceSets { } } -ext.classpath = sourceSets.main.runtimeClasspath - mainClassName = 'org.eclipse.etrice.generator.java.Main' distTar.enabled = false
\ No newline at end of file diff --git a/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle b/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle new file mode 100644 index 000000000..42556974a --- /dev/null +++ b/plugins/org.eclipse.etrice.generator/etriceGenerator.gradle @@ -0,0 +1,25 @@ + +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.c') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.cpp') +evaluationDependsOn(':plugins:org.eclipse.etrice.generator.java') + +/** + * Creates an eTrice generator task + * @param name: The name of the new task + * @param models: The models passed to the generator + * @param genDir: The generation directory + * @param options: The eTrice generator options + */ +ext.createGeneratorTask = { name, lang, models, genDir = 'src-gen', options = [] -> + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + + return tasks.create(name: name, type: JavaExec, dependsOn: "$generator:classes") { + main = project(generator).mainClassName + classpath = project(generator).sourceSets.main.runtimeClasspath + args '-msc_instr', '-genDir', genDir + args options + args models + inputs.files models + outputs.dir genDir + } +}
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.c/build.gradle b/runtime/org.eclipse.etrice.modellib.c/build.gradle index 23ad8e2b0..b881a7b8b 100644 --- a/runtime/org.eclipse.etrice.modellib.c/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.c/build.gradle @@ -2,18 +2,15 @@ plugins { id 'c' } -def generator = ':plugins:org.eclipse.etrice.generator.c' +apply from: etriceGenerator -task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).classpath - inputs.dir 'model' - outputs.dir 'src-gen' - args '-lib', '-msc_instr', '-genDir', 'src-gen', - 'model/PInterrupt.room', - 'model/TcpService.room', - 'model/TimingService.room' -} +def models = [ + 'model/PInterrupt.room', + 'model/TcpService.room', + 'model/TimingService.room' +] + +createGeneratorTask('generate', 'c', models, 'src-gen', '-lib') model { components { diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle index 3299defba..efbb01f03 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.cpp/build.gradle @@ -2,16 +2,13 @@ plugins { id 'cpp' } -def generator = ':plugins:org.eclipse.etrice.generator.cpp' +apply from: etriceGenerator -task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).classpath - inputs.dir 'model' - outputs.dir 'src-gen' - args '-lib', '-msc_instr', '-genDir', 'src-gen', - 'model/TimingService.room' -} +def models = [ + 'model/TimingService.room' +] + +createGeneratorTask('generate', 'cpp', models, 'src-gen', '-lib') model { components { @@ -25,8 +22,8 @@ model { exportedHeaders { srcDirs = ['src-gen'] } - lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'api' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'api' } binaries { withType(SharedLibraryBinarySpec) { buildable = false } diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys b/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys index caec2ba71..27f442b9c 100644 --- a/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys +++ b/runtime/org.eclipse.etrice.modellib.cpp/model/GenericPhysical.etphys @@ -14,7 +14,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 0 stacksize = 1024 - msgblocksize = 128 + msgblocksize = 64 msgpoolsize = 100 } @@ -22,7 +22,7 @@ PhysicalModel room.generic.physical { execmode = blocked prio = 0 stacksize = 1024 - msgblocksize = 128 + msgblocksize = 64 msgpoolsize = 100 } @@ -31,7 +31,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 0 stacksize = 1024 - msgblocksize = 128 + msgblocksize = 64 msgpoolsize = 100 } } diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle index f27641e6f..a458f33bb 100644 --- a/runtime/org.eclipse.etrice.modellib.java/build.gradle +++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle @@ -2,18 +2,13 @@ plugins { id 'java' } -def generator = ':plugins:org.eclipse.etrice.generator.java' +apply from: etriceGenerator -task generate(type: JavaExec, group: 'build', dependsOn: "$generator:classes") { - main = project(generator).mainClassName - classpath = project(generator).classpath - inputs.dir 'model' - outputs.dir 'src-gen' - args '-lib', '-msc_instr', '-genDir', 'src-gen', - 'model/ALogService.room', - 'model/TcpService.room', - 'model/TimingService.room' -} +def models = [ + 'model/ALogService.room', + 'model/TcpService.room', + 'model/TimingService.room' +] dependencies { compile project(':runtime:org.eclipse.etrice.runtime.java') @@ -27,6 +22,8 @@ sourceSets { } } +createGeneratorTask('generate', 'java', models, 'src-gen', '-lib') + compileJava.dependsOn generate clean.delete 'src-gen'
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt deleted file mode 100644 index 1dc2b35ab..000000000 --- a/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory is an eTrice code generation target. -It will be erased every time the generator is executed. - -DO NOT PLACE OTHER FILES HERE! diff --git a/runtime/org.eclipse.etrice.runtime.c/build.gradle b/runtime/org.eclipse.etrice.runtime.c/build.gradle index ce88e15c8..56cad9f53 100644 --- a/runtime/org.eclipse.etrice.runtime.c/build.gradle +++ b/runtime/org.eclipse.etrice.runtime.c/build.gradle @@ -1,17 +1,24 @@ +import static org.apache.tools.ant.taskdefs.condition.Os.* + plugins { id 'c' } +def platform = '' + +if(isFamily(FAMILY_WINDOWS)) { platform = 'MT_WIN_MinGW' } +else if(isFamily(FAMILY_UNIX)) { platform = 'MT_POSIX_GENERIC_GCC' } + model { components { etrice_runtime_c(NativeLibrarySpec) { sources.c { source { - srcDirs = ['src/common', 'src/config', 'src/platforms/MT_WIN_MinGW', 'src/util'] + srcDirs = ['src/common', 'src/config', "src/platforms/$platform", 'src/util'] include '**/*.c' } exportedHeaders { - srcDirs = ['src/common', 'src/config', 'src/platforms/MT_WIN_MinGW', 'src/util'] + srcDirs = ['src/common', 'src/config', "src/platforms/$platform", 'src/util'] } } binaries { diff --git a/settings.gradle b/settings.gradle index 58f8783fc..ea0b4852a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,4 +24,11 @@ include 'plugins:org.eclipse.etrice.core.common', 'runtime:org.eclipse.etrice.runtime.cpp', 'runtime:org.eclipse.etrice.runtime.java', - 'tests:org.eclipse.etrice.generator.common.tests'
\ No newline at end of file + 'tests:org.eclipse.etrice.runtime.c.tests', + 'tests:org.eclipse.etrice.runtime.cpp.tests', + 'tests:org.eclipse.etrice.runtime.java.tests', + + 'tests:org.eclipse.etrice.generator.common.tests', + 'tests:org.eclipse.etrice.generator.c.tests', + 'tests:org.eclipse.etrice.generator.cpp.tests', + 'tests:org.eclipse.etrice.generator.java.tests'
\ 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 new file mode 100644 index 000000000..9f0487aa3 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.c.tests/build.gradle @@ -0,0 +1,10 @@ +plugins { + id 'c' +} + +apply from: etriceTest + +def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' + +createTest('c', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) +createTest('c', 'staticConfigTest', ['models/StaticConfigTest.etmap', 'models/StaticConfigTest.room', 'models/StaticConfigTest.config'])
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.c.tests/targetModels/empty.txt b/tests/org.eclipse.etrice.generator.c.tests/targetModels/empty.txt deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.etrice.generator.c.tests/targetModels/empty.txt +++ /dev/null diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle index 7da84045e..40882f479 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle @@ -4,7 +4,7 @@ plugins { id 'java-base' } -apply from: "test.gradle" +apply from: etriceTest def genericPhysical = 'models/GenericPhysical.etphys' @@ -13,7 +13,7 @@ def tests = [ choicePointTest: ['models/ChoicePointTest.room', genericPhysical], choicePointTestExtended: ['models/ChoicePointTestExtended.room', genericPhysical], dataDrivenTest: ['models/DataDrivenTest.room', genericPhysical], - //enumTest: ['models/EnumTest.room', genericPhysical], + /* enumTest: ['models/EnumTest.room', genericPhysical], not supported in c++ */ compileTests: ['models/CompileTests.room', genericPhysical, 'models/DetailExpressionTest.room', 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room'], handlerTest: ['models/HandlerTest.room', genericPhysical], operationInheritanceTest: ['models/OperationInheritanceTest.room', genericPhysical], @@ -21,14 +21,12 @@ def tests = [ pingPongThreadReplPortTest: ['models/PingPongThreadReplPortTest.etmap', 'models/PingPongThreadReplPortTest.room'] ] -tests.each { key, value -> - def testTasks = [ - addTest('c', key, value), - addTest('cpp', key, value), - addTest('java', key, value) - ] - - tasks.create(name: key, dependsOn: testTasks, group: 'verification') +tests.each { name, models -> + createTest('c', name, models) + createTest('cpp', name, models) + createTest('java', name, models) } -clean.delete 'src-gen', fileTree('log') { exclude '**/readme.txt' }
\ No newline at end of file +// Enum Test +createTest('c', 'enumTest', ['models/EnumTest.room', genericPhysical]) +createTest('java', 'enumTest', ['models/EnumTest.room', genericPhysical])
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle b/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle new file mode 100644 index 000000000..3bb72747f --- /dev/null +++ b/tests/org.eclipse.etrice.generator.common.tests/etriceTest.gradle @@ -0,0 +1,110 @@ +apply from: etriceGenerator +apply from: etUnitConverter + +def outputDir = 'output' +def srcGenDir = 'src-gen' + +clean.delete srcGenDir, outputDir + +def getMainClass(String genDir) { + // search for SubSystemRunner java file + def mainFile = fileTree(genDir, { include '**/*Runner.java' }).getSingleFile() + // relativize path to generation directory + def relPath = file(genDir).toPath().relativize(mainFile.toPath()).normalize().toString() + // remove '.java' at the end + def path = relPath.substring(0, relPath.length() - 5) + // replace all separators with '.' + def mainClass = path.replace(File.separatorChar, '.' as char) + return mainClass +} + +/** + * Creates all needed tasks for one test execution + * @param lang: The eTrice generator type ('c', 'cpp', 'java') + * @param name: The test name starting with a lower case letter + * @param models: Models that are passed to the eTrice generator + * @param options: Options that are passed to the eTrice generator + */ +ext.createTest = { lang, name, models, options = [] -> + + def nameCap = name.capitalize() + def langCap = lang.capitalize() + def testName = "$name$langCap" + def testNameCap = testName.capitalize() + def genDir = "$srcGenDir/$testName" + def workingDir = "$outputDir/$testName" + def etuFile = "$workingDir/${nameCap}.etu" + def xmlFile = "$workingDir/${nameCap}.xml" + def modellib = ":runtime:org.eclipse.etrice.modellib.$lang" + def generator = ":plugins:org.eclipse.etrice.generator.$lang" + def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' + + def generateTask = createGeneratorTask("generate$testNameCap", lang, models, genDir, options) + generateTask.environment 'etModellib', "org.eclipse.etrice.modellib.$lang" + + def runTask + + if(lang == 'c' || lang == 'cpp') { + model { + components { + "$testName"(NativeExecutableSpec) { + sources."$lang" { + builtBy generateTask + source { + srcDirs = [genDir] + include "**/*.$lang" + } + exportedHeaders { + srcDirs = [genDir] + } + lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' + if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + binaries.all { + cCompiler.args '-g3' + cppCompiler.args '-g3' + } + } + } + } + + def exeFile = "$buildDir/exe/$testName/$testName" + runTask = tasks.create(name: "run$testNameCap", type: Exec) { + dependsOn "${testName}Executable" + commandLine exeFile, '-run_as_test' + inputs.file exeFile + outputs.file etuFile + it.workingDir = workingDir + } + } + + else if(lang == 'java') { + def testSourceSet = sourceSets.create(name) { + java.srcDirs = [genDir] + } + + dependencies { + add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') + add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') + } + + tasks.getByName("compile${nameCap}Java").dependsOn generateTask + + runTask = tasks.create(name: "run$testNameCap", type: JavaExec) { + dependsOn "${name}Classes" + classpath = testSourceSet.runtimeClasspath + args '-run_as_test' + outputs.file etuFile + it.workingDir = workingDir + + doFirst { main = getMainClass(genDir) } + } + } + + runTask.doFirst { file("$workingDir/log").mkdirs() } + + def convertTask = createEtUnitConverterTask("convert$testNameCap", runTask) + + check.dependsOn tasks.create(name: testName, dependsOn: convertTask, group: 'verification') +} diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/log/c/log/testlog/readme.txt +++ /dev/null diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/log/cpp/log/testlog/readme.txt +++ /dev/null diff --git a/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt b/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/log/java/log/testlog/readme.txt +++ /dev/null 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 263c1b7e2..924e0722f 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ActorCommunicationTest.room @@ -63,7 +63,7 @@ RoomModel ActorCommunicationTest { } Behavior { ctor { - "etUnit_open(\"log/testlog\", \"ActorCommunicationTest\");" + "etUnit_open(\".\", \"ActorCommunicationTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests\");" } dtor { 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 9c0ac4794..c72dbc8de 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTest.room @@ -3,12 +3,8 @@ RoomModel ChoicePointTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_ChoicePointTest { - @TestInstance - ActorRef cptest_top : CPTest_Top - } - ActorClass CPTest_Top { + @TestInstance Structure { ActorRef cp_tester: CPTester ActorRef cp_user: CPUser @@ -30,7 +26,7 @@ RoomModel ChoicePointTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" + "caseId = etUnit_openAll(\".\", \"ChoicePointTest\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTest\", \"ChoicePointTest_case\");" } dtor { "etUnit_closeAll(caseId);" 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 d24f6030d..a87545e89 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/ChoicePointTestExtended.room @@ -350,7 +350,7 @@ RoomModel ChoicePointTestExtended { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" + "caseId = etUnit_openAll(\".\", \"ChoicePointTestExtended\", \"org.eclipse.etrice.generator.common.tests.ChoicePointTestExtended\", \"ChoicePointTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room index 83befe64b..16008a342 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room @@ -7,12 +7,8 @@ RoomModel CompileTests { import StatemachineInterfaceTestInheritedModel.StatemachineInterfaceInheritedTest from "StatemachineInterfaceInheritedTest.room" import ContinuationTransitionTest.ContinuationTransitionTest from "ContinuationTransitionTest.room" - SubSystemClass SubSystem_CompileTests { - @TestInstance - ActorRef compileTests : CompileTests - } - ActorClass CompileTests { + @TestInstance Structure { Attribute caseId : int32 @@ -24,7 +20,7 @@ RoomModel CompileTests { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" + "caseId = etUnit_openAll(\".\", \"CompileTests\", \"org.eclipse.etrice.generator.common.tests.CompileTests\", \"CompileTests_case\");" } dtor { "etUnit_closeAll(caseId);" 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 4d3698ac2..87a002749 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/DataDrivenTest.room @@ -68,7 +68,7 @@ RoomModel DataDrivenTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" + "caseId = etUnit_openAll(\".\", \"DataDrivenTest\", \"org.eclipse.etrice.generator.common.tests.DataDrivenTest\", \"DataDrivenTest_case\");" } dtor { "etUnit_closeAll(caseId);" 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 80eaf7d66..b533ebf22 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/EnumTest.room @@ -3,12 +3,8 @@ RoomModel EnumTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_EnumTest { - @TestInstance - ActorRef enumTest_top : EnumTest_Top - } - ActorClass EnumTest_Top { + @TestInstance Structure { ActorRef user: EnumUser } @@ -36,7 +32,7 @@ RoomModel EnumTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");" + "caseId = etUnit_openAll(\".\", \"EnumTest\", \"org.eclipse.etrice.generator.common.tests.EnumTest\", \"EnumTest_case\");" } dtor { "etUnit_closeAll(caseId);" 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 9e9a2cc3f..da38a218e 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys +++ b/tests/org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys @@ -14,7 +14,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 5 stacksize = 1024 - msgblocksize = 64 + msgblocksize = 128 msgpoolsize = 100 } @@ -22,7 +22,7 @@ PhysicalModel room.generic.physical { execmode = blocked prio = 5 stacksize = 1024 - msgblocksize = 64 + msgblocksize = 128 msgpoolsize = 100 } @@ -31,7 +31,7 @@ PhysicalModel room.generic.physical { interval = 100ms prio = 5 stacksize = 1024 - msgblocksize = 64 + msgblocksize = 128 msgpoolsize = 100 } } 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 8276547dd..db3dff2cd 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/HandlerTest.room @@ -3,12 +3,8 @@ RoomModel HandlerTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_HandlerTest { - @TestInstance - ActorRef handlerTest_top : HandlerTest_Top - } - ActorClass HandlerTest_Top { + @TestInstance Structure { ActorRef tester: Tester ActorRef handlerUser: HandlerUser @@ -30,7 +26,7 @@ RoomModel HandlerTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" + "caseId = etUnit_openAll(\".\", \"HandlerTest\", \"org.eclipse.etrice.generator.common.tests.HandlerTest\", \"HandlerTest_case\");" } dtor { "etUnit_closeAll(caseId);" 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 face41b4c..f9fd340e8 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/OperationInheritanceTest.room @@ -3,18 +3,14 @@ RoomModel OperationInheritanceTest { import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room" - SubSystemClass SubSystem_OperationInheritanceTest { - @TestInstance - ActorRef top_test : OperationInheritanceTest - } - async ActorClass OperationInheritanceTest extends BaseActor { + @TestInstance Structure { Attribute testDataClass: SubDataClass } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" + "caseId = etUnit_openAll(\".\", \"OperationInheritanceTest\", \"org.eclipse.etrice.generator.common.tests.OperationInheritanceTest\", \"OperationInheritanceTest_case\");" "ctorRefine = 2;" } dtor { diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys index aaf01df01..1215b84c6 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThread.etphys @@ -1,7 +1,7 @@ PhysicalModel PingPongThread { PhysicalSystem Sys { - NodeRef node: PC + NodeRef node1: PC } NodeClass PC { 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 0ea6ddfab..9b8d078af 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.etmap @@ -4,7 +4,7 @@ MappingModel PingPongThreadReplPortTest { import PingPongThread.* from "PingPongThread.etphys" Mapping System_PingPongReplPort -> Sys { - SubSystemMapping ref_SubSystem_PingPongThreadReplPortTest -> node { + SubSystemMapping main -> node1 { ThreadMapping mrPingThread -> DfltThread ThreadMapping mrPong1Thread -> Thread1 ThreadMapping mrPong2Thread -> Thread2 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 4fe552769..ef057dd2c 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadReplPortTest.room @@ -1,10 +1,10 @@ RoomModel PingPongThreadReplPortTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" LogicalSystem System_PingPongReplPort{ - SubSystemRef ref_SubSystem_PingPongThreadReplPortTest : SubSystem_PingPongReplPort + SubSystemRef main : SubSystem_PingPongReplPort } SubSystemClass SubSystem_PingPongReplPort { @@ -54,7 +54,7 @@ RoomModel PingPongThreadReplPortTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" + "caseId = etUnit_openAll(\".\", \"PingPongThreadReplPortTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTestReplPort\", \"PingPongThreadTestReplPort_case\");" } dtor { "etUnit_closeAll(caseId);" 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 caaf06032..4aa1aaaeb 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.etmap @@ -5,7 +5,7 @@ MappingModel PingPongThreadTest { import PingPongThread.* from "PingPongThread.etphys" Mapping System_PingPong -> Sys { - SubSystemMapping ref_SubSystem_PingPongThreadTest -> node { + SubSystemMapping main -> node1 { ThreadMapping mrPingThread -> DfltThread ThreadMapping mrPong1Thread -> Thread1 ThreadMapping mrPong2Thread -> Thread2 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 cf3f23e65..e18c868d4 100644 --- a/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room +++ b/tests/org.eclipse.etrice.generator.common.tests/models/PingPongThreadTest.room @@ -1,10 +1,10 @@ RoomModel PingPongThreadTest { - import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room" + import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room" LogicalSystem System_PingPong{ - SubSystemRef ref_SubSystem_PingPongThreadTest : SubSystem_PingPong + SubSystemRef main : SubSystem_PingPong } SubSystemClass SubSystem_PingPong { @@ -56,7 +56,7 @@ RoomModel PingPongThreadTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" + "caseId = etUnit_openAll(\".\", \"PingPongThreadTest\", \"org.eclipse.etrice.generator.common.tests.PingPongThreadTest\", \"PingPongThreadTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room deleted file mode 100644 index 9c4691ee5..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestC.room +++ /dev/null @@ -1,605 +0,0 @@ -RoomModel SendingDataTestC { - - 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" - - 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 { - <pingInt16: PingPongPort> - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr1: reply -> reply { - triggers { - <pingInt8: PingPongPort> - } - action { - "PingPongPort.pongInt8(d);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - <pingInt32: PingPongPort> - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr3: reply -> reply { - triggers { - <pingFloat32: PingPongPort> - } - action { - "PingPongPort.pongFloat32(d);" - } - } - Transition tr4: reply -> reply { - triggers { - <pingFloat64: PingPongPort> - } - action { - "PingPongPort.pongFloat64(d);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - <pingInt32Ref: PingPongPort guard { - "(*d)!=0" - }> - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*d)+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "(*d)!=5" - } - action { - "PingPongPort.pongInt32(*d);" - } - } - Transition tr9: reply -> reply { - triggers { - <pingComplex: PingPongPort> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr11: reply -> reply { - triggers { - <pingComplexRef: PingPongPort> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr5: reply -> reply { - triggers { - <pingInt64: PingPongPort> - } - action { - "PingPongPort.pongInt64(d);" - } - } - Transition tr10: reply -> reply { - triggers { - <pingInt16Ref: PingPongPort> - } - action { - "PingPongPort.pongInt16(*d);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - <pingComplexRef: PingPongPort guard { - "d->i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "d->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr15: reply -> reply { - triggers { - <pingComplexDerived: PingPongPort> - } - action { - "PingPongPort.pongComplexDerived(d);" - } - } - Transition tr16: my tp0 -> my tp0 { - triggers { - <in1: extTest> - } - } - 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\", \"SendingDataTestC\", \"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 { - <pongInt8: PingPongPort> - } - action { - "counter++;" - "if (d==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt16: PingPongPort> - } - action { - "counter++;" - "if (d==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt32: PingPongPort> - } - action { - "counter++;" - "if (d==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - <pongInt32: PingPongPort guard { - "counter==7" - }> - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt64: PingPongPort> - } - action { - "counter++;" - "if (d==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - <pongFloat32: PingPongPort> - } - action { - "counter++;" - "if ((d>3)&&(d<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - <pongFloat64: PingPongPort> - } - action { - "counter++;" - "if ((d>7)&&(d<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt8: PingPongPort> - } - action { - "counter++;" - "if (d==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt16: PingPongPort> - } - action { - "counter++;" - "if (d==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt32: PingPongPort> - } - action { - "counter++;" - "if (d==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt64: PingPongPort> - } - action { - "counter++;" - "if (d==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - <pongFloat32: PingPongPort> - } - action { - "counter++;" - "if ((d>13)&&(d<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - <pongFloat64: PingPongPort> - } - action { - "counter++;" - "if ((d>28)&&(d<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - <pongInt32: PingPongPort guard { - "counter==7" - }> - } - action { - "if (d==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt16: PingPongPort guard { - "counter==6" - }> - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt16: PingPongPort guard { - "counter==6" - }> - } - action { - "counter++;" - "if (d==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 { - <pongComplex: PingPongPort guard { - "counter==1" - }> - } - action { - "counter=0;" - "if (d->i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d->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 { - <pongComplex: PingPongPort> - } - action { - "counter++;" - "if (d->i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - <pongComplexDerived: PingPongPort> - } - action { - "if (d->i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d->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/SendingDataTestCpp.room b/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room deleted file mode 100644 index 6094b11d8..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestCpp.room +++ /dev/null @@ -1,605 +0,0 @@ -RoomModel SendingDataTestCpp { - - 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" - - 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 { - <pingInt16: PingPongPort> - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr1: reply -> reply { - triggers { - <pingInt8: PingPongPort> - } - action { - "PingPongPort.pongInt8(d);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - <pingInt32: PingPongPort> - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr3: reply -> reply { - triggers { - <pingFloat32: PingPongPort> - } - action { - "PingPongPort.pongFloat32(d);" - } - } - Transition tr4: reply -> reply { - triggers { - <pingFloat64: PingPongPort> - } - action { - "PingPongPort.pongFloat64(d);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - <pingInt32Ref: PingPongPort guard { - "(*d)!=0" - }> - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32((*d)+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "(*d)!=5" - } - action { - "PingPongPort.pongInt32(*d);" - } - } - Transition tr9: reply -> reply { - triggers { - <pingComplex: PingPongPort> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr11: reply -> reply { - triggers { - <pingComplexRef: PingPongPort> - } - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr5: reply -> reply { - triggers { - <pingInt64: PingPongPort> - } - action { - "PingPongPort.pongInt64(d);" - } - } - Transition tr10: reply -> reply { - triggers { - <pingInt16Ref: PingPongPort> - } - action { - "PingPongPort.pongInt16(*d);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - <pingComplexRef: PingPongPort guard { - "d->i8ValPPD == 5" - }> - } - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "d->i8ValPPD==7" - } - action { - "PingPongPort.pongComplex(*d);" - } - } - Transition tr15: reply -> reply { - triggers { - <pingComplexDerived: PingPongPort> - } - action { - "PingPongPort.pongComplexDerived(d);" - } - } - Transition tr16: my tp0 -> my tp0 { - triggers { - <in1: extTest> - } - } - 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 { - <pongInt8: PingPongPort> - } - action { - "counter++;" - "if (d==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt16: PingPongPort> - } - action { - "counter++;" - "if (d==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt32: PingPongPort> - } - action { - "counter++;" - "if (d==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - <pongInt32: PingPongPort guard { - "counter==7" - }> - } - action { - "counter=0;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt64: PingPongPort> - } - action { - "counter++;" - "if (d==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - <pongFloat32: PingPongPort> - } - action { - "counter++;" - "if ((d>3)&&(d<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - <pongFloat64: PingPongPort> - } - action { - "counter++;" - "if ((d>7)&&(d<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt8: PingPongPort> - } - action { - "counter++;" - "if (d==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt16: PingPongPort> - } - action { - "counter++;" - "if (d==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt32: PingPongPort> - } - action { - "counter++;" - "if (d==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt64: PingPongPort> - } - action { - "counter++;" - "if (d==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - <pongFloat32: PingPongPort> - } - action { - "counter++;" - "if ((d>13)&&(d<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - <pongFloat64: PingPongPort> - } - action { - "counter++;" - "if ((d>28)&&(d<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - <pongInt32: PingPongPort guard { - "counter==7" - }> - } - action { - "if (d==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt16: PingPongPort guard { - "counter==6" - }> - } - action { - "counter++;" - "if (lang == 1){" - "/* Java cannot send references of primitive types */" - "\tif (d==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "/* C */" - "\tif (d==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt16: PingPongPort guard { - "counter==6" - }> - } - action { - "counter++;" - "if (d==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 { - <pongComplex: PingPongPort guard { - "counter==1" - }> - } - action { - "counter=0;" - "if (d.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.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 { - <pongComplex: PingPongPort> - } - action { - "counter++;" - "if (d.i8ValPPD==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - <pongComplexDerived: PingPongPort> - } - action { - "if (d.i8ValPPD==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.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 007b3242c..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/sendingData/SendingDataTestJava.room +++ /dev/null @@ -1,586 +0,0 @@ -RoomModel SendingDataTestJava { - - 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" - - 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 { - <pingInt16: PingPongPort> - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr1: reply -> reply { - triggers { - <pingInt8: PingPongPort> - } - action { - "PingPongPort.pongInt8(d);" - } - } - Transition init: initial -> reply { } - Transition tr2: reply -> reply { - triggers { - <pingInt32: PingPongPort> - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr3: reply -> reply { - triggers { - <pingFloat32: PingPongPort> - } - action { - "PingPongPort.pongFloat32(d);" - } - } - Transition tr4: reply -> reply { - triggers { - <pingFloat64: PingPongPort> - } - action { - "PingPongPort.pongFloat64(d);" - } - } - Transition tr7: reply -> cp cp0 { - triggers { - <pingInt32Ref: PingPongPort guard { - "d!=0" - }> - } - } - Transition tr8: cp cp0 -> reply { - action { - "PingPongPort.pongInt32(d+10);" - } - } - Transition tr6: cp cp0 -> reply { - cond { - "d!=5" - } - action { - "PingPongPort.pongInt32(d);" - } - } - Transition tr9: reply -> reply { - triggers { - <pingComplex: PingPongPort> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr11: reply -> reply { - triggers { - <pingComplexRef: PingPongPort> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr5: reply -> reply { - triggers { - <pingInt64: PingPongPort> - } - action { - "PingPongPort.pongInt64(d);" - } - } - Transition tr10: reply -> reply { - triggers { - <pingInt16Ref: PingPongPort> - } - action { - "PingPongPort.pongInt16(d);" - } - } - Transition tr12: reply -> cp cp1 { - triggers { - <pingComplexRef: PingPongPort guard { - "d.i8Val == 5" - }> - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr13: cp cp1 -> reply { - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr14: cp cp1 -> reply { - cond { - "d.i8Val==7" - } - action { - "PingPongPort.pongComplex(d);" - } - } - Transition tr15: reply -> reply { - triggers { - <pingComplexDerived: PingPongPort> - } - action { - "PingPongPort.pongComplexDerived(d);" - } - } - 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 { - <pongInt8: PingPongPort> - } - action { - "counter++;" - "if (d==5){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 2);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr2: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt16: PingPongPort> - } - action { - "counter++;" - "if (d==19){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 3);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt32: PingPongPort> - } - action { - "counter++;" - "if (d==4711){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 4);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr4: receiveFirst7 -> receiveSecond7 { - triggers { - <pongInt32: PingPongPort guard { - "counter==7" - }> - } - action { - "counter=0;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (d==4711){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (d==4712){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 9);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr6: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt64: PingPongPort> - } - action { - "counter++;" - "if (d==11470815){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 5);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr5: receiveFirst7 -> receiveFirst7 { - triggers { - <pongFloat32: PingPongPort> - } - action { - "counter++;" - "if ((d>3)&&(d<4)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 6);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr7: receiveFirst7 -> receiveFirst7 { - triggers { - <pongFloat64: PingPongPort> - } - action { - "counter++;" - "if ((d>7)&&(d<8)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 7);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr8: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt8: PingPongPort> - } - action { - "counter++;" - "if (d==6){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 10);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr9: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt16: PingPongPort> - } - action { - "counter++;" - "if (d==20){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 11);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr10: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt32: PingPongPort> - } - action { - "counter++;" - "if (d==4712){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 12);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr11: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt64: PingPongPort> - } - action { - "counter++;" - "if (d==11470816){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 13);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr12: receiveSecond7 -> receiveSecond7 { - triggers { - <pongFloat32: PingPongPort> - } - action { - "counter++;" - "if ((d>13)&&(d<14)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 14);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr13: receiveSecond7 -> receiveSecond7 { - triggers { - <pongFloat64: PingPongPort> - } - action { - "counter++;" - "if ((d>28)&&(d<29)){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 15);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr14: receiveSecond7 -> my tp1 { - triggers { - <pongInt32: PingPongPort guard { - "counter==7" - }> - } - action { - "if (d==4712){\t" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 17);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr15: receiveFirst7 -> receiveFirst7 { - triggers { - <pongInt16: PingPongPort guard { - "counter==6" - }> - } - action { - "counter++;" - "if (lang == 1){" - "// Java cannot send references of primitive types" - "\tif (d==19){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "} " - "if (lang == 2){" - "// C" - "\tif (d==20){\t" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 8);" - "\t}else{" - "\t\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "\t}" - "}" - } - } - Transition tr16: receiveSecond7 -> receiveSecond7 { - triggers { - <pongInt16: PingPongPort guard { - "counter==6" - }> - } - action { - "counter++;" - "if (d==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 { - <pongComplex: PingPongPort guard { - "counter==1" - }> - } - action { - "counter=0;" - "if (d.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 19);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.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 { - <pongComplex: PingPongPort> - } - action { - "counter++;" - "if (d.i8Val==10){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 18);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - } - } - Transition tr3: state1 -> my tp1 { - triggers { - <pongComplexDerived: PingPongPort> - } - action { - "if (d.i8Val==11){" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 21);" - "}else{" - "\tEXPECT_ORDER(caseId,\"<|MODEL_LOCATION|>\", 0xFF);" - "}" - "" - "if (d.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.common.tests/models/staticConfig/StaticConfigTest.config b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.config deleted file mode 100644 index 426adc5e6..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.config +++ /dev/null @@ -1,141 +0,0 @@ -ConfigModel StaticTestConfig { - - import StaticConfigTest.* from "StaticConfigTest.room" - - ActorClassConfig Tester_ac { - // nothing - } - - ActorClassConfig Testee_1_ac { - Attr data_1 { - Attr bool_c = false - Attr bool_i = false - Attr int8_c = 24 - Attr int8_i = 24 - Attr int16_c = 48 - Attr int16_i = 48 - Attr int32_c = 96 - Attr int32_i = 96 - Attr int64_c = 192 - Attr int64_i = 192 - Attr float32_c = 9.6 - Attr float32_i = 9.6 - Attr float64_c = 19.2 - Attr float64_i = 19.2 - Attr char_c = "C" - Attr char_i = "C" - Attr string_c = ":)" - Attr string_i = ":)" - - Attr bool_array_c = true, false - Attr bool_array_i = true, false - Attr int8_array_c = 24, 48 - Attr int8_array_i = 24, 48 - Attr int16_array_c = 48, 96 - Attr int16_array_i = 48, 96 - Attr int32_array_c = 96, 192 - Attr int32_array_i = 96, 192 - Attr int64_array_c = 192, 384 - Attr int64_array_i = 192, 384 - Attr float32_array_c = 9.6 - Attr float32_array_i = 9.6 - Attr float64_array_c = 19.2 - Attr float64_array_i = 19.2 - Attr char_array_c = "Claz" - Attr char_array_i = "Claz" - - Attr data_2 { - Attr int32_c = 42 - Attr int32_i = 42 - } - } - Attr enumval1 = Enum_1.two - Attr enumval2 = Enum_2.three - } - - ActorClassConfig Testee_Super2_ac { - Attr float64_super_c = 2.2 - Attr float64_super_i = 2.2 - } - - ActorClassConfig Testee_2_ac { - Attr int32_own_c = 12 - Attr int32_own_i = 12 - } - - ProtocolClassConfig TestProtocolAttributes { - regular Port{ - Attr float_c = 3.0 - Attr float_i = 3.0 - } - conjugate Port { - Attr array2_c = 16, 32 - Attr array2_i = 16, 32 - } - } - - ProtocolClassConfig TestProtocolWithDataClass { - conjugate Port { - Attr sap_data_2{ - Attr int32_c = 2 - Attr int32_i = 2 - } - } - } - - ActorInstanceConfig System_StaticConfigTest/main/top/tester { - // nothing - } - - ActorInstanceConfig System_StaticConfigTest/main/top/testee_1 { - Attr data_1 { - Attr bool_i = true - Attr int8_i = 2 - Attr int16_i = 4 - Attr int32_i = 8 - Attr int64_i = 16 - Attr float32_i = 1.6 - Attr float64_i = 3.2 - Attr char_i = "I" - Attr string_i = ":]" - - Attr bool_array_i = true, true - Attr int8_array_i = 2, 6 - Attr int16_array_i = 4, 12 - Attr int32_array_i = 8, 24 - Attr int64_array_i = 16, 48 - Attr float32_array_i = 1.6 - Attr float64_array_i = 3.2 - Attr char_array_i = "Inst" - - Attr data_2 { - Attr int32_i = 43 - } - } - InterfaceItem conj_port { - Attr array2_i = 1, 2 - } - } - - - ActorInstanceConfig System_StaticConfigTest/main/top/tester/testee_super2{ - Attr float64_super_i = 3.3 - InterfaceItem reg_port { - Attr float_i = 25.0 - } - } - - ActorInstanceConfig System_StaticConfigTest/main/top/testee_1/testee_2 { - Attr float64_super_i = 4.4 - Attr int32_own_i = 13 - InterfaceItem reg_port { - Attr float_i = 50.0 - } - InterfaceItem sap { - Attr sap_data_2 { - Attr int32_i = 3 - } - } - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap deleted file mode 100644 index e437b5710..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest.etmap +++ /dev/null @@ -1,10 +0,0 @@ -MappingModel StaticConfigTest { - - import StaticConfigTest.* from "StaticConfigTest.room" - import room.generic.physical.* from "../GenericPhysical.etphys" - - Mapping System_StaticConfigTest -> GenericPhysicalSystem { - SubSystemMapping main -> node {} - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room deleted file mode 100644 index 5a1f04db5..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_C.room +++ /dev/null @@ -1,421 +0,0 @@ -RoomModel StaticConfigTest { - - import room.basic.types.* from "../Types.room" - import room.basic.service.timing.* from "../TimingService.room" - - LogicalSystem System_StaticConfigTest { - SubSystemRef main : SubSystem_StaticConfigTest - } - - SubSystemClass SubSystem_StaticConfigTest { - LayerConnection ref top satisfied_by timer.timer - ActorRef top: Top_ac - ActorRef timer : ATimingService - } - - 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 - } - Behavior { - ctor { - "etUnit_open(\"log/testlog\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } - StateMachine { - Transition init: initial -> state0 { - action { - "timer.startTimeout(1000);" - } - } - Transition tr0: state0 -> state0 { - triggers { - <timeout: timer> - } - action { - "etUnit_testFinished(-1);" - } - } - State state0 - } - } - } - - ActorClass Tester_ac { - Interface { - SPP spp: TestProtocolWithDataClass - } - Structure { - ServiceImplementation of spp - Attribute caseId: int32 - - // none config test - Attribute data_3: Data_3_dc - ActorRef testee_super2: Testee_Super2_ac - } - Behavior { - StateMachine { - Transition init: initial -> s1 { } - State s1 { - entry { - "caseId = etUnit_openTestCase(\"AttrConfigTest_case_Tester_ac\");" - "Data_3_dc_varCheck3(&(data_3), caseId);" - "etUnit_closeTestCase(caseId);" - } - } - } - } - } - - ActorClass Testee_1_ac { - Interface { - conjugated Port conj_port: TestProtocolAttributes - } - Structure { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - external Port conj_port - Attribute caseId: int32 - Attribute data_1: Data_1_dc - Attribute enumval1: Enum_1 = "one" - Attribute enumval2: Enum_2 = "four" - ActorRef testee_2: Testee_2_ac - } - Behavior { - StateMachine { - 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);" - } - } - } - } - } - - ActorClass Testee_Super2_ac { - Interface { - Port reg_port: TestProtocolAttributes - } - Structure { - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - external Port reg_port - Attribute caseId: int32 - - // test - Attribute data_2: Data_2_dc - Attribute float64_super_r: float64 = "1.1" - Attribute float64_super_c: float64 = "1.1" - 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);" - } - } - } - - ActorClass Testee_2_ac extends Testee_Super2_ac { - Structure { - SAP sap: TestProtocolWithDataClass - Attribute int32_own_r: int32 = "11" - Attribute int32_own_c: int32 = "11" - 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);" - } - StateMachine { - 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);" - } - } - } - } - } - - ProtocolClass TestProtocolAttributes { - incoming { - Message dummy() - } - regular PortClass - { - Attribute float_r: float32 = "4" - Attribute float_c: float32 = "16" - Attribute float_i: float32 = "256" - } - conjugated PortClass - { - 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\"" - } - incoming { - Message dummy() - } - - //SAP - conjugated PortClass - { - Attribute sap_data_2: Data_2_dc - - // none config test - Attribute sap_data_3: Data_3_dc - } - } - - 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 }" - } - - DataClass Data_1_dc extends Data_Super1_dc{ - usercode1 { - "#include \"etUnit/etUnit.h\"" - } - - Attribute int8_r: int8 = "8" - Attribute int8_c: int8 = "8" - Attribute int8_i: int8 = "8" - Attribute int16_r: int16 = "16" - Attribute int16_c: int16 = "16" - Attribute int16_i: int16 = "16" - Attribute int32_r: int32 = "32" - Attribute int32_c: int32 = "32" - Attribute int32_i: int32 = "32" - Attribute int64_r: int64 = "64" - Attribute int64_c: int64 = "64" - Attribute int64_i: int64 = "64" - Attribute float32_r: float32 = "3.2" - Attribute float32_c: float32 = "3.2" - Attribute float32_i: float32 = "3.2" - Attribute float64_r: float64 = "6.4" - Attribute float64_c: float64 = "6.4" - Attribute float64_i: float64 = "6.4" - Attribute char_r: char = "R" - Attribute char_c: char = 'R' - Attribute char_i: char = "R" - Attribute string_r: string = ":/" - Attribute string_c: string = ":/" - 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" - - // 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);" - } - } - - DataClass Data_2_dc { - 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);" - } - } - - DataClass Data_3_dc { - 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 dataClass_ref: 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_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);" - } - } - - Enumeration Enum_1 { - zero, - one, - two - } - - Enumeration Enum_2 of int16 { - three=3, - four - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room b/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room deleted file mode 100644 index 96e43a311..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/models/staticConfig/StaticConfigTest_Java.room +++ /dev/null @@ -1,393 +0,0 @@ -RoomModel StaticConfigTest { - - import room.basic.types.* from "../Types.room" - import room.basic.service.timing.* from "../TimingService.room" - - LogicalSystem System_StaticConfigTest { - SubSystemRef main : SubSystem_StaticConfigTest - } - - SubSystemClass SubSystem_StaticConfigTest { - LayerConnection ref top satisfied_by timer.timer - ActorRef top: Top_ac - ActorRef timer : ATimingService - } - - ActorClass Top_ac { - Structure { - LayerConnection ref testee_1 satisfied_by tester.spp - ActorRef testee_1: Testee_1_ac - ActorRef tester: Tester_ac - SAP timer : PTimer - } - Behavior { - ctor { - "etUnit_open(\"log/testlog\", \"StaticConfigTest\");" - "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.StaticConfigTest\");" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } - StateMachine { - Transition init: initial -> state0 { - action { - "timer.startTimeout(1000);" - } - } - Transition tr0: state0 -> state0 { - triggers { - <timeout: timer> - } - action { - "etUnit_testFinished(-1);" - } - } - State state0 - } - } - } - - ActorClass Tester_ac { - Interface { - SPP spp: TestProtocolWithDataClass - } - Structure { - ServiceImplementation of spp - ActorRef testee_super2: Testee_Super2_ac - Attribute caseId: int32 - - // none config test - Attribute data_3: Data_3_dc - } - Behavior { - 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);" - } - } - } - } - } - - ActorClass Testee_1_ac { - Interface { - conjugated Port conj_port: TestProtocolAttributes - } - Structure { - ActorRef testee_2: Testee_2_ac - Attribute caseId: int32 - Attribute data_1: Data_1_dc - Attribute enumval1: Enum_1 = "one" - Attribute enumval2: Enum_2 = "four" - external Port conj_port - } - Behavior { - 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);" - } - } - } - } - } - - ActorClass Testee_Super2_ac { - Interface { - Port reg_port: TestProtocolAttributes - } - Structure { - Attribute caseId: int32 - - // test - Attribute data_2: Data_2_dc - Attribute float64_super_r: float64 = "1.1" - Attribute float64_super_c: float64 = "1.1" - Attribute float64_super_i: float64 = "1.1" - external Port reg_port - } - } - - ActorClass Testee_2_ac extends Testee_Super2_ac { - Structure { - Attribute int32_own_r: int32 = "11" - Attribute int32_own_c: int32 = "11" - Attribute int32_own_i: int32 = "11" - SAP sap: TestProtocolWithDataClass - } - Behavior { - 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);" - } - } - } - } - } - - ProtocolClass TestProtocolAttributes { - incoming { - Message dummy() - } - 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);" - } - 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}" - } - } - - ProtocolClass TestProtocolWithDataClass { - incoming { - Message dummy() - } - - //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);" - } - Attribute sap_data_2: Data_2_dc - - // none config test - Attribute sap_data_3: Data_3_dc - } - } - - DataClass Data_Super1_dc { - - // PrimitiveType - Attribute bool_r: boolean = "false" - Attribute bool_c: boolean = "false" - Attribute bool_i: boolean = "false" - Attribute int8_r: int8 = "8" - Attribute int8_c: int8 = "8" - 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 }" - } - - 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\"));" - } - Attribute int16_r: int16 = "16" - Attribute int16_c: int16 = "16" - Attribute int16_i: int16 = "16" - Attribute int32_r: int32 = "32" - Attribute int32_c: int32 = "32" - Attribute int32_i: int32 = "32" - Attribute int64_r: int64 = "64" - Attribute int64_c: int64 = "64" - Attribute int64_i: int64 = "64" - Attribute float32_r: float32 = "3.2" - Attribute float32_c: float32 = "3.2" - Attribute float32_i: float32 = "3.2" - Attribute float64_r: float64 = "6.4" - Attribute float64_c: float64 = "6.4" - Attribute float64_i: float64 = "6.4" - Attribute char_r: char = "R" - Attribute char_c: char = 'R' - Attribute char_i: char = "R" - Attribute string_r: string = ":/" - Attribute string_c: string = ":/" - 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" - - // 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);" - } - 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);" - } -// none config test - Attribute dataClass_array [ 2 ]: Data_2_dc - Attribute dataClass_ref: 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_ref: extType 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 - Attribute primitive1_ref: int8 ref - Attribute primitive3_ref: char ref - } - - ExternalType extType -> "External_Type_Test" - - Enumeration Enum_1 { - zero, - one, - two - } - - Enumeration Enum_2 of int16 { - three=3, - four - } - -}
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.common.tests/test.gradle b/tests/org.eclipse.etrice.generator.common.tests/test.gradle deleted file mode 100644 index e585a73a2..000000000 --- a/tests/org.eclipse.etrice.generator.common.tests/test.gradle +++ /dev/null @@ -1,98 +0,0 @@ - -ext.addTest = { lang, name, genArgs -> - def nameCap = name.capitalize() - def langCap = lang.capitalize() - def testName = "$name$langCap" - def testNameCap = testName.capitalize() - def genDir = "src-gen/$lang/$name" - def logDir = "log/$lang" - def exeFile = "$buildDir/exe/$testName/$testName" - def mainClass = "${nameCap}.Node_node_ref_SubSystem_${nameCap}Runner" - def etuFile = "$logDir/log/testlog/${nameCap}.etu" - def xmlFile = "$logDir/log/testlog/${nameCap}.xml" - def modellib = ":runtime:org.eclipse.etrice.modellib.$lang" - def generator = ":plugins:org.eclipse.etrice.generator.$lang" - def etUnitConverter = ':plugins:org.eclipse.etrice.etunit.converter' - - def generateTask = tasks.create(name: "generate$testNameCap", type: JavaExec) { - dependsOn "$generator:classes" - main = project(generator).mainClassName - classpath = project(generator).classpath - args '-msc_instr', '-genDir', genDir - args genArgs - environment 'etModellib', "org.eclipse.etrice.modellib.$lang" - inputs.files genArgs - outputs.dir genDir - } - - def runTask - - if(lang == 'c' || lang == 'cpp') { - model { - components { - "$testName"(NativeExecutableSpec) { - sources."$lang" { - builtBy generateTask - source { - srcDirs = [genDir] - include "**/*.$lang" - } - exportedHeaders { - srcDirs = [genDir] - } - lib project: ":runtime:org.eclipse.etrice.modellib.$lang", library: "etrice_modellib_$lang", linkage: 'static' - if(lang == 'cpp') lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' - lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' - } - binaries.all { - cCompiler.args '-g3' - cppCompiler.args '-g3' - } - } - } - } - - runTask = tasks.create(name: "run$testNameCap", type: Exec) { - dependsOn "${testName}Executable" - commandLine exeFile, '-run_as_test' - inputs.file exeFile - outputs.file etuFile - workingDir = logDir - } - } - - else if(lang == 'java') { - def testSourceSet = sourceSets.create(name) { - java.srcDirs = [genDir] - } - - dependencies { - add "${name}Compile", project(':runtime:org.eclipse.etrice.modellib.java') - add "${name}Compile", project(':runtime:org.eclipse.etrice.runtime.java') - } - - tasks.getByName("compile${nameCap}Java").dependsOn generateTask - - runTask = tasks.create(name: "run$testName", type: JavaExec) { - dependsOn "${name}Classes" - main = mainClass - classpath = testSourceSet.runtimeClasspath - args '-run_as_test' - outputs.file etuFile - workingDir = logDir - } - } - - def convertTask = tasks.create(name: "convert$testNameCap", type: JavaExec) { - dependsOn runTask, "$etUnitConverter:classes" - main = project(etUnitConverter).mainClassName - classpath = project(etUnitConverter).classpath - args etuFile - inputs.file etuFile - outputs.file xmlFile - } - - def testTask = tasks.create(name: testName, dependsOn: convertTask, group: 'verification') - check.dependsOn testTask - return testTask -}
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle new file mode 100644 index 000000000..f5680e988 --- /dev/null +++ b/tests/org.eclipse.etrice.generator.cpp.tests/build.gradle @@ -0,0 +1,10 @@ +plugins { + id 'cpp' +} + +apply from: etriceTest + +def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' + +createTest('cpp', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) +createTest('cpp', 'initializationTest', ['models/InitializationTest.room', genericPhysical])
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/InitializationTest.room b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room index 05a85ba8f..633aa3b95 100644 --- a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/InitializationTest.room +++ b/tests/org.eclipse.etrice.generator.cpp.tests/models/InitializationTest.room @@ -1,8 +1,7 @@ RoomModel InitializationTest { - import room.basic.types.* from "Types.room" - - import room.basic.test.* from "Tests.room" + 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" async ActorClass InitializationTest { @TestInstance @@ -46,7 +45,7 @@ RoomModel InitializationTest { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" + "caseId = etUnit_openAll(\".\", \"InitializationTest\", \"org.eclipse.etrice.generator.cpp.tests.InitializationTest\", \"InitializationTest_case\");" "testInitValues(caseId);" } dtor { diff --git a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt b/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt deleted file mode 100644 index e69de29bb..000000000 --- a/tests/org.eclipse.etrice.generator.cpp.tests/targetModels/empty.txt +++ /dev/null diff --git a/tests/org.eclipse.etrice.generator.java.tests/.classpath b/tests/org.eclipse.etrice.generator.java.tests/.classpath index e536cf5fa..65add28fb 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.classpath +++ b/tests/org.eclipse.etrice.generator.java.tests/.classpath @@ -1,8 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="src/dynamicActorTest7"/> + <classpathentry kind="src" path="src/storeRestoreTest"/> + <classpathentry kind="src" path="src/staticConfigTest"/> + <classpathentry kind="src" path="src/dynamicConfigTest"/> + <classpathentry kind="lib" path="build/libs/org.eclipse.etrice.generator.java.tests.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.etrice.modellib.java"/> <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.etrice.runtime.java"/> - <classpathentry kind="output" path="bin"/> + <classpathentry kind="output" path="build/classes/main"/> </classpath> diff --git a/tests/org.eclipse.etrice.generator.java.tests/.project b/tests/org.eclipse.etrice.generator.java.tests/.project index e76db8475..8373cc3a2 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/.project +++ b/tests/org.eclipse.etrice.generator.java.tests/.project @@ -6,12 +6,12 @@ </projects> <buildSpec> <buildCommand> - <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> - <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription> diff --git a/tests/org.eclipse.etrice.generator.java.tests/build.gradle b/tests/org.eclipse.etrice.generator.java.tests/build.gradle index 6e4f72074..0ce79733a 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/build.gradle +++ b/tests/org.eclipse.etrice.generator.java.tests/build.gradle @@ -1,32 +1,29 @@ plugins { - id 'java' + id 'java-base' } -dependencies { - compile project(':runtime:org.eclipse.etrice.runtime.java') - compile project(':runtime:org.eclipse.etrice.modellib.java') -} +apply from: etriceTest -sourceSets { - main { - java { - srcDirs = ['src', 'src-gen'] - } - } -} +def genericPhysical = '../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys' -/*def createTestTasks(name, models, options) { - -}*/ +createTest('java', 'sendingDataTest', ['models/SendingDataTest.room', genericPhysical]) +createTest('java', 'staticConfigTest', ['models/StaticConfigTest.etmap', 'models/StaticConfigTest.room', 'models/StaticConfigTest.config']) +sourceSets.staticConfigTest.java.srcDir 'src/staticConfigTest' -task gen(type: JavaExec, dependsOn: ':plugins:org.eclipse.etrice.generator.java:classes') { - main = 'org.eclipse.etrice.generator.java.Main' - classpath = project(':plugins:org.eclipse.etrice.generator.java').sourceSets.main.runtimeClasspath - args 'ActorCommunicationTest.room' -} +createTest('java', 'dynamicActorTest1', ['models/DynamicActorTest1.etmap', 'models/DynamicActorTest1.room']) +createTest('java', 'dynamicActorTest2', ['models/DynamicActorTest2.etmap', 'models/DynamicActorTest2.room']) +createTest('java', 'dynamicActorTest3', ['models/DynamicActorTest3.room', genericPhysical]) +createTest('java', 'dynamicActorTest4', ['models/DynamicActorTest4.room', genericPhysical]) +createTest('java', 'dynamicActorTest5', ['models/DynamicActorTest5.room', genericPhysical]) +createTest('java', 'dynamicActorTest6', ['models/DynamicActorTest6.room', genericPhysical]) + +createTest('java', 'tCPTest', ['models/TCPTest.room', genericPhysical]) -task run(type: JavaExec, dependsOn: classes) { - main = 'DynamicActorTest1.Node_node_da1TestRunner' - classpath = sourceSets.main.runtimeClasspath - args '-run_as_test' -}
\ No newline at end of file +/* These are not working yet (problem when genererating with -persistable -storeObjects the Modellib is overriden) :(( +def genOptions = ['-persistable', '-storeDataObj'] +createTest('java', 'dynamicActorTest7', ['models/DynamicActorTest7.etmap', 'models/DynamicActorTest7.room'], genOptions) +sourceSets.dynamicActorTest7.java.srcDir 'src/dynamicActorTest7' +createTest('java', 'dynamicConfigTest', ['models/DynamicConfigTest.etmap', 'models/DynamicConfigTest.room'], genOptions) +sourceSets.dynamicConfigTest.java.srcDir 'src/dynamicConfigTest' +createTest('java', 'storeRestoreTest', ['models/StoreRestoreTest.room', genericPhysical], genOptions) +sourceSets.storeRestoreTest.java.srcDir 'src/storeRestoreTest' */
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap index e50d57a44..760374536 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.etmap @@ -1,6 +1,6 @@ MappingModel DynamicActorTest1 { import DynamicActorTest1.* from "DynamicActorTest1.room" - import room.generic.physical.* from "GenericPhysical.etphys" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" Mapping JavaGenTests -> GenericPhysicalSystem { SubSystemMapping da1Test -> node { diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room index 65fccd5ca..8701a556f 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest1.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest1.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest1 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" LogicalSystem JavaGenTests { SubSystemRef da1Test : SubSystem_DynamicActorTest1 @@ -30,7 +30,7 @@ RoomModel DynamicActorTest1 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest1\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest1\", \"DynamicActorTest1_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.etmap index dcc7fb88d..e13a69c66 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/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 "GenericPhysical.etphys" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" Mapping JavaGenTests -> GenericPhysicalSystem { SubSystemMapping da2Test -> node { diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room index e4c9a709c..ba0f65f9b 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest2.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest2.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest2 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" LogicalSystem JavaGenTests { SubSystemRef da2Test : SubSystem_DynamicActorTest2 @@ -30,7 +30,7 @@ RoomModel DynamicActorTest2 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest2\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest2\", \"DynamicActorTest2_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room index 985383f18..e757ba820 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest3.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest3.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest3 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" ActorClass Appl { @TestInstance @@ -22,7 +22,7 @@ RoomModel DynamicActorTest3 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest3\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest3\", \"DynamicActorTest3_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room index c26a065a0..7c3b95b27 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest4.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest4.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest4 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" ActorClass Appl { @TestInstance @@ -21,7 +21,7 @@ RoomModel DynamicActorTest4 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest4\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest4\", \"DynamicActorTest4_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room index e2d22dbe6..7b761f781 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest5.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest5.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest5 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" ActorClass Appl { @TestInstance @@ -21,7 +21,7 @@ RoomModel DynamicActorTest5 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest5\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest5\", \"DynamicActorTest5_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room index 2b4d94f18..a38e80330 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest6.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest6.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest6 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" ActorClass Appl { @TestInstance @@ -24,7 +24,7 @@ RoomModel DynamicActorTest6 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest6\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest6\", \"DynamicActorTest6_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap index cb52ba408..4bd054cd2 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.etmap @@ -1,6 +1,6 @@ MappingModel DynamicActorTest1 { import DynamicActorTest7.* from "DynamicActorTest7.room" - import room.generic.physical.* from "GenericPhysical.etphys" + import room.generic.physical.* from "../../org.eclipse.etrice.generator.common.tests/models/GenericPhysical.etphys" Mapping JavaGenTests -> GenericPhysicalSystem { SubSystemMapping da7Test -> node { diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room index 15630c617..32648c0e6 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicActorTest7.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicActorTest7.room @@ -1,7 +1,7 @@ RoomModel DynamicActorTest7 { - import room.basic.test.* from "Tests.room" - import room.basic.types.* from "Types.room" + 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" LogicalSystem JavaGenTests { SubSystemRef da7Test : SubSystem_DynamicActorTest7 @@ -42,7 +42,7 @@ RoomModel DynamicActorTest7 { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" + "caseId = etUnit_openAll(\".\", \"DynamicActorTest7\", \"org.eclipse.etrice.generator.common.tests.DynamicActorTest7\", \"DynamicActorTest7_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.config b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config index 13fd8a62b..13fd8a62b 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.config +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.config diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.etmap b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap index 3ec15a8f2..3ec15a8f2 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.etmap +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.etmap diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room index 6e0550ec5..f7ab9895d 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.room @@ -1,8 +1,7 @@ RoomModel DynamicConfigTest { - import room.basic.types.* from "Types.room" - - import room.basic.service.timing.* from "TimingService.room" + 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" LogicalSystem System_DynamicConfigTest{ SubSystemRef main : SubSystem_DynamicConfigTest @@ -50,7 +49,7 @@ RoomModel DynamicConfigTest { } Behavior { ctor { - "etUnit_open(\"log/testlog\", \"DynamicConfigTest\");" + "etUnit_open(\".\", \"DynamicConfigTest\");" "etUnit_openTestSuite(\"org.eclipse.etrice.generator.common.tests.DynamicConfigTest\");" "caseId = etUnit_openTestCase(\"DynamicConfigTest_case_Testee_ac\");" } diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.rt-config b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.rt-config index c27ad68cf..c27ad68cf 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/DynamicConfigTest.rt-config +++ b/tests/org.eclipse.etrice.generator.java.tests/models/DynamicConfigTest.rt-config diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room index 6c5a11105..bf9b8f9c5 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/StoreRestore.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/StoreRestoreTest.room @@ -1,7 +1,7 @@ -RoomModel StoreRestore { - - import room.basic.test.* from "Tests.room" +RoomModel StoreRestoreTest { + import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.java/model/Tests.room" + ActorClass StoreRestore_Top { @TestInstance Structure { @@ -117,7 +117,7 @@ RoomModel StoreRestore { } Behavior { ctor { - "caseId = etUnit_openAll(\"log/testlog\", \"StoreRestore\", \"org.eclipse.etrice.generator.common.tests.StoreRestore\", \"StoreRestore_case\");" + "caseId = etUnit_openAll(\".\", \"StoreRestoreTest\", \"org.eclipse.etrice.generator.common.tests.StoreRestoreTest\", \"StoreRestoreTest_case\");" } dtor { "etUnit_closeAll(caseId);" diff --git a/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room index d234bfe2b..6671d6d3d 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/targetModels/TCPTest.room +++ b/tests/org.eclipse.etrice.generator.java.tests/models/TCPTest.room @@ -1,160 +1,160 @@ -RoomModel TCPTest { - - import room.basic.test.* 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 { - <established: p0> - } - action { - "// open 5 clients" - "for (int i=0;i<p2.getReplication();i++){" - "p2[i].open(controlData);" - "}" - "counter=0;" - } - } - Transition tr1: state1 -> cp cp0 { - triggers { - <established: p2> - } - 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<p3.getReplication();i++){" - "\tp3[i].send(testData);" - "}" - "counter=0;" - "resultPattern=0;" - } - } - Transition tr8: state2 -> cp cp2 { - triggers { - <receive: p3> - } - 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();i++){" - "\tpattern+=i;" - "}" - } - } - Transition tr3: state2 -> state2 { - triggers { - <receive: p1> - } - action { - "p1.send(data);" - } - } - 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);" - } - } - } - } - }
+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"
+
+ 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(\".\", \"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 {
+ <established: p0>
+ }
+ action {
+ "// open 5 clients"
+ "for (int i=0;i<p2.getReplication();i++){"
+ "p2[i].open(controlData);"
+ "}"
+ "counter=0;"
+ }
+ }
+ Transition tr1: state1 -> cp cp0 {
+ triggers {
+ <established: p2>
+ }
+ 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<p3.getReplication();i++){"
+ "\tp3[i].send(testData);"
+ "}"
+ "counter=0;"
+ "resultPattern=0;"
+ }
+ }
+ Transition tr8: state2 -> cp cp2 {
+ triggers {
+ <receive: p3>
+ }
+ 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();i++){"
+ "\tpattern+=i;"
+ "}"
+ }
+ }
+ Transition tr3: state2 -> state2 {
+ triggers {
+ <receive: p1>
+ }
+ action {
+ "p1.send(data);"
+ }
+ }
+ 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.generator.java.tests/src/DynamicActorTest7/FilePersistor.java b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicActorTest7/DynamicActorTest7/FilePersistor.java index eb1530117..eb1530117 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicActorTest7/FilePersistor.java +++ b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicActorTest7/DynamicActorTest7/FilePersistor.java diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicConfigTest/DynamicConfigTest/ConfigSourceTestInstance.java index 5d7b3f846..5d7b3f846 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/src/DynamicConfigTest/ConfigSourceTestInstance.java +++ b/tests/org.eclipse.etrice.generator.java.tests/src/dynamicConfigTest/DynamicConfigTest/ConfigSourceTestInstance.java diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/StaticConfigTest/External_Type_Test.java b/tests/org.eclipse.etrice.generator.java.tests/src/staticConfigTest/StaticConfigTest/External_Type_Test.java index 1798235ce..1798235ce 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/src/StaticConfigTest/External_Type_Test.java +++ b/tests/org.eclipse.etrice.generator.java.tests/src/staticConfigTest/StaticConfigTest/External_Type_Test.java diff --git a/tests/org.eclipse.etrice.generator.java.tests/src/StoreRestore/ObjectHolder.java b/tests/org.eclipse.etrice.generator.java.tests/src/storeRestoreTest/StoreRestoreTest/ObjectHolder.java index 18df93cb5..ef6d75958 100644 --- a/tests/org.eclipse.etrice.generator.java.tests/src/StoreRestore/ObjectHolder.java +++ b/tests/org.eclipse.etrice.generator.java.tests/src/storeRestoreTest/StoreRestoreTest/ObjectHolder.java @@ -10,10 +10,12 @@ * *******************************************************************************/ -package StoreRestore; +package StoreRestoreTest; import org.eclipse.etrice.runtime.java.modelbase.IActorClassDataObject; +import StoreRestoreTest.ObjectHolder; + /** * @author hrentz * diff --git a/tests/org.eclipse.etrice.runtime.c.tests/build.gradle b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle new file mode 100644 index 000000000..cf2f3e1e4 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.c.tests/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'c' +} + +apply from: etUnitConverter + +model { + components { + etrice_runtime_c_tests(NativeExecutableSpec) { + sources.c { + source { + srcDirs = ['src'] + include '**/*.c' + } + exportedHeaders { + srcDirs = ['src'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + } + } +} + +def exeFile = "$buildDir/exe/etrice_runtime_c_tests/etrice_runtime_c_tests" +def etuFileRuntimeTest = 'log/testlog/TestCRuntime.etu' +def etuFileEtUnitTest = 'log/testlog/TestEtUnitSpecial.etu' + +clean.delete 'log' + +task run(type: Exec, dependsOn: assemble, group: 'verification') { + commandLine exeFile + inputs.file exeFile + outputs.files etuFileRuntimeTest, etuFileEtUnitTest + + doFirst { file('log/testlog').mkdirs() } +} + +createEtUnitConverterTask('convert', run) + +check.dependsOn convert
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle new file mode 100644 index 000000000..74624fe04 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.cpp.tests/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'cpp' +} + +apply from: etUnitConverter + +model { + components { + etrice_runtime_cpp_tests(NativeExecutableSpec) { + sources.cpp { + source { + srcDirs = ['src'] + include '**/*.cpp' + } + exportedHeaders { + srcDirs = ['src'] + } + lib project: ':runtime:org.eclipse.etrice.runtime.cpp', library: 'etrice_runtime_cpp', linkage: 'static' + lib project: ':runtime:org.eclipse.etrice.runtime.c', library: 'etrice_runtime_c', linkage: 'static' + } + } + } +} + +def exeFile = "$buildDir/exe/etrice_runtime_cpp_tests/etrice_runtime_cpp_tests" +def etuFile = 'log/testlog/TestCppRuntime.etu' + +clean.delete 'log' + +task run(type: Exec, dependsOn: assemble, group: 'verification') { + commandLine exeFile + inputs.file exeFile + outputs.files etuFile + + doFirst { file('log/testlog').mkdirs() } +} + +createEtUnitConverterTask('convert', run) + +check.dependsOn convert
\ No newline at end of file diff --git a/tests/org.eclipse.etrice.runtime.java.tests/build.gradle b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle new file mode 100644 index 000000000..8b221bf37 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.java.tests/build.gradle @@ -0,0 +1,16 @@ +plugins { + id 'java' +} + +repositories { + mavenCentral() +} + +dependencies { + testCompile project(':runtime:org.eclipse.etrice.runtime.java') + testCompile 'junit:junit:4.12' +} + +sourceSets.test.java.srcDirs = ['src'] + +test.reports.html.enabled = false
\ No newline at end of file |