コード例 #1
0
 static public void TestCompareValues(string sInput, string sOutput)
 {
     Console.WriteLine("testing evaluation of " + sInput);
     Console.WriteLine("expecting result of " + sOutput);
     try
     {
         HeronValue input  = vm.EvalString(sInput);
         HeronValue output = vm.EvalString(sOutput);
         Console.WriteLine("test input was " + input.ToString());
         Console.WriteLine("test output was " + output.ToString());
         if (!input.Equals(output))
         {
             throw new Exception("Result was different than expected");
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("test failed with exception " + e.Message);
     }
 }
コード例 #2
0
 public static void Evaluate(VM vm, string sArg)
 {
     if (sArg.Length == 0)
     {
         Console.WriteLine("No expression to evaluate");
         return;
     }
     try
     {
         Console.WriteLine("Evaluating expression : " + sArg);
         HeronValue val = vm.EvalString(sArg);
         Console.WriteLine("Result : " + val.ToString());
     }
     catch (Exception e)
     {
         Console.WriteLine("Error occured : " + e.Message);
     }
 }
コード例 #3
0
 public static void Evaluate(VM vm, string sArg)
 {
     if (sArg.Length == 0)
     {
         Console.WriteLine("No expression to evaluate");
         return;
     }
     try
     {
         Console.WriteLine("Evaluating expression : " + sArg);
         HeronValue val = vm.EvalString(sArg);
         Console.WriteLine("Result : " + val.ToString());
     }
     catch (Exception e)
     {
         Console.WriteLine("Error occured : " + e.Message);
     }
 }