From: <jom...@us...> - 2014-06-02 18:02:27
|
Revision: 1783 http://sourceforge.net/p/jason/svn/1783 Author: jomifred Date: 2014-06-02 18:02:23 +0000 (Mon, 02 Jun 2014) Log Message: ----------- fix bug related to failure plans for test goals Modified Paths: -------------- trunk/applications/as-unit-test/src/jason/tests/TestPlanFailure.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/environment/Environment.java Modified: trunk/applications/as-unit-test/src/jason/tests/TestPlanFailure.java =================================================================== --- trunk/applications/as-unit-test/src/jason/tests/TestPlanFailure.java 2014-06-02 17:36:24 UTC (rev 1782) +++ trunk/applications/as-unit-test/src/jason/tests/TestPlanFailure.java 2014-06-02 18:02:23 UTC (rev 1783) @@ -26,7 +26,13 @@ "-!g3(failure)[error(ia_failed)] : true <- infailg3. "+ "+!norel <- !j; endnorel. "+ - "-!j[error(no_relevant)] <- infailj. " + "-!j[error(no_relevant)] <- infailj. " + + + "+!s <- ?bufferReady; jason.asunit.print(ok)." + + "+?bufferReady : a <- jason.asunit.print(oka). " + + "+?bufferReady : not a <- .fail. " + + "-?bufferReady <- jason.asunit.print(w); ?bufferReady." + ); } @@ -46,4 +52,16 @@ ag.assertAct("infailj", 10); ag.assertAct("endnorel", 5); } + + @Test(timeout=2000) + public void testTestGoalFailure() { + ag.addGoal("s"); + ag.assertPrint("w", 10); + ag.assertPrint("w", 10); + ag.assertPrint("w", 10); + ag.addBel("a"); + ag.assertPrint("oka", 10); + ag.assertPrint("ok", 10); + } + } Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2014-06-02 17:36:24 UTC (rev 1782) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2014-06-02 18:02:23 UTC (rev 1783) @@ -929,8 +929,8 @@ || im.getCurrentStep().getBodyTerm() instanceof VarTerm) { im = i.pop(); // +!c above } - while (!i.isFinished() && //i.size() > 0 && - !(im.unif.unifies(im.getTrigger().getLiteral(), topLiteral) && im.getTrigger().isAchvGoal()) && + while (!i.isFinished() && + !(im.unif.unifies(im.getTrigger().getLiteral(), topLiteral) && im.getTrigger().isGoal()) && !(im.unif.unifies(im.getCurrentStep().getBodyTerm(), topLiteral) && im.getCurrentStep().getBodyType() == BodyType.achieve)) { im = i.pop(); } @@ -952,7 +952,6 @@ // new code optimised: handle directly renamed vars for the call // get vars in the unifier that comes from makeVarAnnon (stored in renamedVars) joinRenamedVarsIntoIntentionUnifier(im,topIM.unif); - im.removeCurrentStep(); } } Modified: trunk/src/jason/environment/Environment.java =================================================================== --- trunk/src/jason/environment/Environment.java 2014-06-02 17:36:24 UTC (rev 1782) +++ trunk/src/jason/environment/Environment.java 2014-06-02 18:02:23 UTC (rev 1783) @@ -375,6 +375,6 @@ */ public boolean executeAction(String agName, Structure act) { logger.info("The action "+act+" done by "+agName+" is not implemented in the default environment."); - return true; + return false; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |