public void EmptyLiteral() { var doc = new TestCompiledDocument(); var evaluator = new SyntaxEvaluator(doc, Substitute.For <IFunctionProvider>()); Assert.Equal(0, evaluator.GetCell <int>(new Cell("A1"))); }
public void SingleLiteral() { var doc = new TestCompiledDocument { { new Cell("A1"), Statement.NewLiteral(Literal.NewNumber(Number.NewInt(2))) } }; var evaluator = new SyntaxEvaluator(doc, Substitute.For <IFunctionProvider>()); Assert.Equal(2, evaluator.GetCell <int>(new Cell("A1"))); }
public void SingleBinaryAddition() { var doc = new TestCompiledDocument { { new Cell("A1"), Statement.NewFormula( Expression.NewBinaryExpression( Expression.NewLiteralExpression( Literal.NewNumber(Number.NewInt(2))), Operation.Add, Expression.NewLiteralExpression( Literal.NewNumber(Number.NewInt(3))))) } }; var evaluator = new SyntaxEvaluator(doc, Substitute.For <IFunctionProvider>()); Assert.Equal(5, evaluator.GetCell <int>(new Cell("A1"))); }