Commit ab8f83f4 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+added basic support for verdict assignments


*refined handling of enums

Change-Id: I98757b76702731287e6c04114c7851b86071e62e
Signed-off-by: Philip Makedonski's avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent 716bca6b
......@@ -373,7 +373,7 @@ rule TC2FD
fd.statement.stat.add(sl);
//create components
for (ci in tc.componentInstance.select(c|simulateSUT or c.role.name = "Tester")) {
for (ci in tc.componentInstance.select(c|simulateSUT or c.role = TDL!ComponentInstanceRole#Tester)) {
var s = new TTCN!FunctionStatement();
s.basic = new TTCN!BasicStatements();
s.basic.assign = new TTCN!Assignment();
......@@ -394,12 +394,12 @@ rule TC2FD
//merge ports of SUT components into sut
if (not simulateSUT) {
for (c in tc.connection) {
if (c.endPoint.get(0).component.role.name = "SUT" and
c.endPoint.get(1).component.role.name = "Tester" ) {
if (c.endPoint.get(0).component.role = TDL!ComponentInstanceRole#SUT and
c.endPoint.get(1).component.role = TDL!ComponentInstanceRole#Tester ) {
c.endPoint.get(0).mergeIntoSUT(sut);
}
if (c.endPoint.get(1).component.role.name = "SUT" and
c.endPoint.get(0).component.role.name = "Tester" ) {
if (c.endPoint.get(1).component.role = TDL!ComponentInstanceRole#SUT and
c.endPoint.get(0).component.role = TDL!ComponentInstanceRole#Tester ) {
c.endPoint.get(1).mergeIntoSUT(sut);
}
}
......@@ -407,12 +407,12 @@ rule TC2FD
//handle multiple connections to the same gate
for (c in tc.connection) {
if (//c.endPoint.get(0).component.role.name = "SUT" and
c.endPoint.get(1).component.role.name = "Tester" ) {
if (//c.endPoint.get(0).component.role = TDL!ComponentInstanceRole#SUT and
c.endPoint.get(1).component.role = TDL!ComponentInstanceRole#Tester ) {
c.endPoint.get(1).createConnectionPort();
}
if (//c.endPoint.get(1).component.role.name = "SUT" and
c.endPoint.get(0).component.role.name = "Tester" ) {
if (//c.endPoint.get(1).component.role = TDL!ComponentInstanceRole#SUT and
c.endPoint.get(0).component.role = TDL!ComponentInstanceRole#Tester ) {
c.endPoint.get(0).createConnectionPort();
}
}
......@@ -421,8 +421,8 @@ rule TC2FD
//create connections
for (c in tc.connection) {
if (simulateSUT or
(c.endPoint.get(0).component.role.name = "Tester" and
c.endPoint.get(1).component.role.name = "Tester" )) {
(c.endPoint.get(0).component.role = TDL!ComponentInstanceRole#Tester and
c.endPoint.get(1).component.role = TDL!ComponentInstanceRole#Tester )) {
var s = new TTCN!FunctionStatement();
s.configuration = new TTCN!ConfigurationStatements();
......@@ -432,8 +432,8 @@ rule TC2FD
s.configuration.connect.spec.port2 = c.endPoint.get(1).equivalent();
sl.statements.add(s);
sl.sc.add(";");
} else if ((c.endPoint.get(0).component.role.name = "SUT" and
c.endPoint.get(1).component.role.name = "SUT" )) {
} else if ((c.endPoint.get(0).component.role = TDL!ComponentInstanceRole#SUT and
c.endPoint.get(1).component.role = TDL!ComponentInstanceRole#SUT )) {
//skip
} else {
var s = new TTCN!FunctionStatement();
......@@ -483,7 +483,7 @@ rule TD2FD
}
for (ci in td.testConfiguration.componentInstance.select(c|simulateSUT or c.role.name = "Tester")) {
for (ci in td.testConfiguration.componentInstance.select(c|simulateSUT or c.role = TDL!ComponentInstanceRole#Tester)) {
var cf = new TTCN!FunctionDef();
cf.name = td.TTCNname()+"_"+ci.TTCNname()+"_main";
......@@ -586,7 +586,7 @@ rule GR2PR
var cr = new TTCN!ComponentRef();
pr.component = cr;
if (simulateSUT or gr.component.role.name = "Tester" ) {
if (simulateSUT or gr.component.role = TDL!ComponentInstanceRole#Tester ) {
cr.ref = new TTCN!ComponentOrDefaultReference();
cr.ref.variable = new TTCN!VariableRef();
cr.ref.variable.ref = new TTCN!ReferencedValue();
......@@ -641,7 +641,7 @@ rule CT2C
rule CI2V
transform ci : TDL!ComponentInstance
to v : TTCN!SingleVarInstance {
guard : simulateSUT or ci.role.name = "Tester"
guard : simulateSUT or ci.role = TDL!ComponentInstanceRole#Tester
v.name = ci.TTCNname();
......@@ -1247,13 +1247,13 @@ operation String getFunction() : TTCN!FunctionDef {
operation TDL!GateReference checkGateReference() : Boolean {
var accepted = false;
if (self.component.role.name = "Tester") {
if (self.component.role = TDL!ComponentInstanceRole#Tester) {
accepted = true;
}
if (self.component.role.name = "SUT") {
if (self.component.role = TDL!ComponentInstanceRole#SUT) {
if (self.eContainer.isKindOf(TDL!Connection)) {
var opposite = self.eContainer.endPoint.select(e|e <> self).first();
if (opposite.component.role.name = "Tester") {
if (opposite.component.role = TDL!ComponentInstanceRole#Tester) {
accepted = true;
}
}
......@@ -1371,7 +1371,7 @@ operation TDL!Interaction execute() {
//TODO: simplify
//source behaviour
if (simulateSUT or self.sourceGate.component.role.name = "Tester") {
if (simulateSUT or self.sourceGate.component.role = TDL!ComponentInstanceRole#Tester) {
var sc = self.getMainContext(self.sourceGate.component);
var sb = stack.get(sc).last();
var ssl = self.executeSource();
......@@ -1380,7 +1380,7 @@ operation TDL!Interaction execute() {
//TODO: handle multicast?
//target behaviour
if (simulateSUT or self.target.first().targetGate.component.role.name = "Tester") {
if (simulateSUT or self.target.first().targetGate.component.role = TDL!ComponentInstanceRole#Tester) {
var tc = self.getMainContext(self.target.first().targetGate.component);
var tb = stack.get(tc).last();
var t = self.target.first();
......@@ -1413,13 +1413,13 @@ operation TDL!AlternativeBehaviour execute() {
//TODO: naive simplified assumption
var fb = self.block.first().behaviour.first();
if (fb.isKindOf(TDL!Interaction)) {
if (simulateSUT or fb.sourceGate.component.role.name = "Tester") {
if (simulateSUT or fb.sourceGate.component.role = TDL!ComponentInstanceRole#Tester) {
var sc = self.getMainContext(fb.sourceGate.component);
var sb = stack.get(sc).last();
self.executeSource(sb);
}
if (simulateSUT or fb.target.first().targetGate.component.role.name = "Tester") {
if (simulateSUT or fb.target.first().targetGate.component.role = TDL!ComponentInstanceRole#Tester) {
var tc = self.getMainContext(fb.target.first().targetGate.component);
var tb = stack.get(tc).last();
self.executeTarget(tb);
......@@ -1551,6 +1551,39 @@ operation TDL!ActionReference execute() {
operation TDL!VerdictAssignment execute() {
//TODO
for (ci in self.getTestDescription().testConfiguration.componentInstance.select(c|simulateSUT or c.role = TDL!ComponentInstanceRole#Tester)) {
var sc = self.getMainContext(ci);
var sb = stack.get(sc).last();
var ssl = new TTCN!FunctionStatementList();
var sfs = new TTCN!FunctionStatement();
sfs.verdict = new TTCN!SetLocalVerdict();
sfs.verdict.expression = new TTCN!Value();
//TODO: handle corresponding verdict properly
if (self.verdict.isKindOf(TDL!DataInstanceUse)) {
sfs.verdict.expression.predef = new TTCN!PredefinedValue();
if (self.verdict.dataInstance.name = "pass") {
sfs.verdict.expression.predef.verdictType = TTCN!VerdictTypeValue#pass;
} else if (self.verdict.dataInstance.name = "fail") {
sfs.verdict.expression.predef.verdictType = TTCN!VerdictTypeValue#fail;
} else if (self.verdict.dataInstance.name = "inconclusive") {
sfs.verdict.expression.predef.verdictType = TTCN!VerdictTypeValue#inconc;
} else {
//TODO
}
} else {
//TODO
}
ssl.statements.add(sfs);
ssl.sc.add(";");
sb.stat.add(ssl);
}
}
operation TDL!CompoundBehaviour execute() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment