Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJuergen Haug2019-01-17 10:48:03 -0500
committerJuergen Haug2019-01-17 10:48:03 -0500
commit08f2edfebbeb032aed2e3a972edeaa616d9cdf03 (patch)
tree37266af668fea9de9082d7440e244ee15356d749 /tests
parentda48ed6bbfdee34b1a42c76b5b2325aaeb296208 (diff)
downloadorg.eclipse.etrice-08f2edfebbeb032aed2e3a972edeaa616d9cdf03.tar.gz
org.eclipse.etrice-08f2edfebbeb032aed2e3a972edeaa616d9cdf03.tar.xz
org.eclipse.etrice-08f2edfebbeb032aed2e3a972edeaa616d9cdf03.zip
[Bug 540562] Support var args for operations
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/build.gradle6
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room2
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room65
3 files changed, 70 insertions, 3 deletions
diff --git a/tests/org.eclipse.etrice.generator.common.tests/build.gradle b/tests/org.eclipse.etrice.generator.common.tests/build.gradle
index db760ff3d..42d4d908d 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/build.gradle
+++ b/tests/org.eclipse.etrice.generator.common.tests/build.gradle
@@ -12,7 +12,7 @@ def tests = [
choicePointTestExtended: ['models/ChoicePointTestExtended.room', genericPhysical],
dataDrivenTest: ['models/DataDrivenTest.room', genericPhysical],
/* enumTest: ['models/EnumTest.room', genericPhysical], not supported in c++ */
- compileTests: ['models/CompileTests.room', genericPhysical, 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room', 'models/VarargsTest.room'],
+ compileTests: ['models/CompileTests.room', genericPhysical, 'models/StatemachineInterfaceTest.room', 'models/StatemachineInterfaceInheritedTest.room', 'models/StatemachineInterfaceTest.room', 'models/ContinuationTransitionTest.room'],
handlerTest: ['models/HandlerTest.room', genericPhysical],
operationInheritanceTest: ['models/OperationInheritanceTest.room', genericPhysical],
@@ -33,3 +33,7 @@ createTest('java', 'enumTest', ['models/EnumTest.room', genericPhysical])
// DetailExpressionCompile Test
createTest('c', 'detailExpressionCompileTest', [genericPhysical, 'models/DetailExpressionTest.room', 'models/DetailExpressionEnum.room', 'models/DetailExpressionTypes.room'])
createTest('java', 'detailExpressionCompileTest', [genericPhysical, 'models/DetailExpressionTest.room', 'models/DetailExpressionEnum.room', 'models/DetailExpressionTypes.room'])
+
+// VarargsTTest
+createTest('c', 'varargsTest', [genericPhysical, 'models/VarargsTest.room'])
+createTest('java', 'varargsTest', [genericPhysical, 'models/VarargsTest.room'])
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 e2790656b..f846c4db5 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/CompileTests.room
@@ -6,7 +6,6 @@ RoomModel CompileTests {
import StatemachineInterfaceTestModel.StatemachineInterfaceTest from "StatemachineInterfaceTest.room"
import StatemachineInterfaceTestInheritedModel.StatemachineInterfaceInheritedTest from "StatemachineInterfaceInheritedTest.room"
import ContinuationTransitionTest.ContinuationTransitionTest from "ContinuationTransitionTest.room"
- import VarargsTest.* from "VarargsTest.room"
ActorClass CompileTests {
@TestInstance
@@ -17,7 +16,6 @@ RoomModel CompileTests {
ActorRef statemachineInterfaceTest : StatemachineInterfaceTest
ActorRef statemachineInterfaceInheritedTest : StatemachineInterfaceInheritedTest
ActorRef continuationTransitionTest : ContinuationTransitionTest
- ActorRef varargsTest : AVarargs
}
Behavior {
ctor {
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room
index dde861c7c..19e28a487 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/VarargsTest.room
@@ -1,17 +1,66 @@
RoomModel VarargsTest {
import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room"
+ import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room"
ActorClass AVarargs {
+ @TestInstance
Structure {
+ Attribute caseId : int32
+
Port port: PVarargs
Attribute attr: DVarargs
+ Attribute text : string = "text"
}
Behavior {
// varargs keyword is hidden in proposals -> internal use
Operation log(format: string, args: string varargs) ''''''
Operation single(args: string varargs) ''''''
+ Operation callTest() '''
+ //log("text");
+ log("text %d", "5");
+ log("text %d, %s", "5", text);
+ //single();
+ single("5");
+ single("5", "txt");
+
+ // not supported by translation
+ /*
+ port.callTest();
+ attr.callTest();
+
+ //port.log("text");
+ port.log("text %d", "5");
+ port.log("text %d, %s", "5", "txt");
+ //port.single();
+ port.single("5");
+ port.single("5", "txt");
+
+ //attr.log("text");
+ attr.log("text %d", "5");
+ attr.log("text %d, %s", "5", "txt");
+ //attr.single();
+ attr.single("5");
+ attr.single("5", "txt");
+ */
+ '''
+
+ ctor '''
+ caseId = etUnit_openAll("log", "VarargsTest", "org.eclipse.etrice.generator.common.tests.VarargsTest", "VarargsTest_case");
+ '''
+ dtor '''
+ etUnit_closeAll(caseId);
+ '''
+ StateMachine {
+ Transition init: initial -> finish
+ State finish {
+ entry '''
+ callTest();
+ etUnit_testFinished(caseId);
+ '''
+ }
+ }
}
}
@@ -23,6 +72,14 @@ RoomModel VarargsTest {
{
Operation log(format: string, args: string varargs) ''''''
Operation single(args: string varargs) ''''''
+ Operation callTest() '''
+ //log("text");
+ log("text %d", "5");
+ log("text %d, %s", "5", "txt");
+ //single();
+ single("5");
+ single("5", "txt");
+ '''
}
}
@@ -32,5 +89,13 @@ RoomModel VarargsTest {
// varargs keyword is hidden in proposals -> internal use
Operation log(format: string, args: string varargs) ''''''
Operation single(args: string varargs) ''''''
+ Operation callTest() '''
+ //log("text");
+ log("text %d", "5");
+ log("text %d, %s", "5", "txt");
+ //single();
+ single("5");
+ single("5", "txt");
+ '''
}
} \ No newline at end of file

Back to the top