Skip to content

Commit 8b71f3c

Browse files
elena-volkova-hclGitHub Enterprise
authored andcommitted
RIC-981: New test cases port_multiplicity_01 and port_multiplicity_02 (#54)
* RIC-981: New test cases port_multiplicity_01 and port_multiplicity_02 * RIC-981: Added emx models for port_multiplicity
1 parent 69bc7ee commit 8b71f3c

15 files changed

Lines changed: 1067 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ "folders": [
2+
{
3+
"path": "TestUtils"
4+
},
5+
{
6+
"path": "tests/port_multiplicity_01"
7+
},
8+
{
9+
"path": "tests/port_multiplicity_02"
10+
}
11+
]
12+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
protocol Proto {
2+
out e1();
3+
in e2();
4+
};
5+
6+
capsule Inner {
7+
service behavior port p~ : Proto;
8+
statemachine {
9+
state Initial, First, Second;
10+
initial -> Initial;
11+
Initial -> First on p.e1
12+
`
13+
p.e2().send();
14+
`;
15+
First -> Second on p.e1
16+
`
17+
FAIL("Unexpected second receiving of e1 signal");
18+
`;
19+
};
20+
};
21+
22+
capsule Top {
23+
part inner : Inner[3];
24+
behavior port pb : Proto [3];
25+
connect pb with inner.p;
26+
statemachine {
27+
state State0, State1, State2, State3;
28+
initial -> State0
29+
`
30+
pb.e1().sendAt(0);
31+
pb.e1().sendAt(1);
32+
pb.e1().sendAt(2);
33+
`;
34+
State0 -> State1 on pb.e2;
35+
State1 -> State2 on pb.e2;
36+
State2 -> State3 on pb.e2
37+
`
38+
PASS();
39+
`;
40+
};
41+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
group: cpp_code_generation
3+
---
4+
Test port multiplicity. Connecting behavior port with multiple instances of the same capsule.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let tc = TCF.define(TCF.CPP_TRANSFORM);
2+
tc.topCapsule = 'Top';
3+
tc.targetProject = 'port_multiplicity_01_target';
4+
tc.prerequisites = [
5+
'../../TestUtils/testlib.tcjs'
6+
];
7+
tc.commonPreface = `
8+
#include "testlib.art.h"
9+
`;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
protocol Events {
2+
in tokenIn();
3+
out tokenOut();
4+
};
5+
6+
capsule Top {
7+
/* Ports */
8+
behavior port serverPort : Events;
9+
/* Parts */
10+
part server : Server;
11+
part tokenManager : TokenManager;
12+
/* Connectors */
13+
connect server.tokenManager with tokenManager.server;
14+
connect serverPort with tokenManager.server;
15+
/* State Machine */
16+
statemachine {
17+
state State;
18+
initial -> State
19+
`
20+
serverPort.tokenOut().send();
21+
`;
22+
};
23+
};
24+
25+
capsule Server {
26+
service behavior port tokenManager : Events;
27+
statemachine {
28+
state State1, State2;
29+
initial -> State1;
30+
State1 -> State2 on tokenManager.tokenIn
31+
`
32+
PASS();
33+
`;
34+
};
35+
};
36+
37+
capsule TokenManager {
38+
service behavior port server~ : Events[2];
39+
behavior port timer : Timing;
40+
statemachine {
41+
state WaitForToken {
42+
tokenReceived: on server.tokenOut
43+
`
44+
server.tokenIn().send();
45+
`;
46+
};
47+
initial -> WaitForToken;
48+
};
49+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
group: cpp_code_generation
3+
---
4+
Test port multiplicity. Connect part's port and a local port to the other part's port with multiplicity 2.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let tc = TCF.define(TCF.CPP_TRANSFORM);
2+
tc.topCapsule = 'Top';
3+
tc.targetProject = 'port_multiplicity_02_target';
4+
tc.prerequisites = [
5+
'../../TestUtils/testlib.tcjs'
6+
];
7+
tc.commonPreface = `
8+
#include "testlib.art.h"
9+
`;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>port_multiplicity_01</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.ibm.xtools.umldt.core.internal.builders.UMLDevelopmentBuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
</buildSpec>
15+
<natures>
16+
<nature>com.ibm.xtools.umldt.core.internal.natures.MDDProjectNature</nature>
17+
</natures>
18+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

art-comp-test/testsEmx/port_multiplicity_01/port_multiplicity_01.emx

Lines changed: 444 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)