private static void VerifyIncrementString(string opstring) { StackCalc sc = new StackCalc(opstring); while (sc.DoNextOperation()) { Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString()); } }
private static void VerifySignString(string opstring) { StackCalc sc = new StackCalc(opstring); while (sc.DoNextOperation()) { Assert.Equal(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString()); } }
private static void VerifyAbsoluteValueString(string opstring) { StackCalc sc = new StackCalc(opstring); while (sc.DoNextOperation()) { Assert.AreEqual(sc.snCalc.Peek().ToString(), sc.myCalc.Peek().ToString()); } }
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(); } }
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); } }
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()); }
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); }
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); } }