public void ParseStructure() { Structure s = new Structure("hello(brother)"); Structure resultado = AsSyntax.ParseStructure("hello(brother)"); Assert.AreEqual(s.ToString(), resultado.ToString()); }
public void ParserNumberTest() { INumberTerm nti = new NumberTermImpl(12.5); INumberTerm resultado = AsSyntax.ParseNumber("12,5"); Assert.AreEqual(nti.ToString(), resultado.ToString()); }
public void ParseListTermSimplePasses() { IListTerm lt = new ListTermImpl(new Atom("s1"), new Atom("s2")); IListTerm resultado = AsSyntax.ParseList("[bigfuckinggun]"); Assert.AreEqual(lt.ToString(), resultado.ToString()); }
public void ParseTerm() { ITerm t = new Atom("sister"); ITerm resultado = AsSyntax.ParseTerm("sister"); Assert.AreEqual(t.ToString(), resultado.ToString()); //StringAssert.AreEqualIgnoringCase(t.ToString(), resultado.ToString()); }
public void ParsePlanBody() { string pb = "<- .println(hello world)"; string pb2 = "<- glhjanusa"; ITerm t = new Atom(pb); IPlanBody planBody = new PlanBodyImpl(BodyType.Body_Type.internalAction, t); IPlanBody planBody2 = AsSyntax.ParsePlanBody(pb2); Assert.AreEqual(planBody.ToString(), planBody2.ToString()); }
public void ParsePlan() { Plan p = new Plan(); //Plan resultado = AsSyntax.ParsePlan("+!clear(X):tower([H | T]) & .member(X, T) <- move(H, table); !clear(X)."); string s = "+!init() <-.println(hello world)"; byte b = 0x1A; string.Concat(s, b); Plan resultado = AsSyntax.ParsePlan(s); Assert.AreEqual(p, resultado); }
public void ParseVarTermTest() { VarTerm vt = new VarTerm("A"); VarTerm resultado = AsSyntax.ParseVar("A"); Assert.NotNull(resultado); Assert.NotNull(vt); Assert.IsTrue(vt.IsVar()); Assert.IsTrue(resultado.IsVar()); Assert.IsTrue(vt.Equals(vt)); Assert.IsTrue(vt.Equals(vt)); Assert.IsTrue(vt.Equals(resultado)); Assert.AreNotSame(vt, resultado); Assert.AreEqual(vt, resultado); }
public void Run() { Literal newDesire = desire.ForceFullLiteralImpl().Copy(); Literal stateAnnot = AsSyntax.CreateLiteral("state", new Atom(state.ToString())); if (reason != null) { stateAnnot.AddAnnot(AsSyntax.CreateStructure("reason", new StringTermImpl(reason))); } newDesire.AddAnnot(stateAnnot); Trigger eEnd = new Trigger(TEOperator.desireState, type, newDesire); if (reasoner.GetAgent().GetPL().HasCandidatePlan(eEnd)) { reasoner.GetCircumstance().InsertMetaEvent(new Event(eEnd, null)); } }
public void ParseLiteralTest() { // Use the Assert class to test conditions Literal l = new LiteralImpl("tall"); string s = "tall(john)"; //string eof = "^Z"; //string.Concat(s, (char)26); //byte[] b = Encoding.ASCII.GetBytes(s); //byte[] array = new byte[b.Length + 1]; //byte eof = 0x1A; //for (int i = 0; i < b.Length; i++) //{ // array[i] = b[i]; //} //array[b.Length] = eof; //s = Encoding.ASCII.GetString(array, 0, array.Length); Literal resultado = AsSyntax.ParseLiteral(s); Assert.AreEqual(l.ToString(), resultado.ToString()); }
public ITerm GetAsTerm() { if (planBody is PlanBodyImpl || planBody == null) { IPlanBody bd; if (planBody == null) { bd = new PlanBodyImpl(); } else { bd = (IPlanBody)((PlanBodyImpl)planBody.Clone()).MakeVarsAnnon(); } bd.SetAsBodyTerm(true); Trigger te = GetTrigger().Clone(); te.SetAsTriggerTerm(true); return(AsSyntax.CreateStructure("im", AsSyntax.CreateString(plan.GetLabel()), te, bd, unif.GetAsTerm())); } else { return(AsSyntax.CreateAtom("noimplementedforclass" + planBody.GetType().Name)); } }