Esempio n. 1
0
 private static void VerifyIncrementString(string opstring)
 {
     StackCalc sc = new StackCalc(opstring);
     while (sc.DoNextOperation())
     {
         Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
     }
 }
Esempio n. 2
0
 private static void VerifySignString(string opstring)
 {
     StackCalc sc = new StackCalc(opstring);
     while (sc.DoNextOperation())
     {
         Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
     }
 }
Esempio n. 3
0
        private static void VerifyAbsoluteValueString(string opstring)
        {
            StackCalc sc = new StackCalc(opstring);

            while (sc.DoNextOperation())
            {
                Assert.AreEqual(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
            }
        }
Esempio n. 4
0
        private static void VerifyDivRemString(string opstring)
        {
            StackCalc sc = new StackCalc(opstring);

            while (sc.DoNextOperation())
            {
                Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
                sc.VerifyOutParameter();
            }
        }
Esempio n. 5
0
        private static bool VerifyLogString(string opstring)
        {
            bool      ret = true;
            StackCalc sc  = new StackCalc(opstring);

            while (sc.DoNextOperation())
            {
                ret &= Eval(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString(), String.Format("Out of Sync stacks found.  BigInteger {0} Mine {1}", sc.snCalc.Peek(), sc.myCalc.Peek()));
            }
            return(ret);
        }
 private static void VerifyDivRemString(string opstring)
 {
     try
     {
         StackCalc sc = new StackCalc(opstring);
         while (sc.DoNextOperation())
         {
             Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
             sc.VerifyOutParameter();
         }
     }
     catch (Exception e) when(!(e is DivideByZeroException))
     {
         // Log the original parameters, so we can reproduce any failure given the log
         throw new Exception($"VerifyDivRemString failed: {opstring} {e.ToString()}", e);
     }
 }
Esempio n. 7
0
        private static void VerifyIdentityString(string opstring1, string opstring2)
        {
            StackCalc sc1 = new StackCalc(opstring1);

            while (sc1.DoNextOperation())
            {
                //Run the full calculation
                sc1.DoNextOperation();
            }

            StackCalc sc2 = new StackCalc(opstring2);

            while (sc2.DoNextOperation())
            {
                //Run the full calculation
                sc2.DoNextOperation();
            }

            Assert.Equal(sc1.snCalc.Peek().ToString(), sc2.snCalc.Peek().ToString());
        }
Esempio n. 8
0
        private static bool VerifyIdentityString(string opstring1, string opstring2)
        {
            bool ret = true;

            StackCalc sc1 = new StackCalc(opstring1);

            while (sc1.DoNextOperation())
            {   //Run the full calculation
                sc1.DoNextOperation();
            }

            StackCalc sc2 = new StackCalc(opstring2);

            while (sc2.DoNextOperation())
            {   //Run the full calculation
                sc2.DoNextOperation();
            }

            ret &= Eval(sc1.snCalc.Peek().ToString(), sc2.snCalc.Peek().ToString(), String.Format("Out of Sync stacks found.  BigInteger1: {0} BigInteger2: {1}", sc1.snCalc.Peek(), sc2.snCalc.Peek()));

            return(ret);
        }
Esempio n. 9
0
        private static void VerifyIdentityString(string opstring1, string opstring2)
        {
            StackCalc sc1 = new StackCalc(opstring1);
            while (sc1.DoNextOperation())
            {
                //Run the full calculation
                sc1.DoNextOperation();
            }

            StackCalc sc2 = new StackCalc(opstring2);
            while (sc2.DoNextOperation())
            {	
                //Run the full calculation
                sc2.DoNextOperation();
            }

            Assert.Equal(sc1.snCalc.Peek().ToString(), sc2.snCalc.Peek().ToString());
        }
Esempio n. 10
0
 private static void VerifyDivRemString(string opstring)
 {
     try
     {
         StackCalc sc = new StackCalc(opstring);
         while (sc.DoNextOperation())
         {
             Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
             sc.VerifyOutParameter();
         }
     }
     catch(Exception e) when (!(e is DivideByZeroException))
     {
         // Log the original parameters, so we can reproduce any failure given the log
         throw new Exception($"VerifyDivRemString failed: {opstring} {e.ToString()}", e);
     }
 }
Esempio n. 11
0
 private static void VerifyDivRemString(string opstring)
 {
     StackCalc sc = new StackCalc(opstring);
     while (sc.DoNextOperation())
     {
         Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString());
         sc.VerifyOutParameter();
     }
 }