Commit 80dd4192 authored by Ludwig Dickmanns's avatar Ludwig Dickmanns
Browse files

MCDC: Correction & Cleanup

* Moved FormalRequirementMCDC to a new submodel (mcdc) in testing.ecore
* Removed print statements inside
TestingModelElementFactory.createFormalRequirementMCDC( ... ) 
* created validStatementSequenceMCDC( ... ) inside TestingUtils to
factor out duplicate code inside the above mentioned
createFormalRequirementMCDC method
* Overall code-cleanup

Issue-Ref: 3464
Issue-Url: https://af3-developer.fortiss.org/issues/3464

Signed-off-by: Ludwig Dickmanns's avatarLudwig Dickmanns <dickmanns@fortiss.org>
parent d0e57d09
......@@ -61,13 +61,6 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="testStep" eType="#//TestStep"
eOpposite="#//TestStep/outputs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FormalRequirementMCDC" eSuperTypes="platform:/resource/org.fortiss.af3.expression/model/expression.ecore#//terms/imperative/IfThenElse">
<eStructuralFeatures xsi:type="ecore:EReference" name="inputs" upperBound="-1"
eType="ecore:EClass platform:/resource/org.fortiss.af3.expression/model/expression.ecore#//terms/Var"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="outputs" upperBound="-1"
eType="ecore:EClass platform:/resource/org.fortiss.af3.expression/model/expression.ecore#//terms/Var"/>
</eClassifiers>
<eSubpackages name="statistic" nsURI="http://www.fortiss.org/af3/testing/model/statistic"
nsPrefix="org-fortiss-af3-testing-statistic">
<eClassifiers xsi:type="ecore:EClass" name="StateAutomatonExecutionStatistic"
......@@ -144,4 +137,14 @@
eType="ecore:EClass platform:/resource/org.fortiss.af3.state/model/state.ecore#//TransitionSegment"/>
</eClassifiers>
</eSubpackages>
<eSubpackages name="mcdc" nsURI="http://www.fortiss.org/af3/testing/model/mcdc"
nsPrefix="org-fortiss-af3-testing-mcdc">
<eClassifiers xsi:type="ecore:EClass" name="FormalRequirementMCDC" eSuperTypes="platform:/resource/org.fortiss.af3.expression/model/expression.ecore#//terms/imperative/IfThenElse">
<eStructuralFeatures xsi:type="ecore:EReference" name="inputs" upperBound="-1"
eType="ecore:EClass platform:/resource/org.fortiss.af3.expression/model/expression.ecore#//terms/Var"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="outputs" upperBound="-1"
eType="ecore:EClass platform:/resource/org.fortiss.af3.expression/model/expression.ecore#//terms/Var"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
......@@ -48,10 +48,6 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference testing.ecore#//TestOutput/simulatedValue"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference testing.ecore#//TestOutput/testStep"/>
</genClasses>
<genClasses ecoreClass="testing.ecore#//FormalRequirementMCDC">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference testing.ecore#//FormalRequirementMCDC/inputs"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference testing.ecore#//FormalRequirementMCDC/outputs"/>
</genClasses>
<nestedGenPackages prefix="Statistic" basePackage="org.fortiss.af3.testing.model"
disposableProviderFactory="true" ecorePackage="testing.ecore#//statistic">
<genClasses ecoreClass="testing.ecore#//statistic/StateAutomatonExecutionStatistic">
......@@ -122,5 +118,13 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference testing.ecore#//constraintResults/ExecutionError/problematicTransition"/>
</genClasses>
</nestedGenPackages>
<nestedGenPackages prefix="Mcdc" basePackage="org.fortiss.af3.testing.model" disposableProviderFactory="true"
ecorePackage="testing.ecore#//mcdc">
<genClasses ecoreClass="testing.ecore#//mcdc/FormalRequirementMCDC">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference testing.ecore#//mcdc/FormalRequirementMCDC/inputs"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference testing.ecore#//mcdc/FormalRequirementMCDC/outputs"/>
</genClasses>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
GenerateStateAutomatonUtils.java 81645f6c18da5bcc920f8671da4eeb622f8f69d4 GREEN
StatisticUtils.java d2ea1b26fc14f0b19d18604d330205b8aae3352e GREEN
TestingConstraintUtils.java 7c423db9009862b16a96c05ab7ef9a59d4af6c81 GREEN
TestingModelElementFactory.java d8d2372ffc226850662a6ea887db7ef8147aa779 RED
TestingUtils.java f808f4450df3d07f2e2bf93138f57a3a44c7d17a GREEN
TestingModelElementFactory.java fc8e2db6f45de44e7468abde29d89e9c87b56cbe YELLOW
TestingUtils.java 5f8a7b140e994a93d4c22ef9b57f03ee1a3fe237 YELLOW
......@@ -27,6 +27,7 @@ import static org.fortiss.af3.platform.utils.PlatformModelElementFactory.createP
import static org.fortiss.af3.project.utils.ConstraintsProjectUtils.getProjectConstraints;
import static org.fortiss.af3.testing.utils.TestingConstraintUtils.setTestSuite;
import static org.fortiss.af3.testing.utils.TestingConstraintUtils.setTestedComponent;
import static org.fortiss.af3.testing.utils.TestingUtils.validStatementSequenceMCDC;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.copy;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getParentElement;
......@@ -44,8 +45,6 @@ import org.fortiss.af3.deployment.model.InputPortAllocation;
import org.fortiss.af3.deployment.model.OutputPortAllocation;
import org.fortiss.af3.expression.model.terms.IExpressionTerm;
import org.fortiss.af3.expression.model.terms.Var;
import org.fortiss.af3.expression.model.terms.imperative.Assignment;
import org.fortiss.af3.expression.model.terms.imperative.IStatementTerm;
import org.fortiss.af3.expression.model.terms.imperative.StatementSequence;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.generic.GenericExecutionUnit;
......@@ -55,7 +54,6 @@ import org.fortiss.af3.project.model.typesystem.ITerm;
import org.fortiss.af3.state.model.State;
import org.fortiss.af3.state.model.TransitionSegment;
import org.fortiss.af3.testing.constraint.TestSuiteConstraint;
import org.fortiss.af3.testing.model.FormalRequirementMCDC;
import org.fortiss.af3.testing.model.TestCase;
import org.fortiss.af3.testing.model.TestInput;
import org.fortiss.af3.testing.model.TestOutput;
......@@ -66,6 +64,8 @@ import org.fortiss.af3.testing.model.TestingModelFactory;
import org.fortiss.af3.testing.model.coverage.CoverageFactory;
import org.fortiss.af3.testing.model.coverage.StateCoverage;
import org.fortiss.af3.testing.model.coverage.TransitionCoverage;
import org.fortiss.af3.testing.model.mcdc.FormalRequirementMCDC;
import org.fortiss.af3.testing.model.mcdc.McdcFactory;
import org.fortiss.af3.testing.model.statistic.IdleIntTupel;
import org.fortiss.af3.testing.model.statistic.StateAutomatonExecutionStatistic;
import org.fortiss.af3.testing.model.statistic.StateIntTupel;
......@@ -75,7 +75,6 @@ import org.fortiss.tooling.kernel.model.INamedElement;
import org.fortiss.tooling.kernel.model.constraints.ConstraintInstance;
import org.fortiss.tooling.kernel.model.constraints.ConstraintsFactory;
import org.fortiss.tooling.kernel.ui.service.IConstraintUIService;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
/**
* High-level utility methods for creating testing-model elements.
......@@ -328,98 +327,28 @@ public class TestingModelElementFactory {
return c;
}
// TODO(HP): Always us brackets for if. Even if they have a single command.
// TODO(HP): Better remove all the println
/** Creates a {@link FormalRequirementMCDC}. */
public static FormalRequirementMCDC createFormalRequirementMCDC(EList<Var> inputs,
EList<Var> outputs, IExpressionTerm guard, StatementSequence thenBlock,
StatementSequence elseBlock) {
for(Var var : EcoreUtils.getChildrenWithType(guard, Var.class)) {
if(inputs.contains(var))
continue;
System.out.println("Var " + var.toString() + " in guard is not contained in inputs.");
return null;
}
// TODO(HP): both for seems to do the same for each block. Extract a method (place it in utils) for this.
for(IStatementTerm statement : thenBlock.getStatements()) {
// TODO(HP): outputs.contains(((Assignment)statement).getVariable()) used several times. extract a variable
if(statement instanceof Assignment &&
outputs.contains(((Assignment)statement).getVariable())) {
// If the value of an assignment is only a {@link Var} getChildrenWithType returns
// an empty array.
// TODO(HP): ((Assignment)statement).getValue()) used several times. extract a variable.
if(((Assignment)statement).getValue() instanceof Var) {
if(inputs.contains(((Assignment)statement).getValue()))
continue;
Var var = (Var)((Assignment)statement).getValue();
System.out.println("Var " + var.toString() +
" on ths of assignment is not contained in inputs");
return null;
}
for(Var var : getChildrenWithType(((Assignment)statement).getValue(), Var.class)) {
if(inputs.contains(var))
continue;
System.out.println("Var " + var.toString() +
" on rhs of assignment is not contained in inputs.");
return null;
}
for(Var var : getChildrenWithType(guard, Var.class)) {
if(inputs.contains(var)) {
continue;
}
if(!(statement instanceof Assignment)) {
System.out.println("Statement " + statement.toString() + " is not an Assignment.");
return null;
}
if(statement instanceof Assignment &&
!outputs.contains(((Assignment)statement).getVariable())) {
System.out.println("Var " + ((Assignment)statement).getVariable().toString() +
" on lhs of assignment is not contained in outputs.");
return null;
}
System.out.println("Should not be reached!");
return null;
}
for(IStatementTerm statement : elseBlock.getStatements()) {
if(statement instanceof Assignment &&
outputs.contains(((Assignment)statement).getVariable())) {
// If the value of an assignment is only a {@link Var} getChildrenWithType returns
// an empty array
if(((Assignment)statement).getValue() instanceof Var) {
if(inputs.contains(((Assignment)statement).getValue()))
continue;
Var var = (Var)((Assignment)statement).getValue();
System.out.println("Var " + var.toString() +
" on rhs of assignment is not contained in inputs");
return null;
}
for(Var var : getChildrenWithType(((Assignment)statement).getValue(), Var.class)) {
if(inputs.contains(var))
continue;
System.out.println("Var " + var.toString() +
" on rhs of assignment is not contained in inputs.");
return null;
}
continue;
}
if(!(statement instanceof Assignment)) {
System.out.println("Statement " + statement.toString() + " is not an Assignment.");
return null;
}
if(statement instanceof Assignment &&
!outputs.contains(((Assignment)statement).getVariable())) {
System.out.println("Var " + ((Assignment)statement).getVariable().toString() +
" on lhs of assignment is not contained in outputs");
return null;
}
System.out.println("Should not be reached!");
return null;
}
boolean valid = true;
valid &= validStatementSequenceMCDC(inputs, outputs, thenBlock);
valid &= validStatementSequenceMCDC(inputs, outputs, elseBlock);
FormalRequirementMCDC req = TestingModelFactory.eINSTANCE.createFormalRequirementMCDC();
req.setGuard(guard);
req.setThenBlock(thenBlock);
req.setElseBlock(elseBlock);
return req;
if(valid) {
FormalRequirementMCDC req = McdcFactory.eINSTANCE.createFormalRequirementMCDC();
req.setGuard(guard);
req.setThenBlock(thenBlock);
req.setElseBlock(elseBlock);
return req;
}
return null;
}
}
......@@ -15,15 +15,23 @@
+--------------------------------------------------------------------------*/
package org.fortiss.af3.testing.utils;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.expression.model.terms.IExpressionTerm;
import org.fortiss.af3.expression.model.terms.Var;
import org.fortiss.af3.expression.model.terms.imperative.Assignment;
import org.fortiss.af3.expression.model.terms.imperative.IStatementTerm;
import org.fortiss.af3.expression.model.terms.imperative.StatementSequence;
import org.fortiss.af3.testing.constraint.TestSuiteConstraint;
import org.fortiss.af3.testing.model.TestCase;
import org.fortiss.af3.testing.model.TestInput;
......@@ -261,4 +269,48 @@ public class TestingUtils {
}
return null;
}
/**
* @param inputs
* - List of input variables
* @param outputs
* - List of output variables
* @param statementSequence
* - Statement sequence to validate
* @return <code>true</code> if:
* - Only {@link Assignment}s contained inside the <code>statementSequence</code>.
* - Only {@link Var}s contained in <code>outputs</code> on lhs of {@link Assignment}s.
* - Only {@link Var}s contained in <code>inputs</code> on rhs of {@link Assignment}s.
*/
public static boolean validStatementSequenceMCDC(EList<Var> inputs, EList<Var> outputs,
StatementSequence statementSequence) {
if(statementSequence == null || statementSequence.getStatements() == null) {
return false;
}
for(IStatementTerm statement : statementSequence.getStatements()) {
if(statement instanceof Assignment) {
if(!outputs.contains(((Assignment)statement).getVariable())) {
return false;
}
// If the value of an assignment is only a {@link Var} getChildrenWithType returns
// an empty array.
IExpressionTerm rhs = ((Assignment)statement).getValue();
if(rhs instanceof Var) {
if(inputs.contains(rhs)) {
continue;
}
return false;
}
for(Var var : getChildrenWithType(rhs, Var.class)) {
if(inputs.contains(var)) {
continue;
}
return false;
}
continue;
}
return false;
}
return true;
}
}
......@@ -31,8 +31,7 @@ import org.fortiss.af3.expression.model.terms.Var;
import org.fortiss.af3.expression.model.terms.imperative.Assignment;
import org.fortiss.af3.expression.model.terms.imperative.IStatementTerm;
import org.fortiss.af3.expression.model.terms.imperative.StatementSequence;
import org.fortiss.af3.testing.model.FormalRequirementMCDC;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
import org.fortiss.af3.testing.model.mcdc.FormalRequirementMCDC;
import org.junit.Test;
/**
......@@ -53,6 +52,7 @@ public class TestFormalRequirementMCDC {
* o1 = i1;
* }
*
* Creation should pass: No errors in creation.
*/
@Test
public void test01() {
......@@ -88,7 +88,7 @@ public class TestFormalRequirementMCDC {
Assignment e1 = assignment(o1, i1);
elseBlock = sequence(e1);
// Formal Requirement MCDC
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -101,9 +101,8 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}
*
* In guard:
*
* Output inside of the guard.
* Creation should fail:
* Output inside of the guard. Creation should return null.
*/
@Test
public void test02() {
......@@ -111,8 +110,7 @@ public class TestFormalRequirementMCDC {
EList<Var> inputs = new BasicEList<Var>();
EList<Var> outputs = new BasicEList<Var>();
IExpressionTerm guard;
StatementSequence thenBlock = null;
StatementSequence elseBlock = null;
StatementSequence thenBlock, elseBlock;
// Outputs.
Var o0 = createVar("o0");
......@@ -122,7 +120,13 @@ public class TestFormalRequirementMCDC {
IntConst intG = intConst(42);
guard = lowerEqual(o0, intG);
// Formal Requirement MCDC
// Else-Block.
thenBlock = singleAssignmentSequence(inputs, outputs);
// Else-Block.
elseBlock = singleAssignmentSequence(inputs, outputs);
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -133,9 +137,8 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In thenBlock:
*
* Input on lhs of an {@link Assignment}.
* Creation should fail:
* Input on lhs of an {@link Assignment} in thenBlock. Creation should return null.
*/
@Test
public void test03() {
......@@ -143,8 +146,7 @@ public class TestFormalRequirementMCDC {
EList<Var> inputs = new BasicEList<Var>();
EList<Var> outputs = new BasicEList<Var>();
IExpressionTerm guard;
StatementSequence thenBlock;
StatementSequence elseBlock = null;
StatementSequence thenBlock, elseBlock;
// Inputs.
Var i0 = createVar("i0");
......@@ -162,7 +164,10 @@ public class TestFormalRequirementMCDC {
Assignment t1 = assignment(i0, i1);
thenBlock = sequence(t1);
// Formal Requirement MCDC
// Else-Block.
elseBlock = singleAssignmentSequence(inputs, outputs);
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -173,9 +178,9 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In thenBlock:
*
* Output on rhs of an {@link Assignment} (rhs is just the Output).
* Creation should fail:
* Output on rhs of an {@link Assignment} (rhs is just the Output) in thenBlock. Creation should
* return null.
*/
@Test
public void test04() {
......@@ -183,8 +188,7 @@ public class TestFormalRequirementMCDC {
EList<Var> inputs = new BasicEList<Var>();
EList<Var> outputs = new BasicEList<Var>();
IExpressionTerm guard;
StatementSequence thenBlock;
StatementSequence elseBlock = null;
StatementSequence thenBlock, elseBlock;
// Inputs.
Var iG = createVar("iG");
......@@ -204,7 +208,10 @@ public class TestFormalRequirementMCDC {
Assignment t1 = assignment(o0, o1);
thenBlock = sequence(t1);
// Formal Requirement MCDC
// Else-Block.
elseBlock = singleAssignmentSequence(inputs, outputs);
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -215,9 +222,9 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In thenBlock:
*
* Output on rhs of an {@link Assignment} (rhs is an {@link IExpressionTerm}).
* Creation should fail:
* Output on rhs of an {@link Assignment} (rhs is an {@link IExpressionTerm}) in thenBlock.
* Creation should return null.
*/
@Test
public void test05() {
......@@ -225,8 +232,7 @@ public class TestFormalRequirementMCDC {
EList<Var> inputs = new BasicEList<Var>();
EList<Var> outputs = new BasicEList<Var>();
IExpressionTerm guard;
StatementSequence thenBlock;
StatementSequence elseBlock = null;
StatementSequence thenBlock, elseBlock;
// Inputs.
Var iG = createVar("iG");
......@@ -247,7 +253,10 @@ public class TestFormalRequirementMCDC {
Assignment t1 = assignment(o0, rhs);
thenBlock = sequence(t1);
// Formal Requirement MCDC
// Else-Block.
elseBlock = singleAssignmentSequence(inputs, outputs);
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -258,9 +267,8 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In elseBlock:
*
* Input on lhs of an {@link Assignment}.
* Creation should fail:
* Input on lhs of an {@link Assignment} in elseBlock. Creation should return null.
*/
@Test
public void test06() {
......@@ -296,7 +304,7 @@ public class TestFormalRequirementMCDC {
Assignment e1 = assignment(i1, i2);
elseBlock = sequence(e1);
// Formal Requirement MCDC
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -307,9 +315,9 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In elseBlock:
*
* Output on rhs of an {@link Assignment} (rhs is just the Output).
* Creation should fail:
* Output on rhs of an {@link Assignment} (rhs is just the Output) in elseBlock. Creation should
* return null.
*/
@Test
public void test07() {
......@@ -345,7 +353,7 @@ public class TestFormalRequirementMCDC {
Assignment e1 = assignment(o1, o2);
elseBlock = sequence(e1);
// Formal Requirement MCDC
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -356,9 +364,9 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In elseBlock:
*
* Output on rhs of an {@link Assignment} (rhs is an {@link IExpressionTerm}).
* Creation should fail:
* Output on rhs of an {@link Assignment} (rhs is an {@link IExpressionTerm}) in elseBlock.
* Creation should return null.
*/
@Test
public void test08() {
......@@ -395,7 +403,7 @@ public class TestFormalRequirementMCDC {
Assignment e1 = assignment(o1, rhs);
elseBlock = sequence(e1);
// Formal Requirement MCDC
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -406,10 +414,9 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In thenBlock:
*
* Creation should fail:
* The only {@link IStatementTerm} in thenBlock's {@link StatementSequence} is not an
* assignment.
* assignment. Creation should return null.
*/
@Test
public void test09() {
......@@ -417,8 +424,7 @@ public class TestFormalRequirementMCDC {
EList<Var> inputs = new BasicEList<Var>();
EList<Var> outputs = new BasicEList<Var>();
IExpressionTerm guard;
StatementSequence thenBlock;
StatementSequence elseBlock = null;
StatementSequence thenBlock, elseBlock;
// Inputs.
Var iG = createVar("iG");
......@@ -432,7 +438,10 @@ public class TestFormalRequirementMCDC {
Var t1 = createVar("t1");
thenBlock = sequence(t1);
// Formal Requirement MCDC
// Else-Block.
elseBlock = singleAssignmentSequence(inputs, outputs);
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
......@@ -443,10 +452,9 @@ public class TestFormalRequirementMCDC {
/**
* Wrong {@link FormalRequirementMCDC}.
*
* In elseBlock:
*
* Creation should fail:
* The only {@link IStatementTerm} in elseBlock's {@link StatementSequence} is not an
* assignment.
* assignment. Creation should return null.
*/
@Test
public void test10() {
......@@ -478,58 +486,24 @@ public class TestFormalRequirementMCDC {
Var e1 = createVar("e1");
elseBlock = sequence(e1);
// Formal Requirement MCDC
// Formal Requirement MCDC.
FormalRequirementMCDC formalRequirementMCDC;
formalRequirementMCDC =
createFormalRequirementMCDC(inputs, outputs, guard, thenBlock, elseBlock);
assert (formalRequirementMCDC == null);
System.out.println();
Var lhs = createVar("lhs");
Var rhs = createVar("rhs");
Assignment assignment = assignment(lhs, rhs);
EList<Var> list = EcoreUtils.getChildrenWithType(assignment.getValue(), Var.class);
System.out.println(list.toString());
}
/**
* Tests for:
* non-assignment in thenBlock and elseBlock with multiple statements
* Creates a {@link StatementSequence} with a single Assignment inside it adding the created
* {@link Var}s correctly to inputs and outputs.
*/