Exemplo n.º 1
0
 public void Test()
 {
     string code = "(+ 7 10 (* 2 8))";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToFloat());
 }
Exemplo n.º 2
0
 public void Test(string code, float extected)
 {
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     float result = func.TryEvaluateToFloat();
     Debug.WriteLine(func.BuildParseTree().ToCode() + " => " + result);
     result.Should().Be(extected);
 }
Exemplo n.º 3
0
 public void BoolTest()
 {
     string code = "(And True False)";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToBool());
 }
Exemplo n.º 4
0
 public void Test(string code, float extected)
 {
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     float result = func.TryEvaluateToFloat();
     Debug.WriteLine(func.BuildParseTree().ToCode() + " => " + result);
     result.Should().Be(extected);
 }
Exemplo n.º 5
0
 public void BoolTest()
 {
     string code = "(And True False)";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToBool());
 }
Exemplo n.º 6
0
 public void Test3()
 {
     string code = "5";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     func.Should().BeOfType<IntConstant<Blackboard>>();
 }
Exemplo n.º 7
0
 public void Test2()
 {
     string code = "(* 2 Pi (+ A B))";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     Debug.WriteLine(func.TryEvaluateToFloat());
 }
Exemplo n.º 8
0
 public void Test3()
 {
     string code = "5";
     LispCompiler<Blackboard> lispCompiler = new LispCompiler<Blackboard>();
     Blackboard blackboard = new Blackboard();
     LispOperator<Blackboard> func = lispCompiler.Compile(blackboard, code);
     Debug.WriteLine(func.BuildParseTree().ToCode());
     func.Should().BeOfType<IntConstant<Blackboard>>();
 }