#pragma warning restore IDE0022 // Use expression body for methods static char Next(string vars, char next) { var e = ExprExtractor.GetExpression(vars).Single(); var uniq = new UniqVariable(e); return(uniq.Next(next)); }
public void State() { var uniq = new UniqVariable(ExprExtractor.GetExpression("c").Single()); Assert.AreEqual('b', uniq.Next('b')); Assert.AreEqual('a', uniq.Next('b')); Assert.AreEqual('d', uniq.Next('b')); }
public Evaluation(string input) { var expression = ExprExtractor.GetExpression(input); var calc = new Calculator(expression); calc.Evaluate(); Results = calc.Results; Error = calc.Error; }
public void Errors() { var abcxyz = "abcdefghijklmnopqrstuvwxyz"; Assert.ThrowsException <InvalidOperationException>(() => Next(abcxyz.ToUpper(), 'A')); Assert.ThrowsException <InvalidOperationException>(() => Next(abcxyz, 'a')); var bcxyz = abcxyz.Substring(1); var uniq = new UniqVariable(ExprExtractor.GetExpression(bcxyz + abcxyz.ToUpper()).Single()); Assert.AreEqual('a', uniq.Next('a')); Assert.ThrowsException <InvalidOperationException>(() => uniq.Next('a')); uniq = new UniqVariable(ExprExtractor.GetExpression(bcxyz).Single()); Assert.AreEqual('a', uniq.Next('b')); Assert.ThrowsException <InvalidOperationException>(() => uniq.Next('a')); }
static void IsSame(string input) => Assert.AreEqual(input, string.Join(Environment.NewLine, ExprExtractor.GetExpression(input)));
static Expression Parse(string input) => ExprExtractor.GetExpression(splitLines.Replace(input, Environment.NewLine)).Single();