public void UpdateInPlace_Update_ApplyLambda_Atom() { //------------Setup for test-------------------------- var env = CreateEnvironmentWithData(); //------------Execute Test--------------------------- var updated = PublicFunctions.EvalUpdate("12", env, 0, a => DataStorage.WarewolfAtom.NewDataString("1x")); //------------Assert Results------------------------- var res = CommonFunctions.evalResultToString(EvaluationFunctions.eval(updated, 0, false, "[[x]]")); Assert.AreEqual(res, "1x"); }
public void UpdateInPlace_Update_ApplyLambda_ExpectError_Complex() { //------------Setup for test-------------------------- var env = CreateEnvironmentWithData(); //------------Execute Test--------------------------- // ReSharper disable once RedundantAssignment var updated = PublicFunctions.EvalUpdate("[[s]]", env, 0, a => DataStorage.WarewolfAtom.NewDataString("[[s]]")); updated = PublicFunctions.EvalUpdate("[[[[s]]]]", updated, 0, a => DataStorage.WarewolfAtom.NewDataString("e")); //------------Assert Results------------------------- var res = CommonFunctions.evalResultToString(EvaluationFunctions.eval(updated, 0, false, "[[s]]")); Assert.AreEqual(res, "e"); }
public void ApplyUpdate(string expression, Func <DataASTMutable.WarewolfAtom, DataASTMutable.WarewolfAtom> clause, int update) { var temp = PublicFunctions.EvalUpdate(expression, _env, update, clause); _env = temp; }