Map<TCGNode, List<TestGoalBase>> colTestGoals =
new LinkedHashMap<TCGNode, List<TestGoalBase>>();
// create corresponding test goals: for each event and each collected condition set
for(TCGTransition oOutgoingTransition : oTCGNode.getOutgoingTransitions()) {
TCGEvent oEvent = null;
if(!oOutgoingTransition.getEvents().isEmpty())
oEvent = oOutgoingTransition.getEvents().get(0);
TCGDisjunctiveNormalForm oDNF = oOutgoingTransition.getPrecondition();
{
if(oDNF == null)
continue;
// only proceed if the current DNF is intended for test goal creation
if(!oDNF.isUseForTestGoals())
continue;
// create test goals for each generated DNF
for(TCGDisjunctiveNormalForm oTestGoalDNF : in_oCoverageCriterion.createDNFsForTestGoals(oDNF))
{
// after creating the test goals: resolve DNF
// System.out.println("before: " +
// TCGDisjunctiveNormalFormHelperClass.toString(
// oTestGoalDNF));
if(TCGDisjunctiveNormalFormHelperClass.allConjunctionsRemovedBecauseOfInfeasibility(
oTestGoalDNF)) {
// invalid test goal
continue;
}
TCGDisjunctiveNormalFormHelperClass.splitUpInequationsInDNF(oTestGoalDNF);
TCGDisjunctiveNormalFormHelperClass.removeDoubleNots(oTestGoalDNF);
TCGConjunctionHelperClass.removeContradictingConjunctions(
oTestGoalDNF.getConjunctions());
TCGConjunctionHelperClass.removeRedundantExpressionsInConjunctions(
oTestGoalDNF.getConjunctions());
TCGConjunctionHelperClass.removeRedundantConjunctions(
oTestGoalDNF.getConjunctions());
List<TestGoalBase> colGoals = getDefaultCreatedListFromMap(
colTestGoals, oTCGNode);
boolean bTestGoalAdded = createNewTestGoalAndAddToCollection(
oTCGNode, oEvent,
TCGDisjunctiveNormalFormHelperClass.copyDNFDeep(oTestGoalDNF),
in_oCoverageCriterion, colGoals, true);
if(bTestGoalAdded &&
Configuration.getDuplicateTestGoalsForContainedNodes()) {
for(TCGNode oSubNode : TCGNodeHelperClass.getAllSubNodes(oTCGNode)) {
if(oSubNode instanceof TCGRealNode &&
TCGNodeHelperClass.getAllTransitionsWithoutTrigger(oSubNode).isEmpty()) {
colGoals = getDefaultCreatedListFromMap(colTestGoals, oSubNode);
createNewTestGoalAndAddToCollection(
oSubNode, oEvent,
TCGDisjunctiveNormalFormHelperClass.copyDNFDeep(oTestGoalDNF),
in_oCoverageCriterion, colGoals, false);
}
}
}
}
}
}
// Add test goals for events that are not called from state oTCGNode.
// There must be at least one outgoing transition with a non-default trigger.
if(Configuration.isCreateTestGoalsForUncalledEvents()) {
List<TCGEvent> colTriggeredEvents =
TCGNodeHelperClass.getTriggeringEventsForNode(oTCGNode);
boolean bOnlyDefaultTriggers = true;
for(TCGEvent oEvent : colTriggeredEvents) {
if(oEvent != null && !oEvent.isDefaultEvent()) {
bOnlyDefaultTriggers = false;
}
}
if(bOnlyDefaultTriggers == false) {
for(TCGEvent oEvent : colAllCalledEvents) {
if(!(oEvent == null || oEvent.isDefaultEvent() ||
//colTriggeredEvents.contains(oEvent))) {
ObjectComparator.contains(colTriggeredEvents, oEvent))) {
TestGoalGuardConditions oTestGoal =
new TestGoalGuardConditions(oTCGNode, oEvent,
TCGDisjunctiveNormalFormHelperClass.createDisjunctiveNormalForm(null, false));