Ejemplo n.º 1
0
        public static void debug_ListAllTermsFromString(string x, bool internalTest)
        {
            Console.WriteLine(x);

            TermLib.TermStack TStack = new TermLib.TermStack();
            TermLib.ScanExpression(x, ref TStack);
            while (!TStack.isEmpty)
            {
                try
                {
                    if (internalTest)
                    {
                        Console.Write("{0}, ", TStack.Pop().debug_GetValueAsString());
                    }
                    else
                    {
                        Console.Write("{0}, ", TStack.Pop().GetTermType);
                    }
                }
                catch (IndexOutOfRangeException e)
                {
                    Console.WriteLine(e.ToString());
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 public static void debug_TestOperator(TermLib.OPRType oper, TermLib.TermStack TStack)
 {
     TermLib.OPRTerm operObj = new TermLib.OPRTerm(oper);
     TermLib.PerformOperatorComputation(operObj, TStack);
     TermLib.TermAbsClass testt = TStack.Pop();
     Console.WriteLine(testt.debug_GetValueAsString());
 }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");

            // TODO: Implement Functionality Here
            string x = "2*Variable+1";

            TermLib.TermStack TStack = new TermLib.TermStack();

            /*NumberFormatInfo provider = new NumberFormatInfo();
             * provider.CurrencyDecimalSeparator=".";
             * double l = Convert.ToDouble("69.55",provider);
             * Console.WriteLine(l);*/

            TermLib.ScanExpression(x, ref TStack);
            while (!TStack.isEmpty)
            {
                try
                {
                    Console.Write("{0}, ", TStack.Pop().GetTermType);
                }
                catch (IndexOutOfRangeException e)
                {
                    break;
                }
            }
            //Console.Write("My debug {0}, {1}, {2}, {3}, {4}",t0,t1,t2,t3,t4);
            Console.ReadKey(true);
        }
Ejemplo n.º 4
0
        public static void debug_GivenOperatorTest(int iterations)
        {
            for (int i = 0; i < iterations; i++)
            {
                Console.WriteLine("Write which operator would you like to test:");
                string            opr    = Console.ReadLine();
                TermLib.TermStack inpOpr = new TermLib.TermStack();
                TermLib.ScanExpression(opr, ref inpOpr);
                var term = inpOpr.Pop();

                Console.WriteLine("Write here your first number for {0} check", (TermLib.OPRType)term.GetBitValue[0]);
                string            x       = Console.ReadLine();
                TermLib.TermStack testing = new TermLib.TermStack();
                TermLib.ScanExpression(x, ref testing);
                Console.WriteLine("And second one");
                x = Console.ReadLine();
                TermLib.ScanExpression(x, ref testing);
                DebugTools.debug_TestOperator((TermLib.OPRType)term.GetBitValue[0], testing);
            }
        }