Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room')
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room b/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room
new file mode 100644
index 000000000..d93962daa
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/SubSystemUserCodeTest.room
@@ -0,0 +1,32 @@
+RoomModel SubSystemUserCodeTest {
+
+ import room.basic.annotations.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Annotations.room"
+ import room.basic.test.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Tests.room"
+ import room.basic.types.* from "../../../runtime/org.eclipse.etrice.modellib.c/model/Types.room"
+
+ ActorClass AGeneratedUserCode {
+ @TestInstance
+ @SubSystemUserCode(userCode="
+ int inSubSystemInstance(){ return 99; }
+ ")
+ Structure {
+ usercode3 '''
+ extern int inSubSystemInstance();
+ '''
+ }
+ Behavior {
+ ctor '''
+ etInt16 caseId = etUnit_openAll("log", "SubSystemUserCodeTest", "org.eclipse.etrice.generator.c.tests.SubSystemUserCodeTest", "SubSystemUserCodeTest_case");
+ EXPECT_EQUAL_INT32(caseId, "", 99, inSubSystemInstance());
+ etUnit_testFinished(caseId);
+ etUnit_closeAll(caseId);
+ '''
+
+ }
+ }
+
+ // no instance => no sub system user code
+ ActorClass ANotGenerated {
+ @SubSystemUserCode(userCode="int inSubSystemInstance(){ return 0; }")
+ }
+} \ No newline at end of file

Back to the top